| ??? 02/07/02 05:44 Read: times |
#19483 - Serial Comm Problem - Mode 1, Timer 2 |
Hi,
I need a bit of help with modifying some disassembled code. The original code ran the Serial port in Mode 2 at 375K. I need to be able to communicate between the controller and my PC, so needed to change it to 8 bit at a lower speed. Also, both Timer's 0 and 1 were already being used, so I have to use Timer 2. I ended up with the following settings: MOV 0CBH,#0FDH ;RCAP H = FDh MOV 0CAH,#08FH ;RCAP L = 8Fh MOV 0C8H,#026H ;setup timer 2 - 00100110 MOV SCON,#050H ;setup SCON Is this correct the correct way to do it? The Serial Interrupt Handler is as follows: JBC TI,L0058 ;SI handler JNB RI,L0058 AJMP L0032 L0032 PUSH ACC PUSH PSW MOV PSW,#018H MOV R1,SBUF CLR RI MOV A,@R1 JNB RB8,L0052 MOV R0,#00FH MOVX A,@R0 ADD A,#0FCH MOVX A,@R1 JC L0052 CLR EA INC P2 MOVX A,@R1 DEC P2 SETB EA ; L0052 MOV SBUF,A POP PSW POP ACC ; L0058 RETI This code seems to get the RAM at the address you send, then sends the contents of that address back. I'm pretty sure that I need to modify the code to change RCLK and TCLK but I'm not sure exactly how. Also, because it's no longer 9-bit, the RB8 bit is no longer being properly set - what do I do about that?? Sorry for the length of the post - I'm just a it lost (and frustrated) at the moment. I thought I had it modified properly, but for some reason my characters were just getting echoed. Any help would be greatly appreciated, George Ricketts |



