STM
STM
#include "stm32f10x.h"
// Define LCD control pins (RS, E) and data pins (D4, D5, D6, D7)
void LCD_INIT(void);
int main(void)
LCD_INIT();
while (1)
for (int start_pos = 0; start_pos < len + 16; start_pos++) // Loop to scroll text
if (start_pos == len) // If we reach the end of the string, reset to the beginning
start_pos = -1; // This will make it start scrolling from the beginning
void LCD_INIT(void)
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(LCD_GPIO_PORT, &GPIO_InitStructure);
}
void LCD_COMMAND(unsigned char cmd)
while (*str)
str++;
// Define LCD control pins (RS, E) and data pins (D4, D5, D6, D7)
void LCD_INIT(void);
int main(void)
LCD_INIT();
len1 = len;
while (1)
count = 0;
for (unsigned char cmd = 0x80; cmd <= 0x8F; cmd++) // Loop through LCD positions
LCD_COMMAND(cmd);
count++;
if (count > (16 - len1)) // If the string length is larger than 16 characters, shift
len1--;
LCD_STR(p + len1); // Shift the string
void LCD_INIT(void)
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(LCD_GPIO_PORT, &GPIO_InitStructure);
while (*str)
str++;