baudrate
equ baudrateconst
;replace baudrate with baudrateconst
tx
equ
txpin
;replace txpin with tx
rx
equ
rxpin
;replace rxpin with rx
sdata .section ’data’
;
count
db ?
;serial bit counter
txreg
db ?
;transmit data register
rcreg
db ?
;receive data register
delay
db ?
;delay counter
serial .section ’code’
;
transmit proc
;transmit a byte (Acc)
mov
txreg,a
;hold Acc at txreg
mov
a,baudrate
;load delay counter
mov
delay,a
;
clr
tx
;send start bit ’0’
mov
a,9
;load bit counter
mov
count,a
;
txdelay:
;
sdz
delay
;delay to fit baudrate
jmp
txdelay
;
mov
a,baudrate
;reload delay counter
mov
delay,a
;
sdz
count
;if transmit over?
jmp
sendbit
;no. send next bit
jmp
endtx
;yes. go ahead
sendbit:
rrc
txreg
;shift right through carry flag
snz
c
;is ’1’
jmp
lobit
;no. goto lobit
set
tx
;yes. send ’1’
jmp
txdelay
;repeat from txdelay
lobit:
;
clr
tx
;send ’0’
jmp
txdelay
;repeat from txdelay
endtx:
;
nop
;delay for a while
nop
;
set
tx
;send stop bit ’1’
t1:
;
sdz
delay
;delay between bits
jmp
t1
;(timing adjustment)
mov
a,baudrate
;
mov
delay,a
;
t2:
;
sdz
delay
;
jmp
t2
;
ret
;
transmit
endp
;
receive proc
;receive a byte
sz
rx
;if start bit ’0’
HT-IDE User’s Guide
206
Содержание 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 ...