| ??? 07/24/01 10:09 Read: times |
#13450 - RE: 80C320 serial port problems. |
Hi Chris,
your example send 2 bytes forever. And if you not start the HyperTeminal and the 80C320 at exact the same time, it can be, that never the right start bit was detected, since also data contain 1-0 transitions. Solution: wait minimal 1 byte time (= 10 bit times) to be sure, that the receiver was waiting for a start bit. I use the following macro to do it, Peter <pre> ;********************** wait 1 byte time (T1 = baud rate generator !) ;T1 must be running in mode 2 (auto reload) ;T0 not in mode 3 (split timers) ; MSIOWAIT MACRO LOCAL M1, M2 CLR IT1 ;disable timer 1 interrupt !!! MOV A, PCON ;PCON.7 = 0: prescaler 1/2 CPL ACC.7 M1: MOV R2, #160 ;10 Bits * 16 M2: JNB TF1 M2 CLR TF1 DJNZ R2 M2 JBC ACC.7 M1 ;repeat if prescaler 1/2 ENDM |



