We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When I configure uart communication of ADE7169 device(enhanced 8052 core),I encountered a problem that comment out or not the code (MOV PCON,#80H ;Here is not wor)(line 5) does not affect uart's baud.But as document description,SMOD (PCON MSB) will double baudrate if it is assert.I am sure I have assert SMOD ,because when I monitor sfr's state,i find this bit is set to one. Who know why?who can help me? Thank you in advanced! My code is follow: MOV RCAP2L,#0AFH ; MOV RCAP2H,#0FFH ; MOV TL2,#0AFH ; MOV TH2,#0FFH ; ;MOV PCON,#80H ;Here is not work MOV T2CON,#34H ;SET timer2 MOV SCON,#50H ;MODE1 and ENABLE RECV SETB EA ;GLOBAL INTERRUPT ENABLE SETB ES ;SERIAL INTERRUPT ENABLE
My keil version is 808a. I am sure that PCON MSB(SMOD) is asserted.I open peripherals -> serial.In this windows SMOD1 will be changed if I add such code(mov PCON,#80h;)in my program.But Transmit Baudrate and Receive Baudrate looks like no change if I add such code.
The showned value in "serial channel" has been doubled,isn't it?Or, When SMOD1 = 1,real uart baudrate equals Baudrate showned in "serial Channel" windows times 2.Am I right?
I want to set uart work at mode2,Tranmit Baudrate and Receive Baudrate depends on timer2.My code above is correct or not? Thanks in advance!
Look very closely at the data sheet. Figure 78 and the surrounding text indicate that SMOD has no effect if you are using Timer 2 to generate the baud rate.
-- Russ
Thank Russ Cooper very much.