EasyManua.ls Logo

Texas Instruments TI-83-Plus - Page 107

Texas Instruments TI-83-Plus
188 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2: TI-83 Plus Specific Information 97
TI-83 Plus Developer Guide Third Release May 28, 2002
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:
IN A,(bport) ; poll the port
AND D0D1_bits
CP D0D1_bits
JR Z,..noio ; jump if no activity
;
DI ; for speed
LD HL,ioData
LD (HL),A ; save code
LD BC,15 ; debounce counter
dblp1:
IN A,(bport) ; poll again
AND D0D1_bits
CP (HL) ; still the same data?
JR NZ, noIO ; no, failed debounce
;
DEC BC ; dec counter
LD A, C
OR B
JR NZ, dblp1 ; jump if debounce not done
;
AppOnErr Linkfail ; set error handler
SET indicOnly,(IY+indicFlags) ; no key scan
B_CALL RecAByteIO
EndexIO:
RES indicOnly,(IY+indicFlags) ; read the byte
LD (ioData),A ; save data
;
AppOffErr ; remove error handler
LD A,D0HD1H
OUT (bport),A ; reset B-port
LD A,(ioData) ; get data byte
CP A ;Z=1forsuccessful
EI
RET
linkfail:
LD A,D0HD1H
OUT (bport),A ; reset B-port
NoIO:
OR 1 ;Z=0forfail
EI
RET

Table of Contents

Other manuals for Texas Instruments TI-83-Plus

Related product manuals