There is a confusion here; let’s explain it ---
SMOD is bit 7 of PCON register and when set to “0” {SMOD=0} divides 1/12 of the clock frequency by 32.
When set to “1” {SMOD=1} divides 1/12 of the clock frequency by 16.
This is still within the PCON register.
SM0 and SM1 are bits of the SCON register.
Don’t confuse SMOD with SMs …
As far as the setting for 9600bps goes, serial mode1 is set by SM0=o and SM1=1, that makes the SCON register set to #50h (with the REN bit also set to “1”), not #80h.
The TMOD register should be set to #20h …
And bit7 of PCON (SMOD) set to “1” …
9600= 2 x 20MHz /[32 x12 x (256-TH1)]
TH1 =10.8 --- closest 11--- 0xf5
Something like:
Code:
MOV A, PCON ;A P CON
SET B ACC.7 ;make D7 = 1
MOV PCON, A ;SMOD = 1, double baud rate
MOV TMOD, #20 H ;Timer 1 mode 2, auto reload
MOV THI,#0F5 H
MOV SCON, #50 H
Now it should work …
:wink:
IanP