Shop OBEX P1 Docs P2 Docs Learn Events
Save a Newbie...Help with a Project...Please! — Parallax Forums

Save a Newbie...Help with a Project...Please!

ArchiverArchiver Posts: 46,084
edited 2001-05-30 21:35 in General Discussion
Hi Everyone,
I am an artist begining to embark on putting together interactive
electronic projects. I have almost completed the hardware for a
project which will measure swallowing using a flex sensor as part of
a necklace. I intend on making the measurement and sending the data
to a basic stamp which will count the number of times the value
recieved from the sensor reaches a particular value(149). This count
will then be outputed to a LED driver and finally displayed for a
second or so each time there is a new count value. I am using a BS1
and so have had to find and modify a shiftout routine that goes MSB
first. I have had minimal Basic experience several years ago and so
am pretty much a newbie. Would anyone like to give me input on the
code(following this message)... what do I need to add? Is the
structure logical?
It would be much appreciated... this is technically due (for a class)
tomorrow... but I doubt I'll have finished it on time.
ThankYou,
BCS


SYMBOL DispCon = W3
Init:
DispCon = $0C01 : gosub SetDisplay 'set shutdown register to
normal
DispCon = $0B03 : gosub SetDisplay 'set scan-limit to digits 0-3
DispCon = $0A08 : gosub SetDisplay 'set display brightness (8=half)
DispCon = $0C00 : gosub SetDisplay 'Blank Display

Begin:
SYMBOL RunningCount = w2 'number between 0 and 999 = assign
to word values (0-65535)
SYMBOL SensorAmount = b7 'input from sensor = byte value
(0-255)

LET RunningCount = 0

Loop:
IF SensorAmount>=149 THEN CountAndDisplay
goto Loop


CountAndDisplay:
RunningCount = RunningCount + 1
DEBUG RunningCount
GOSUB SETDISPLAY
PAUSE 300
GOTO Loop

SetDisplay: 'send data to MAX7219 chip- 4 digit
driver
shiftoutput:
output B7
for b7 = 0 to 7 'sets datapin to 0 or 1
low b7

IF b1 = $80 then So0
b1 = b1 * 2 'shift byte left
Pulsout 5,1 ' this sets pin5 high for 10 microseconds lhen low again

so0:
high b7

next
return

PulsOut 6,10 'latch data (confirmation)
Return
Sign In or Register to comment.