the problem is not with the string
yes i am getting 4500D8917D71 as the string on hyperterminal and proteus simulation
the problem is that I can display this string successfully on lcd ON SIMULATION(proteus)
but when it comes to hardware it displays like " <garbage character>-<garbage character>-4-5-0-0-<garbage character>-8-9-1
i.e. some characters are garbage
yes im using a compatible lcd (JHD 162A) .. i am not using external clock.. its atmega16's builtin 1MHz clock.. code is also for 1MHz....
I have posted the complete folder zipped in the above comments which includes my simulation and code which works on simulation... Download the zip file in COMMENT # 11 in this thread please go through it
in both unsigned int buffer[2] or int buffer[2]
following two errors are given
" Error: D:\RFID PROJECT\CODE.c(924): function argument #2 of type 'int [2]' is incompatible with required parameter of type 'unsigned char *' "
at " itoa(data,buffer,10); "
.
.
.
and
.
.
" Error: D:\RFID PROJECT\CODE.c(925): function argument #1 of type 'int [2]' is incompatible with required parameter of type 'unsigned char' "
at " lcd_data(buffer); "
on avr freaks they note that some older IAR or winavr compilers does not support the itoa functions. You may have one of those versions.
Here is a source code of itoa function, which may need to adapted to your program. **broken link removed**
- - - Updated - - -
that code are sample from the winavr . The itoa function covert the integers you have to ascill characters so be printable in your LCD. If that code does not work try to send an email to the company which produce the compiler if they have some update or if they had some sample code to do the same work.
char* itoa(int val, int base){
If you use AVR Studio or avr-gcc, it is much more simpler, and safer, to use <util/setbaud.h> for usart baud rate setting as it can handle the USE_2X bit automatically.
Errors:
F_CPU MUST be defined before including <util/delay.h>, if you don't get any warnings at compile time, then it is defined somewhere else, thus making you delays useless. You can define F_CPU as a symbol so it can be known across the source code.