Texas Instruments TI-83 Plus Manual page 107

Third release
Hide thumbs Also See for TI-83 Plus:
Table of Contents

Advertisement

Chapter 2: TI-83 Plus Specific Information
Example one:
The following routine is called to do a spot check of the link port for activity for a
single byte of data being sent.
If no activity is detected or any error occurs during communication, then Z = 0 is
returned.
If activity is detected, then the signal is debounced to make sure it is not random
noise.
The byte is then read and returned in the ACC with Z = 1.
haveIOcmd:
;
dblp1:
;
;
EndexIO:
;
linkfail:
NoIO:
TI-83 Plus Developer Guide
IN
A,(bport)
AND
D0D1_bits
CP
D0D1_bits
JR
Z,..noio
DI
LD
HL,ioData
LD
(HL),A
LD
BC,15
IN
A,(bport)
AND
D0D1_bits
CP
(HL)
JR
NZ, noIO
DEC
BC
LD
A, C
OR
B
JR
NZ, dblp1
AppOnErr
Linkfail
SET
indicOnly,(IY+indicFlags) ; no key scan
B_CALL
RecAByteIO
RES
indicOnly,(IY+indicFlags) ; read the byte
LD
(ioData),A
AppOffErr
LD
A,D0HD1H
OUT
(bport),A
LD
A,(ioData)
CP
A
EI
RET
LD
A,D0HD1H
OUT
(bport),A
OR
1
EI
RET
; poll the port
; jump if no activity
; for speed
; save code
; debounce counter
; poll again
; still the same data?
; no, failed debounce
; dec counter
; jump if debounce not done
; set error handler
; save data
; remove error handler
; reset B-port
; get data byte
; Z = 1 for successful
; reset B-port
; Z = 0 for fail
Third Release May 28, 2002
97

Advertisement

Table of Contents
loading

Table of Contents