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
Содержание HT-IDE
Страница 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Страница 12: ...HT IDE User s Guide 2 ...
Страница 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Страница 24: ...HT IDE User s Guide 14 ...
Страница 70: ...HT IDE User s Guide 60 ...
Страница 76: ...HT IDE User s Guide 66 ...
Страница 92: ...HT IDE User s Guide 82 ...
Страница 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Страница 94: ...HT IDE User s Guide 84 ...
Страница 148: ...HT IDE User s Guide 138 ...
Страница 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Страница 154: ...HT IDE User s Guide 144 ...
Страница 192: ...HT IDE User s Guide 182 ...
Страница 194: ...HT IDE User s Guide 184 ...
Страница 218: ...HT IDE User s Guide 208 ...
Страница 235: ...P a r t V Appendix Part V Appendix 225 ...
Страница 236: ...HT IDE User s Guide 226 ...
Страница 250: ...HT IDE User s Guide 240 ...