Parallax 28560 Manual page 15

Mouse sensor kit
Table of Contents

Advertisement

CONF
CON $1B
LORES CON $80
CHNG
CON $80
OFLOW CON $18
NEG
CON $80
' -----[ Variables ]---------------------------------------------------------
addr
VAR Byte
i
VAR Byte
dat
VAR Byte
sd
VAR Byte
q
VAR Byte
ovfl
VAR Byte
x
VAR Word
y
VAR Word
' -----[ Program ]-----------------------------------------------------------
'Initialize clock, depending on polarity.
#IF (NEG_CLK) #THEN
HIGH sclk
#ELSE
LOW sclk
#ENDIF
PAUSE 100
#IF (USE_500DPI) #THEN
addr = CONF
dat = LORES
GOSUB WriteAddr
#ENDIF
#IF (USE_DEBUG) #THEN
DEBUG CLS
#ENDIF
'Main program loop.
DO
#IF (DO_XYQ_ONLY) #THEN
GOSUB DumpXYQ
#ELSE
GOSUB DumpALL
#ENDIF
LOOP
' -----[ Subroutines ]-------------------------------------------------------
' DumpXYQ outputs X, Y, and Quality data to the programming port, for use with
' either DEBUG or an external program.
DumpXYQ:
addr = STAT
GOSUB ReadAddr
#IF (USE_DEBUG) #THEN
IF (dat & CHNG = 0) THEN
Copyright © Parallax Inc.
'Configuration register.
'Value to write to CONF for 500 dpi resolution.
'Bitmask for STAT to see if position changed.
'Bitmask for STAT to detect X/Y overflow.
'Sign bit for DX and DY.
'Address value for mouse sensor register.
'General counter.
'Data value to/from mouse sensor register.
'Scratch register.
'Quality value from mouse sensor.
'Overflow counter.
'Current cummulative X position.
'Current cummulative Y position.
'Wait for mouse sensor to come out of reset.
'Change resolution to 500 dpi.
'Clear the screen if using DEBUG window.
'Use this to monitor X, Y, and Quality only.
'Use this to dump all registers.
Mouse Sensor Kit (#28560)
v1.0 6/1/2010 Page 15 of 18

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 28560 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents