Soft_UART and LCD problem...

General discussion on mikroC.
Post Reply
Author
Message
vs02rjn
Posts: 3
Joined: 18 Jun 2005 13:53

Soft_UART and LCD problem...

#1 Post by vs02rjn » 18 Jun 2005 14:02

hello! please help!

Code: Select all

unsigned short data = 0, ro = 0;
unsigned short *er;
void main() {

  er = &ro;

  Soft_Uart_Init(PORTA, 1, 0, 9600);
  Lcd_Config(&PORTB,7,4,6,3,2,1,0);
  Lcd_Cmd(LCD_CLEAR);
  Lcd_Cmd(LCD_FIRST_ROW);
  Lcd_Cmd(LCD_CURSOR_OFF);
  LCD_Out_CP("RS-232: ");


  do {
    do {
      data = Soft_Uart_Read(er);
    } while (*er);
    if(data >= 48 && data <= 122)
            {
            Lcd_Chr_CP(data);
            }
  } while (1);
}
the problem is that when i'm sending something from the pc, the character (digit) fills the whole LCD...
i'vb tried to set the variable data = 0; after Lcd_Chr_CP(data);, but this doesn't change anything.
any suggestions?

P.S. i'm using a 16F84A with 10 MHz Xt

thanks

anton
Posts: 807
Joined: 23 Sep 2004 09:16
Location: South-Africa
Contact:

#2 Post by anton » 18 Jun 2005 14:17

Code: Select all

unsigned short data = 0, ro = 0;
unsigned short *er;
void main() {

  er = &ro;

  Soft_Uart_Init(PORTA, 1, 0, 9600);
  Lcd_Config(&PORTB,7,4,6,3,2,1,0);
  Lcd_Cmd(LCD_CLEAR);
  Lcd_Cmd(LCD_FIRST_ROW);
  Lcd_Cmd(LCD_CURSOR_OFF);
  LCD_Out_CP("RS-232: ");

   while (1)
   {
     if (Soft_USART_Data_Ready())
     {                                        // if data is received
          data = Soft_USART_Read();              // read the received data
          LCD_Out_CP(data);                    // send data via USART
     }
   }
Another proud user of LV 24-33A Development System and mikroPascal PRO for dsPIC :)
PortA not working? Add CMCON := 7; PortD not working? Add ADCON1 := 6;
To paste code on the forum, please use the [b] Code [/b] button !! ;)

vs02rjn
Posts: 3
Joined: 18 Jun 2005 13:53

#3 Post by vs02rjn » 18 Jun 2005 14:26

the Soft_Uart library doesn't have the
Soft_USART_Data_Ready()
function implemented...
only the USART library has suck a function...
i'm using version 2.0.0.3 of MikroC

thanks anyway

anton
Posts: 807
Joined: 23 Sep 2004 09:16
Location: South-Africa
Contact:

#4 Post by anton » 18 Jun 2005 15:25

Sorry, then i don't know :)
Another proud user of LV 24-33A Development System and mikroPascal PRO for dsPIC :)
PortA not working? Add CMCON := 7; PortD not working? Add ADCON1 := 6;
To paste code on the forum, please use the [b] Code [/b] button !! ;)

pizon
mikroElektronika team
Posts: 823
Joined: 11 Oct 2004 08:53

#5 Post by pizon » 20 Jun 2005 08:30

We have an error in our Help file :oops: :oops: . The code that does the job is:

Code: Select all

...
    do {
      data = Soft_Uart_Read(er);
    } while (!*er);
...
pizon

vs02rjn
Posts: 3
Joined: 18 Jun 2005 13:53

#6 Post by vs02rjn » 20 Jun 2005 12:08

thanks

now it works

Post Reply

Return to “mikroC General”