; ====================================================
; Initialize Serial communications A=Baud Rate
; With cristal oscillator of 11,059,200 value for auto-reloded Timer1 is calculated using the
; following formula: 256-57600/BaudRate=TH1
; Full formula: 256-[2pwrSMOD/32]*[SC/(12*BaudRate)]
Ser_Setup:
MOV PCON, #80h ; Set SMOD=1
MOV SCON, #52h
MOV TMOD, #20h
MOV DPTR, #BAUDRATE
MOVC A, @A+DPTR
MOV TH1, A
SETB TR1
RET
BAUDRATE:
DB 0FFh ; 57600 0
DB 0FEh ; 28800 1
DB 0FDh ; 19200 2
DB 0FCh ; 14400 3
DB 0FAh ; 9600 4
DB 0F4h ; 4800 5
DB 0E8h ; 2400 6
DB 0D0h ; 1200 7
DB 0A0h ; 600 8
DB 040h ; 300 9
; ==================================================
;
MOV A, #0 ; for 57600
; or MOV A, #1 ; for 28800
; or MOV A, #2 ; for 19200
; or 3 or 4 or 5 .... look at the BAUDRATE values inside IanP's code
; and choose one according to your hyperterminal baudrate settings
LCALL Ser_Setup
;
Unless you have implemented hardware handshaking (CTS and DSR connected to proper levels), which I doubt you have (I believe you connected only Rx and Tx from PC to the '51 via a level convertor such as MAX232), you should set handshaking to none; otherwise the PC won't send out anything.sunish said:i tried this but it didn't work
when i've checked the hyper terminal properties.(the pc exicutes a program and send the results to the hyper terminal),it shows the following
baud rate =1200
data bits=7
stop bit=1
parity =odd
hand shaking=hardware
IanP said:If you want to turn it ON set it to H:
ORL P1, #10000000b
and if you need to turn it OFF clear it to L:
ANL P1, #01111111b
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?