jmp
receive
;no. test again
mov
a,9
;yes. start receiving
mov
count,a
;load bit counter
mov
a,b1
;load delay counter
mov
delay,a
;(+1 for timing adjustment)
rxdelay:
;
sdz
delay
;delay to fit baudrate
jmp
rxdelay
;
mov
a,b1
;reload delay counter
mov
delay,a
;(+1 for timing adjustment)
sdz
count
;if receive over?
jmp
rxbit
;no. receive next bit
mov
a,rcreg
;yes. put received data to Acc
ret
;
rxbit:
;
set
c
;c=1
snz
rx
;if received ’1’?
clr
c
;no. c=0
rrc
rcreg
;shift left through carry flag
jmp
rxdelay
;repeat from rxdelay
receive endp
;
end
Program description
The most important element here is the baudrate parameter because the
transmiting and receiving of data have to be coordinated with the baudrate
speed. For this reason a formula as well as a table is provided to define this
constant. Because in this example the baudrate is not defined by using the
timer/counter some small discrepencies may exist, however according to
our tests using an 8051 the values given in the table are error free. The
higher the baudrate parameter the lower the error rate so by adjusting the
value of baudrate and system frequency the baudrate parameter value can
be raised.
Chapter 15 Input/Output Applications
207
Summary of Contents for HT-IDE
Page 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Page 12: ...HT IDE User s Guide 2 ...
Page 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Page 24: ...HT IDE User s Guide 14 ...
Page 70: ...HT IDE User s Guide 60 ...
Page 76: ...HT IDE User s Guide 66 ...
Page 92: ...HT IDE User s Guide 82 ...
Page 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Page 94: ...HT IDE User s Guide 84 ...
Page 148: ...HT IDE User s Guide 138 ...
Page 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Page 154: ...HT IDE User s Guide 144 ...
Page 192: ...HT IDE User s Guide 182 ...
Page 194: ...HT IDE User s Guide 184 ...
Page 218: ...HT IDE User s Guide 208 ...
Page 235: ...P a r t V Appendix Part V Appendix 225 ...
Page 236: ...HT IDE User s Guide 226 ...
Page 250: ...HT IDE User s Guide 240 ...