LCD_CMD(LCD_CLEAR) doesn't work at all, only in While loop?!
But put I drive the LCD in While, it woks all fine, but only aber 2 or three loops?!?!
WHY?
In Mikroe PAscal all works fine, same Controller Setting HSI 8MHz, no Pll etc
Code: Select all
/*STM32F103C8*/
// LCD module connections
sbit LCD_RS at GPIOB_ODR.B4;
sbit LCD_EN at GPIOB_ODR.B5;
sbit LCD_D4 at GPIOB_ODR.B6;
sbit LCD_D5 at GPIOB_ODR.B7;
sbit LCD_D6 at GPIOB_ODR.B8;
sbit LCD_D7 at GPIOB_ODR.B9;
// End LCD module connections
void main() {
GPIO_Digital_Output(&GPIOA_BASE, _GPIO_PINMASK_ALL); // Set PORTA as digital output
GPIO_Digital_Output(&GPIOB_BASE, _GPIO_PINMASK_ALL); // Set PORTB as digital output
GPIO_Digital_Output(&GPIOC_BASE, _GPIO_PINMASK_ALL); // Set PORTC as digital output
GPIO_Alternate_Function_Enable(&_GPIO_MODULE_SWJ_JTAGDISABLE );
Lcd_Init;
Delay_ms(10);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 3, "Hello World!");
//GPIOA_ODR = 0;
while(1) {
// Lcd_Cmd(_LCD_CLEAR);
// Lcd_Out(1, 3, "Hello World!");
GPIOC_ODR = ~GPIOC_ODR; // Toggle PORTC
Delay_ms(1000);
}
}