Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/29/02 13:39
Read: times


 
#26490 - RE: Need Odd Parity
Hello Sanjib,

You need to configure the UART to Mode 3 and use the TB8 and RB8 bits for the parity in transmit- and receive. As Félix already said, the PSW contains a Parity flag, which you can use to set (when transmitting) or check (when receiving) the parity bit in your communications.

For transmitting:
; Assume the ACC contains the byte to be transmitted
MOV C, P        ; Get the parity bit from PSW (this is even parity)
CPL  C          ; Complement it to get odd parity
MOV TB8, C      ; Copy it into the TB8 bit
MOV SBUF, A     ; Start transmission by writing to SBUF


For receiving:
MOV A, SBUF         ; Get the received byte
MOV C, RB8          ; Get the received parity
CPL C               ; Complement the carry to get odd parity
JC  TST_PAR1        ; If the Carry is set, check if the Parity flag is also set
JNB P, PARITY_OK    ; Else check if Parity flag is clear. If so, jump to PARITY_OK
JMP PARITY_NOK      ; If not, jump to PARITY_NOK

TST_PAR1:
JB  P, PARITY_OK
JMP PARITY_NOK


Hope this clarifies things a bit.

Best regards,
Rob.


List of 6 messages in thread
TopicAuthorDate
Need Odd Parity            01/01/70 00:00      
RE: Need Odd Parity            01/01/70 00:00      
RE: Need Odd Parity            01/01/70 00:00      
RE: Need Odd Parity            01/01/70 00:00      
RE: Need Odd Parity            01/01/70 00:00      
RE: Need Odd Parity            01/01/70 00:00      

Back to Subject List