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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/04/00 06:54
Read: times


 
#6932 - RE: RS485 communication
Hi, Steve
My code is as following, maybe you can help me to solve the problem.
org 0h
ajmp main
org 23h
ajmp SoutI
org 30h
mov sp,#60h
mov tmod,#20h
mov scon,#0d8h
mov th1,#0fah
setb tr1
setb es
setb ea
main02: mov r0,#0aeh
setb tb8
mov a,r0
acall TranSR
acall RecvSR
xrl a,ro
jnz main02
acall RecvSR
cpl a
xrl a,r0
jnz main02
clr tb8
mov a,#0ffh
acall TranSR
mov a,#0h
acall TranSR
acall RecvSR
xrl a,#0ffh
jnz main02
acall RecvSR
xrl a,#0h
jnz main02
mov a,#20h
acall TranSR
>>> by this step, it seems ok, but if process to the following, wrong data will be received, it seems unstable.
mov a,#20h
cpl a
acall TranSR
acall RecvSR
mov r1,a
acall RecvSR
cpl a
xrl a,r1
jnz main02
ret
TranSR: setb 02h
setb p1.0
setb p1.1
mov sbuf,a
jnb 00h,$
clr 00h
ret
RecvSR: clr 02h
clr p1.0
clr p1.1
jnb 01h,$
clr 01h
mov a,25h
ret
SoutI: push psw
push acc
jnb 02h,Sout1
jnb ri,Sout0
clr ri
mov a,sbuf
mov 25h,a
setb 01h
ajmp Sout0
Sout1: jnb ti,Sout0
setb 00h
clr ti
Sout0: pop acc
pop psw
reti


List of 8 messages in thread
TopicAuthorDate
RS485 communication            01/01/70 00:00      
RE: RS485 communication            01/01/70 00:00      
RE: RS485 communication            01/01/70 00:00      
RE: RS485 communication            01/01/70 00:00      
RE: RS485 communication            01/01/70 00:00      
RE: RS485 communication            01/01/70 00:00      
RE: RS485 communication            01/01/70 00:00      
RE: RS485 communication            01/01/70 00:00      

Back to Subject List