| ??? 06/03/03 07:26 Read: times |
#47335 - Try this code Responding to: ???'s previous message |
Hi Vinod,
Instead of finding out what is wrong with your code, i am giving the full code which works fine. Just check it out and find whats wrong as compared to yours. You just have to adjust for the TH1 and TL1 load values by altering the V24SPD equate statement. ============================================ ; Tested OK with 89c51RD2 kit running with 12Mhz crystal. ; Just configure COM2 port in WIN Hyperterminal for 4800/8/N/1 and set it to Auto Detect. ; Works with all types of terminal emulation in Hyper Terminal. Only in ViewData type there is ; some extra characters at the end. But still message can be read. V24SPD EQU 256-26 ; for 4800 Baud ORG 0000H V24SET: MOV PCON, #80H MOV TMOD, #22H MOV TH1, #V24SPD MOV TL1, #V24SPD SETB TCON.6 MOV SCON, #052H ;------------------------------------------------------ MAIN: MOV R7, #5 ; To print message 5 times NEXT: MOV DPTR, #MSG LCALL STXT LCALL CRLF MOV R4, #10 MOV R5, #255 MOV R6, #255 DLYLUP: DJNZ R5, $ MOV R5, #255 DJNZ R6, DLYLUP MOV R6, #255 DJNZ R4, DLYLUP DJNZ R7, NEXT SJMP $ ;------------------------------------------------------- STXT: NOP ; send text from program store at DPTR MOV A, #0 MOVC A, @A+DPTR JZ ETXT LCALL SEND INC DPTR SJMP STXT ETXT: RET BLANK: MOV A, #' ' ; send BLANK SJMP SEND CRLF: MOV A, #13 ; send a Carriage Return + Line Feed LCALL SEND MOV A, #10 LCALL SEND RET SEND: JNB SCON.1, $ ; wait for previous character to go.. CLR SCON.1 MOV SBUF, A RET GETCHR: NOP GETC1: JNB SCON.0, GETC1 CLR SCON.0 MOV A, SBUF RET BYTE: PUSH ACC ; send BYTE SWAP A LCALL NIBBLE POP ACC NIBBLE: ANL A, #0FH ADD A, #246 JC HEXOUT ADD A, #58 SJMP SEND HEXOUT: ADD A, #65 SJMP SEND MSG: DB 'This is Serial link test , 4800, N, 1' END |
| Topic | Author | Date |
| serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| still not sucessful | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
| RE: serial communication with AT89C2051 | 01/01/70 00:00 | |
Try this code | 01/01/70 00:00 |



