Mikro Failure? :-( LCD Work only in While loop

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
corado
Posts: 399
Joined: 28 Mar 2009 11:03

Mikro Failure? :-( LCD Work only in While loop

#1 Post by corado » 05 Oct 2023 16:22

If I try this with an 16x2 LCD, sometimes there are some signs on screen, wrong space, wrong signs etc.
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);
  }
}
Last edited by corado on 05 Oct 2023 16:31, edited 1 time in total.

corado
Posts: 399
Joined: 28 Mar 2009 11:03

---

#2 Post by corado » 05 Oct 2023 16:31

---
Last edited by corado on 05 Oct 2023 18:41, edited 1 time in total.

corado
Posts: 399
Joined: 28 Mar 2009 11:03

--

#3 Post by corado » 05 Oct 2023 17:34

---

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: Mikro Failure? :-( LCD Work only in While loop

#4 Post by corado » 05 Oct 2023 18:49

I hate C so much!!

This was the failure
Lcd_Init;

it must be
Lcd_Init();

Post Reply

Return to “mikroC PRO for ARM General”