??? 11/14/06 16:04 Read: times |
#127971 - Serial interface- Displaying SBUF data on LCD. |
I am currently trying to use the serial interface on 8051 uC. I have used the TXD and RXD lines to do ISP (In System Programming), but I'm having a problem sending data to the uC from a computer or a mag card reader and displaying it on LCD. I am using a MAX232 chip for the serial interface and I have verified that it works by using a loop back test from Hyperterminal.
WHen i send a specific character to the LCD all I get is some weird characters (characters I dont want). Plus, its not consistent. Send the same character twice and its different each time. I have tried sending ASCII, HEX, etc. and it still gives me some weird characters. Below is integral part of the code I wrote for the interface. This is just the code necessary to read and display data on the LCD. Please give me your feedback. Thanks in advance. ORG 0023h LJMP CARDswipe MOV TMOD,#021h ;sets T1 as 8-bit reload/T0 as 16 bit mov IE,#94h MOV TCON,#14H MOV SCON,#050h ;Sets serial port to mode 1 MOV A,PCON SETB ACC.7 ;Set Bit 7 SMOD MOV PCON,A MOV TH1,#0F2H ;sets reload value for baud rate SETB TR1 ;starts timer LOOP: SJMP $ ;Wait here CARDswipe: JNB RI,CARDswipe ; checek for interupt flag MOV A, SBUF ; move serial data into Acc MOV R0,#01h ;clear the LCD screen LCALL wrLCDcom ; send clear command MOV R0, A ; move ACC data to R0 LCALL wrLCDdata ; Write to screen from R0 lcall delay_1s ; wait a little RETI |
Topic | Author | Date |
Serial interface- Displaying SBUF data on LCD. | 01/01/70 00:00 | |
what device? | 01/01/70 00:00 | |
Just the 'integral part' Part of code | 01/01/70 00:00 | |
you still did not tell the derivative | 01/01/70 00:00 | |
Formatted Code | 01/01/70 00:00 | |
Missing code | 01/01/70 00:00 | |
Delay | 01/01/70 00:00 | |
Delay, Baudrate, Freq, etc. | 01/01/70 00:00 | |
Missing Code | 01/01/70 00:00 | |
Here's the wrLCDcom SR | 01/01/70 00:00 | |
is DELAY_5_1MS timer based? | 01/01/70 00:00 | |
Yes DELAY_5_1MS is timer based | 01/01/70 00:00 | |
so, you call one device generating an interrupt fr | 01/01/70 00:00 | |
Already tried that | 01/01/70 00:00 | |
then keep it that way | 01/01/70 00:00 | |
Here's the entire code.... | 01/01/70 00:00 | |
I quick look, not an analysis![]() | 01/01/70 00:00 | |
Have a look at this | 01/01/70 00:00 | |
Deriviative??? | 01/01/70 00:00 | |
Derivative | 01/01/70 00:00 | |
Oops... Derivative..gotcha | 01/01/70 00:00 | |
OK | 01/01/70 00:00 | |
TI & RI | 01/01/70 00:00 |