I am trying to solve this problem with 8051 in Assembly language. So, here is the question: There is 8-bit data comes from the Computer with 9600 baudrate. Each data gets parity check with 8051 microcontroller. If data parity is 1, R0 increases. If it's zero, R1 increases. After 10 data, if the data with parity 1 is greater than data with parity 0, then P1.0 led lights up. Else, P1.1 led lights up. Write to program for this. ( Crystal 11.059MHz )
I wrote this, but how do I get the data parity?
MOV TMOD,#00100000B
MOV SCON,#11001000B
MOV TH1,#-3
SETB TR1
MOV R0,#0
MOV R1,#0
MOV R2,#10
MAIN:
JNB RI,$
CLR RI
MOV A,SBUF
MOV C,RB8
MOV P,C
JB P,PARITY1
PARITY0:
INC R1
SJMP DONGU
PARITY1:
INC R0
DONGU:
DJNZ R2,MAIN
MOV A,R0
SUBB A,R1
JC LEDB
LEDA:
CPL P1.0
SJMP DONE
LEDB:
CPL P1.1
DONE: NOP
END
I think this part is nonsense for this problem, what should do?
MOV C,RB8
MOV P,C
Thank you for your help.