Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/28/03 18:19
Read: times


 
#55654 - RE: I'm stuck with unexpected code behavior
Responding to: ???'s previous message
Thanks for the kind comments. Unfortunately I think the HW is OK, at least the LCD access part.

Based on your comments I've tried the following code:
xdata char msg1[]="abc";
xdata char msg2[]="def";

void main()
{
   bit temp;

   init_8255();

   init_lcd();
   lcd_open_backlight();
   lcd_cursor_on();

   // print the first messages to the first row 
   // and beginning from column 10
   lcd_print(10, 0, msg1);
   lcd_print(10, 1, msg2);

   // here I'm waiting user confirmation
   // state_active_pin is a 8255 pin which is 
   // connected to a jumper. 
   // here I wait till the jumper is removed
   temp = state_active_pin;
   while (state_active_pin == temp);

   // in this version of code
   // do not use strcpy()
   // copy by hand
   msg1[0]='0';msg1[1]='1';msg1[2]='2';msg1[3]=0;
   msg2[0]='9';msg2[1]='8';msg2[2]='7';msg2[3]=0;

   // print to column 0
   lcd_print(0, 2, msg1);
   lcd_print(0, 3, msg2);

   while(1);
}


With this code, I get the following output until the jumper is removed:
__________012_______
__________987_______
____________________
____________________


Once the jumper is removed I get the following output:
__________012_______
__________987_______
012_________________
987_________________


Here, I see 2 problems:

First is the initialization problem. msg1 and msg2 were initialized but, they hold the values which will be copied into them.

Another problem is the strcpy. In my first example, I'd strcpied to both msg1 and msg2. However msg1 was empty string.

:(

Andy, I think the code is OK with debugger because, I put a breakpoint to the function sending data to the LCD and the parameters was in correspondence with the memory dump.

List of 9 messages in thread
TopicAuthorDate
I'm stuck with unexpected code behavior            01/01/70 00:00      
   RE: I'm stuck with unexpected code behavior            01/01/70 00:00      
   RE: I'm stuck with unexpected code behavior            01/01/70 00:00      
      RE: I'm stuck with unexpected code behavior            01/01/70 00:00      
   RE: I\'m stuck with unexpected code behavior            01/01/70 00:00      
      RE: I'm stuck with unexpected code behavior            01/01/70 00:00      
         RE: I'm stuck with unexpected code behavior            01/01/70 00:00      
            RE: I'm stuck with unexpected code behavior            01/01/70 00:00      
               RE: I'm stuck with unexpected code behavior            01/01/70 00:00      

Back to Subject List