How To include the data from the register stored and output as LCD data? - M9S12NE64

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How To include the data from the register stored and output as LCD data? - M9S12NE64

4,979 Views
Malaysia
Contributor I
 Hi,
 
 I'm new in using the Freescale M9S12NE64 with the CodeWarrior software. I'm trying out the EVB9S12NE64 board. Currently I'm facing the problem to put the data getting from the SCI0 to display in the LCD. The LCD module that I've done can be work properly by using the SPI interface. I manage to control the LED1 and LED2 by sending the data through the COM port and also read from the COM port. I'm using the Processor Expert as for my testing the board. The problem that I facing is when I intend want to display the data getting from SCI0 to LCD, the compiler getting error, and the error are "Wrong number of arguments" as I highlight as read colours.
 
void main()
{
 byte  RXByte;
 
 LCDInit(); 
 AS1_Init();
 
 LCDPuts_Line1(" Hello I'm LEE KAH JOO  ");    // line 1
 LCDPuts_Line2("I'm a Good R&D ENGINEER ");    // line 2
 for(;:smileywink:{
 
   while(AS1_RecvChar(&RXByte) == ERR_OK);
   if(RXByte==0x0F)
   {       
     LED1_PutVal(TRUE);
     LED2_PutVal(FALSE);
     LCDPuts_Line1("The Data is %d.       ",&RXByte);    // line 1
      LCDPuts_Line2("                        ");    // line 2
   }
   else
   {       
     LED1_PutVal(FALSE);
     LED2_PutVal(TRUE);
     LCDPuts_Line1("The Data is %d.       ",&RXByte);    // line 1
      LCDPuts_Line2("                        ");    // line 2
   }
      
  while(!SCI0SR1_TDRE);
  AS1_SendChar(RXByte);
  
  for( i=0; i<60000; ++i );
  for( i=0; i<60000; ++i );
     
 }
}
 
How I going to get it done when I want to display the data in the LCD Screen?
Labels (1)
0 Kudos
5 Replies

899 Views
pittbull
Contributor III
Hello,

It seems that LCDPuts_Line1 only accepts a single argument (char*).
Try something like this:

char buff[32];
....
sprintf (buff, "The data is %d", RXByte);
LCDPuts_Line1 (buff);
...
0 Kudos

899 Views
Malaysia
Contributor I
Hi pittbull,
 
 Thanks for the suggestion, and it's works. By the way there is somethings that's I'm not quite understand. What's the function of using "sprintf", cause I'm new in C and previously I'm using the Assambly language?
 
 But there is something unexpected result come's out, which is when the "RXByte" received the data from the COM port and also transmit back to the COM port, the result that I've get was same. However, the result display in the LCD are different.
 
  When I giving 0x0F, it display in the LCD is "15".
  When I giving 0x00, it display in the LCD is "0.".
  When I giving 0x45, it display in the LCD is "69"....
 
So can I know why the output display is different? And how to solve it?
 
By the way, can you show me where I can get more information on C programming? Thanks.
0 Kudos

899 Views
pittbull
Contributor III
Hi Malaysia,

The reason why you see a different output is the '%d' in the sprintf call. This means 'decimal output'. If you need hex instead, use '%x'.

There are many online tutorials about C programming, for example this one: http://www.its.strath.ac.uk/courses/c/

For a function reference you may look at this: http://www.cplusplus.com/ref/

Most development kits also have a function reference...

Cheers,
pittbull
0 Kudos

899 Views
Malaysia
Contributor I

Hi pittbull,

   Thanks again for your information. I've try it out and it's works, and by the way I found some material from the software help menu. Besides, also thanks for your website that you've introduce to me.

  Actually I'm coming from Malaysia and don't know why the website can't show my name, and my name is KahJoo. Hoping that I can learn from you in the future. Thank you so much.

Regards

kahjoo

0 Kudos

899 Views
Malaysia
Contributor I

Hi,

 Thanks for the idea, I'll try and see. Thanks a lot.

0 Kudos