BS2 Without Stamp Stack
Archiver
Posts: 46,084
I would like to use my SX28AC/DP Basic Stamp chip without the Stamp Stack II
provided by www.HVWTech.com <http://www.hvwtech.com/> . I've built a small
PCB which has only the SX28AC/DP chip attached to it and I'm attaching it to
the breadboard which is set up exactly as it was when I was using the Stamp
Stack II (All pins, buttons, the power supply and the LCD. are in the same
place). I've downloaded my program onto the chip (using the Stamp Stack),
carefully connected the IO pins I'm using, provided 5V continuous power to
Vdd and Ground to Vss. But the program does not seem to be running.
Obviously nothing is showing on the LCD but the IO pins don't change as they
should either. The LCD is powered up and working it is just that it is not
receiving input from my program. What am I missing? This is a pretty basic
program that drives an LCD. I've included the program below but the problem
should not be the program. The program runs fine when connected through the
Stamp Stack. Do I need to connect a resonator to OSC1 and OSC2? Is there
some sort of power up sequence I'm not following? Remember, I'm new to
electronics and BS programming so I may be missing something that is plain
as day to those of you who are more experienced.
Thanks for your help!
Scott
'{$STAMP BS2sx}
'{$PBASIC 2.5}
Lock VAR Bit 'Used to only count button press once per press
Lock = 0
Trip VAR Nib 'Holds which round's score is to be Dsplyed
Trip = 100
TTShots VAR Word
TTShots = 0
TTHits VAR Word
TTHits = 0
TTPct VAR Word
TTPct = 0
'RESET VAR Word 'Count how long reset button is held
INPUT 0 'Dsply button
HIGH 0
INPUT 2 'Shot button
HIGH 2
INPUT 3 'Reset or Alt button
HIGH 3
INPUT 4 'Hit button
HIGH 4
RS PIN 5
RW PIN 6
E PIN 7
Hole DATA @200, $0E,$1F,$1F,$1F,$1F,$1F,$0E,$00 '@100 stores starting at
location 100
CGRam CON $40 ' Custom character RAM
SNDCHAR VAR Byte 'Char to write
LoopCount VAR Byte 'Used exit wait if wait is stuck
ii VAR Nib 'Used for char write loop
HOLD1 VAR Word 'Holds the number of 50ms loops clear button was held
pressed
Dsply VAR Bit 'Change what Dsply holds
Dsply = 0 'Default to Shots Hits
INIT:
PAUSE 20
DIRH = %11111111 ' setup pins for LCD
OUTPUT 5'RS
OUTPUT 6'RW
OUTPUT 7'E
LOW RS
LOW RW
OUTD = %0011
PULSOUT E,1
PAUSE 5
OUTD = %0011
PULSOUT E,1
PAUSE 100
OUTD = %0011
PULSOUT E,1
OUTH = %00001100'00001111
PULSOUT E,1
OUTH = %00000001
PULSOUT E,1
OUTH = %00000010
PULSOUT E,1
OUTH = %00000010
PULSOUT E,1
PAUSE 100
GOSUB INTRO
PAUSE 500
'DEBUG "INIT"
'Clear the LCD and Post Score for given round
GOSUB CLEAR_LCD
GOSUB CALC_PCT
MAINLOOP:
'PAUSE 1000
GOSUB Check_Shot
GOSUB Check_Hit
GOSUB Check_Reset
GOSUB Check_Alt
GOTO MAINLOOP
Check_Shot:
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN2 = 0 AND Lock = 0) THEN
Dsply = 0
GOSUB Add_Shot
ENDIF
RETURN
Check_Hit:
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN4 = 0 AND Lock = 0) THEN
Dsply = 0
GOSUB Add_Hit
ENDIF
RETURN
Check_Reset:
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN3 = 0 AND Lock = 0) THEN
Lock = 1
GOSUB DO_RESET
GOTO MAINLOOP 'Had to put in to prevent program auto reboot???
ENDIF
RETURN
Check_Alt:
'BUTTON 2,1,255,255,BtnWrk,1,Add_Shot
'pin,downstate,delay,rate,bytevariable,targetstate,address
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN0 = 0 AND Lock = 0) THEN
Lock = 1
IF Dsply = 1 THEN
Dsply = 0'Show Shots Hits
ELSE
Dsply = 1'Show Pct
ENDIF
GOSUB Calc_Pct
ENDIF
GOTO MAINLOOP
Add_Shot:
'WRITE 1, 0
LOCK = 1
READ Trip, TTShots
TTShots = TTShots + 1
WRITE Trip, TTShots
'I VAR Byte
'FOR I = 1 TO TTShots
'FREQOUT 1,1500,1500,2500
'NEXT
GOSUB Calc_Pct
GOTO MAINLOOP
Add_Hit:
Lock = 1
READ Trip, TTShots
READ (Trip + 1), TTHits 'Changed to 2 from 1 because storing Word takes
2 bytes
TTHits = TTHits + 1 MAX TTShots 'Can't have more hits than shots
WRITE (Trip + 1), TTHits
'FREQOUT 1,750,2500
'FREQOUT 1,750,2500
GOSUB Calc_Pct
'Skip_Hit:
GOTO MAINLOOP
Calc_Pct:
READ Trip, TTShots
READ Trip+1,TTHits
'TTPct = ((TTHits * 100) / TTShots)
TTPct = (TTHits * 1000) / TTShots
'WRITE (Trip + 4), TTPct 'Can always calculate percent no need to store
GOSUB CLEAR_LCD
IF Dsply < 1 THEN
FOR ii=2 TO 0
SNDCHAR=TTShots DIG ii + 48 ' get jth digit, add 48 for ascii
GOSUB WRITE_TEXT ' put it on the lcd, not shown
NEXT
GOSUB POSITION_CURSOR
FOR ii=2 TO 0
SNDCHAR=TTHits DIG ii + 48 ' get jth digit, add 48 for ascii
GOSUB WRITE_TEXT ' put it on the lcd, not shown
NEXT
ELSE 'Show Percent
OUTH = %10000010
GOSUB POSITION_CURSOR_SEND
FOR ii=3 TO 0
SNDCHAR=TTPct DIG ii + 48 ' get jth digit, add 48 for ascii
GOSUB WRITE_TEXT ' put it on the lcd, not shown
IF ii = 1 THEN
SNDCHAR = %00101110'Period
GOSUB WRITE_TEXT
ENDIF
NEXT
SNDCHAR = %00100101'%
GOSUB WRITE_TEXT
ENDIF
'GOSUB Print
RETURN
DO_RESET:
WRITE Trip, 0 'TTShots
PAUSE 500
WRITE (Trip + 1), 0 'TTHits
PAUSE 500
'WRITE (Trip + 4), 0 'TTPct
'PAUSE 500
GOSUB CALC_PCT
RETURN
DO_UNLOCK:
LOCK = 0
RETURN
Print:
'DEBUG ? OUT15
'DEBUG ? OUT0
'DEBUG ? IN4,CR
'DEBUG ? IN3,CR
'DEBUG ? Lock, CR
RETURN
'
LCD
CODE
WAIT_LCD:
LoopCount = LoopCount + 1
LOW RS
HIGH RW
INPUT 15'IN DB7
IF IN15 = 1 AND LoopCount < 50 THEN WAIT_LCD
PULSOUT E,1
LOW RW
OUTPUT 15
LoopCount = 0
RETURN
CLEAR_LCD:
LOW RS
LOW RW
OUTH = %00000001
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
WRITE_TEXT:
HIGH RS
LOW RW
OUTH = SNDCHAR
PULSOUT E,1
LOW RS
GOSUB WAIT_LCD
RETURN
MOVE_RIGHT:
LOW RS
LOW RW
OUTH = %00010000
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
SHIFT_LEFT:
LOW RS
LOW RW
OUTH = %00011000
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
POSITION_CURSOR:
LOW RS
LOW RW
OUTH = %10000101
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
POSITION_CURSORB:
LOW RS
LOW RW
OUTH = %10001000
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
POSITION_CURSOR_SEND:
LOW RS
LOW RW
OUTH = SNDCHAR
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
INTRO:
HIGH RS ' prepare to write CG
data
LOW RW
SNDCHAR = CGRam ' point to CG RAM
GOSUB POSITION_CURSOR_SEND
addr VAR Byte ' address in EE and Dsply
FOR addr = HOLE TO HOLE + 7 ' build 4 custom chars
READ addr,SNDCHAR ' get byte from EEPROM
GOSUB WRITE_TEXT ' put into LCD CG RAM
NEXT
LOW RS
GOSUB POSITION_CURSORB
SNDCHAR = %01001000'H
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01001111'O
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01010100'T
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01010011'S
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01001000'H
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01001111'O
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01010100'T
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 2000
SNDCHAR = %10001001'First O
GOSUB POSITION_CURSOR_SEND
SNDCHAR = %00000000'HOLE
GOSUB WRITE_TEXT
PAUSE 500
SNDCHAR = %10001101'Second O
GOSUB POSITION_CURSOR_SEND
SNDCHAR = %00000000'HOLE
GOSUB WRITE_TEXT
PAUSE 2000
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
RETURN
WRITE_PINS:
'DEBUG ? IN0
'DEBUG ? IN2
'DEBUG ? IN3
'DEBUG ? IN4
'PAUSE 500
'DEBUG "INS="
'DEBUG BIN ? INS, CR
'DEBUG "OUTS="
'DEBUG BIN ? OUTS, CR
'DEBUG "DIRS="
'DEBUG BIN ? DIRS, CR
'PAUSE 500
RETURN
[noparse][[/noparse]Non-text portions of this message have been removed]
provided by www.HVWTech.com <http://www.hvwtech.com/> . I've built a small
PCB which has only the SX28AC/DP chip attached to it and I'm attaching it to
the breadboard which is set up exactly as it was when I was using the Stamp
Stack II (All pins, buttons, the power supply and the LCD. are in the same
place). I've downloaded my program onto the chip (using the Stamp Stack),
carefully connected the IO pins I'm using, provided 5V continuous power to
Vdd and Ground to Vss. But the program does not seem to be running.
Obviously nothing is showing on the LCD but the IO pins don't change as they
should either. The LCD is powered up and working it is just that it is not
receiving input from my program. What am I missing? This is a pretty basic
program that drives an LCD. I've included the program below but the problem
should not be the program. The program runs fine when connected through the
Stamp Stack. Do I need to connect a resonator to OSC1 and OSC2? Is there
some sort of power up sequence I'm not following? Remember, I'm new to
electronics and BS programming so I may be missing something that is plain
as day to those of you who are more experienced.
Thanks for your help!
Scott
'{$STAMP BS2sx}
'{$PBASIC 2.5}
Lock VAR Bit 'Used to only count button press once per press
Lock = 0
Trip VAR Nib 'Holds which round's score is to be Dsplyed
Trip = 100
TTShots VAR Word
TTShots = 0
TTHits VAR Word
TTHits = 0
TTPct VAR Word
TTPct = 0
'RESET VAR Word 'Count how long reset button is held
INPUT 0 'Dsply button
HIGH 0
INPUT 2 'Shot button
HIGH 2
INPUT 3 'Reset or Alt button
HIGH 3
INPUT 4 'Hit button
HIGH 4
RS PIN 5
RW PIN 6
E PIN 7
Hole DATA @200, $0E,$1F,$1F,$1F,$1F,$1F,$0E,$00 '@100 stores starting at
location 100
CGRam CON $40 ' Custom character RAM
SNDCHAR VAR Byte 'Char to write
LoopCount VAR Byte 'Used exit wait if wait is stuck
ii VAR Nib 'Used for char write loop
HOLD1 VAR Word 'Holds the number of 50ms loops clear button was held
pressed
Dsply VAR Bit 'Change what Dsply holds
Dsply = 0 'Default to Shots Hits
INIT:
PAUSE 20
DIRH = %11111111 ' setup pins for LCD
OUTPUT 5'RS
OUTPUT 6'RW
OUTPUT 7'E
LOW RS
LOW RW
OUTD = %0011
PULSOUT E,1
PAUSE 5
OUTD = %0011
PULSOUT E,1
PAUSE 100
OUTD = %0011
PULSOUT E,1
OUTH = %00001100'00001111
PULSOUT E,1
OUTH = %00000001
PULSOUT E,1
OUTH = %00000010
PULSOUT E,1
OUTH = %00000010
PULSOUT E,1
PAUSE 100
GOSUB INTRO
PAUSE 500
'DEBUG "INIT"
'Clear the LCD and Post Score for given round
GOSUB CLEAR_LCD
GOSUB CALC_PCT
MAINLOOP:
'PAUSE 1000
GOSUB Check_Shot
GOSUB Check_Hit
GOSUB Check_Reset
GOSUB Check_Alt
GOTO MAINLOOP
Check_Shot:
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN2 = 0 AND Lock = 0) THEN
Dsply = 0
GOSUB Add_Shot
ENDIF
RETURN
Check_Hit:
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN4 = 0 AND Lock = 0) THEN
Dsply = 0
GOSUB Add_Hit
ENDIF
RETURN
Check_Reset:
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN3 = 0 AND Lock = 0) THEN
Lock = 1
GOSUB DO_RESET
GOTO MAINLOOP 'Had to put in to prevent program auto reboot???
ENDIF
RETURN
Check_Alt:
'BUTTON 2,1,255,255,BtnWrk,1,Add_Shot
'pin,downstate,delay,rate,bytevariable,targetstate,address
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN0 = 0 AND Lock = 0) THEN
Lock = 1
IF Dsply = 1 THEN
Dsply = 0'Show Shots Hits
ELSE
Dsply = 1'Show Pct
ENDIF
GOSUB Calc_Pct
ENDIF
GOTO MAINLOOP
Add_Shot:
'WRITE 1, 0
LOCK = 1
READ Trip, TTShots
TTShots = TTShots + 1
WRITE Trip, TTShots
'I VAR Byte
'FOR I = 1 TO TTShots
'FREQOUT 1,1500,1500,2500
'NEXT
GOSUB Calc_Pct
GOTO MAINLOOP
Add_Hit:
Lock = 1
READ Trip, TTShots
READ (Trip + 1), TTHits 'Changed to 2 from 1 because storing Word takes
2 bytes
TTHits = TTHits + 1 MAX TTShots 'Can't have more hits than shots
WRITE (Trip + 1), TTHits
'FREQOUT 1,750,2500
'FREQOUT 1,750,2500
GOSUB Calc_Pct
'Skip_Hit:
GOTO MAINLOOP
Calc_Pct:
READ Trip, TTShots
READ Trip+1,TTHits
'TTPct = ((TTHits * 100) / TTShots)
TTPct = (TTHits * 1000) / TTShots
'WRITE (Trip + 4), TTPct 'Can always calculate percent no need to store
GOSUB CLEAR_LCD
IF Dsply < 1 THEN
FOR ii=2 TO 0
SNDCHAR=TTShots DIG ii + 48 ' get jth digit, add 48 for ascii
GOSUB WRITE_TEXT ' put it on the lcd, not shown
NEXT
GOSUB POSITION_CURSOR
FOR ii=2 TO 0
SNDCHAR=TTHits DIG ii + 48 ' get jth digit, add 48 for ascii
GOSUB WRITE_TEXT ' put it on the lcd, not shown
NEXT
ELSE 'Show Percent
OUTH = %10000010
GOSUB POSITION_CURSOR_SEND
FOR ii=3 TO 0
SNDCHAR=TTPct DIG ii + 48 ' get jth digit, add 48 for ascii
GOSUB WRITE_TEXT ' put it on the lcd, not shown
IF ii = 1 THEN
SNDCHAR = %00101110'Period
GOSUB WRITE_TEXT
ENDIF
NEXT
SNDCHAR = %00100101'%
GOSUB WRITE_TEXT
ENDIF
'GOSUB Print
RETURN
DO_RESET:
WRITE Trip, 0 'TTShots
PAUSE 500
WRITE (Trip + 1), 0 'TTHits
PAUSE 500
'WRITE (Trip + 4), 0 'TTPct
'PAUSE 500
GOSUB CALC_PCT
RETURN
DO_UNLOCK:
LOCK = 0
RETURN
Print:
'DEBUG ? OUT15
'DEBUG ? OUT0
'DEBUG ? IN4,CR
'DEBUG ? IN3,CR
'DEBUG ? Lock, CR
RETURN
'
LCD
CODE
WAIT_LCD:
LoopCount = LoopCount + 1
LOW RS
HIGH RW
INPUT 15'IN DB7
IF IN15 = 1 AND LoopCount < 50 THEN WAIT_LCD
PULSOUT E,1
LOW RW
OUTPUT 15
LoopCount = 0
RETURN
CLEAR_LCD:
LOW RS
LOW RW
OUTH = %00000001
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
WRITE_TEXT:
HIGH RS
LOW RW
OUTH = SNDCHAR
PULSOUT E,1
LOW RS
GOSUB WAIT_LCD
RETURN
MOVE_RIGHT:
LOW RS
LOW RW
OUTH = %00010000
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
SHIFT_LEFT:
LOW RS
LOW RW
OUTH = %00011000
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
POSITION_CURSOR:
LOW RS
LOW RW
OUTH = %10000101
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
POSITION_CURSORB:
LOW RS
LOW RW
OUTH = %10001000
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
POSITION_CURSOR_SEND:
LOW RS
LOW RW
OUTH = SNDCHAR
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
INTRO:
HIGH RS ' prepare to write CG
data
LOW RW
SNDCHAR = CGRam ' point to CG RAM
GOSUB POSITION_CURSOR_SEND
addr VAR Byte ' address in EE and Dsply
FOR addr = HOLE TO HOLE + 7 ' build 4 custom chars
READ addr,SNDCHAR ' get byte from EEPROM
GOSUB WRITE_TEXT ' put into LCD CG RAM
NEXT
LOW RS
GOSUB POSITION_CURSORB
SNDCHAR = %01001000'H
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01001111'O
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01010100'T
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01010011'S
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01001000'H
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01001111'O
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01010100'T
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 2000
SNDCHAR = %10001001'First O
GOSUB POSITION_CURSOR_SEND
SNDCHAR = %00000000'HOLE
GOSUB WRITE_TEXT
PAUSE 500
SNDCHAR = %10001101'Second O
GOSUB POSITION_CURSOR_SEND
SNDCHAR = %00000000'HOLE
GOSUB WRITE_TEXT
PAUSE 2000
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
RETURN
WRITE_PINS:
'DEBUG ? IN0
'DEBUG ? IN2
'DEBUG ? IN3
'DEBUG ? IN4
'PAUSE 500
'DEBUG "INS="
'DEBUG BIN ? INS, CR
'DEBUG "OUTS="
'DEBUG BIN ? OUTS, CR
'DEBUG "DIRS="
'DEBUG BIN ? DIRS, CR
'PAUSE 500
RETURN
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
programming connector and components (two caps) -- the rest are critical
to the operation of the Stamp. Remember that the Stamp is a
microcontroller so yes, it needs a clock source (resonator). And the
program is stored in an external EEPROM, so you need that too. You can
get schematics of our OEM BASIC Stamps (the parts the Stamp Stack is
built from) from our web site.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Scott Wilkinson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Y9v87lmiUmiDg64UXz7tFaBrfgX53vTMttFnz4iM3e22WtArmvpXsJCnN3QVWBiuqlDIE7sKN3Flj27CUWdzdYrs]smwilkinson@e...[/url
Sent: Saturday, October 04, 2003 12:22 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] BS2 Without Stamp Stack
I would like to use my SX28AC/DP Basic Stamp chip without the Stamp
Stack II provided by www.HVWTech.com <http://www.hvwtech.com/> . I've
built a small PCB which has only the SX28AC/DP chip attached to it and
I'm attaching it to the breadboard which is set up exactly as it was
when I was using the Stamp Stack II (All pins, buttons, the power supply
and the LCD. are in the same place). I've downloaded my program onto
the chip (using the Stamp Stack), carefully connected the IO pins I'm
using, provided 5V continuous power to Vdd and Ground to Vss. But the
program does not seem to be running. Obviously nothing is showing on the
LCD but the IO pins don't change as they should either. The LCD is
powered up and working it is just that it is not receiving input from my
program. What am I missing? This is a pretty basic program that drives
an LCD. I've included the program below but the problem should not be
the program. The program runs fine when connected through the Stamp
Stack. Do I need to connect a resonator to OSC1 and OSC2? Is there
some sort of power up sequence I'm not following? Remember, I'm new to
electronics and BS programming so I may be missing something that is
plain
as day to those of you who are more experienced.
Thanks for your help!
Scott
'{$STAMP BS2sx}
'{$PBASIC 2.5}
Lock VAR Bit 'Used to only count button press once per press
Lock = 0
Trip VAR Nib 'Holds which round's score is to be Dsplyed
Trip = 100
TTShots VAR Word
TTShots = 0
TTHits VAR Word
TTHits = 0
TTPct VAR Word
TTPct = 0
'RESET VAR Word 'Count how long reset button is held
INPUT 0 'Dsply button
HIGH 0
INPUT 2 'Shot button
HIGH 2
INPUT 3 'Reset or Alt button
HIGH 3
INPUT 4 'Hit button
HIGH 4
RS PIN 5
RW PIN 6
E PIN 7
Hole DATA @200, $0E,$1F,$1F,$1F,$1F,$1F,$0E,$00 '@100 stores
starting at
location 100
CGRam CON $40 ' Custom character RAM
SNDCHAR VAR Byte 'Char to write
LoopCount VAR Byte 'Used exit wait if wait is stuck
ii VAR Nib 'Used for char write loop
HOLD1 VAR Word 'Holds the number of 50ms loops clear button was
held
pressed
Dsply VAR Bit 'Change what Dsply holds
Dsply = 0 'Default to Shots Hits
INIT:
PAUSE 20
DIRH = %11111111 ' setup pins for LCD
OUTPUT 5'RS
OUTPUT 6'RW
OUTPUT 7'E
LOW RS
LOW RW
OUTD = %0011
PULSOUT E,1
PAUSE 5
OUTD = %0011
PULSOUT E,1
PAUSE 100
OUTD = %0011
PULSOUT E,1
OUTH = %00001100'00001111
PULSOUT E,1
OUTH = %00000001
PULSOUT E,1
OUTH = %00000010
PULSOUT E,1
OUTH = %00000010
PULSOUT E,1
PAUSE 100
GOSUB INTRO
PAUSE 500
'DEBUG "INIT"
'Clear the LCD and Post Score for given round
GOSUB CLEAR_LCD
GOSUB CALC_PCT
MAINLOOP:
'PAUSE 1000
GOSUB Check_Shot
GOSUB Check_Hit
GOSUB Check_Reset
GOSUB Check_Alt
GOTO MAINLOOP
Check_Shot:
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN2 = 0 AND Lock = 0) THEN
Dsply = 0
GOSUB Add_Shot
ENDIF
RETURN
Check_Hit:
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN4 = 0 AND Lock = 0) THEN
Dsply = 0
GOSUB Add_Hit
ENDIF
RETURN
Check_Reset:
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN3 = 0 AND Lock = 0) THEN
Lock = 1
GOSUB DO_RESET
GOTO MAINLOOP 'Had to put in to prevent program auto reboot???
ENDIF
RETURN
Check_Alt:
'BUTTON 2,1,255,255,BtnWrk,1,Add_Shot
'pin,downstate,delay,rate,bytevariable,targetstate,address
IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
IF (IN0 = 0 AND Lock = 0) THEN
Lock = 1
IF Dsply = 1 THEN
Dsply = 0'Show Shots Hits
ELSE
Dsply = 1'Show Pct
ENDIF
GOSUB Calc_Pct
ENDIF
GOTO MAINLOOP
Add_Shot:
'WRITE 1, 0
LOCK = 1
READ Trip, TTShots
TTShots = TTShots + 1
WRITE Trip, TTShots
'I VAR Byte
'FOR I = 1 TO TTShots
'FREQOUT 1,1500,1500,2500
'NEXT
GOSUB Calc_Pct
GOTO MAINLOOP
Add_Hit:
Lock = 1
READ Trip, TTShots
READ (Trip + 1), TTHits 'Changed to 2 from 1 because storing Word
takes 2 bytes
TTHits = TTHits + 1 MAX TTShots 'Can't have more hits than shots
WRITE (Trip + 1), TTHits
'FREQOUT 1,750,2500
'FREQOUT 1,750,2500
GOSUB Calc_Pct
'Skip_Hit:
GOTO MAINLOOP
Calc_Pct:
READ Trip, TTShots
READ Trip+1,TTHits
'TTPct = ((TTHits * 100) / TTShots)
TTPct = (TTHits * 1000) / TTShots
'WRITE (Trip + 4), TTPct 'Can always calculate percent no need to
store
GOSUB CLEAR_LCD
IF Dsply < 1 THEN
FOR ii=2 TO 0
SNDCHAR=TTShots DIG ii + 48 ' get jth digit, add 48 for ascii
GOSUB WRITE_TEXT ' put it on the lcd, not shown
NEXT
GOSUB POSITION_CURSOR
FOR ii=2 TO 0
SNDCHAR=TTHits DIG ii + 48 ' get jth digit, add 48 for ascii
GOSUB WRITE_TEXT ' put it on the lcd, not shown
NEXT
ELSE 'Show Percent
OUTH = %10000010
GOSUB POSITION_CURSOR_SEND
FOR ii=3 TO 0
SNDCHAR=TTPct DIG ii + 48 ' get jth digit, add 48 for ascii
GOSUB WRITE_TEXT ' put it on the lcd, not shown
IF ii = 1 THEN
SNDCHAR = %00101110'Period
GOSUB WRITE_TEXT
ENDIF
NEXT
SNDCHAR = %00100101'%
GOSUB WRITE_TEXT
ENDIF
'GOSUB Print
RETURN
DO_RESET:
WRITE Trip, 0 'TTShots
PAUSE 500
WRITE (Trip + 1), 0 'TTHits
PAUSE 500
'WRITE (Trip + 4), 0 'TTPct
'PAUSE 500
GOSUB CALC_PCT
RETURN
DO_UNLOCK:
LOCK = 0
RETURN
Print:
'DEBUG ? OUT15
'DEBUG ? OUT0
'DEBUG ? IN4,CR
'DEBUG ? IN3,CR
'DEBUG ? Lock, CR
RETURN
'
LCD
CODE
WAIT_LCD:
LoopCount = LoopCount + 1
LOW RS
HIGH RW
INPUT 15'IN DB7
IF IN15 = 1 AND LoopCount < 50 THEN WAIT_LCD
PULSOUT E,1
LOW RW
OUTPUT 15
LoopCount = 0
RETURN
CLEAR_LCD:
LOW RS
LOW RW
OUTH = %00000001
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
WRITE_TEXT:
HIGH RS
LOW RW
OUTH = SNDCHAR
PULSOUT E,1
LOW RS
GOSUB WAIT_LCD
RETURN
MOVE_RIGHT:
LOW RS
LOW RW
OUTH = %00010000
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
SHIFT_LEFT:
LOW RS
LOW RW
OUTH = %00011000
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
POSITION_CURSOR:
LOW RS
LOW RW
OUTH = %10000101
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
POSITION_CURSORB:
LOW RS
LOW RW
OUTH = %10001000
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
POSITION_CURSOR_SEND:
LOW RS
LOW RW
OUTH = SNDCHAR
PULSOUT E,1
GOSUB WAIT_LCD
RETURN
INTRO:
HIGH RS ' prepare to write
CG
data
LOW RW
SNDCHAR = CGRam ' point to CG RAM
GOSUB POSITION_CURSOR_SEND
addr VAR Byte ' address in EE and
Dsply
FOR addr = HOLE TO HOLE + 7 ' build 4 custom chars
READ addr,SNDCHAR ' get byte from EEPROM
GOSUB WRITE_TEXT ' put into LCD CG RAM
NEXT
LOW RS
GOSUB POSITION_CURSORB
SNDCHAR = %01001000'H
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01001111'O
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01010100'T
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01010011'S
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01001000'H
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01001111'O
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 50
'GOSUB POSITION_CURSORB
SNDCHAR = %01010100'T
GOSUB WRITE_TEXT
GOSUB SHIFT_LEFT
PAUSE 2000
SNDCHAR = %10001001'First O
GOSUB POSITION_CURSOR_SEND
SNDCHAR = %00000000'HOLE
GOSUB WRITE_TEXT
PAUSE 500
SNDCHAR = %10001101'Second O
GOSUB POSITION_CURSOR_SEND
SNDCHAR = %00000000'HOLE
GOSUB WRITE_TEXT
PAUSE 2000
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
GOSUB SHIFT_LEFT
PAUSE 50
RETURN
WRITE_PINS:
'DEBUG ? IN0
'DEBUG ? IN2
'DEBUG ? IN3
'DEBUG ? IN4
'PAUSE 500
'DEBUG "INS="
'DEBUG BIN ? INS, CR
'DEBUG "OUTS="
'DEBUG BIN ? OUTS, CR
'DEBUG "DIRS="
'DEBUG BIN ? DIRS, CR
'PAUSE 500
RETURN
[noparse][[/noparse]Non-text portions of this message have been removed]
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
Thanks for the reply. I learn a little more each day. If I might
ask an uneducated follow-up question. Is there such a thing as a
Programmable Integrated Circuit that does not need external memory
(EEPROM) and resonators... to operate?
Ultimately I'd like to be able to create a low cost reproducible
product. I was hoping that the unit cost per product wouldn't cost
as much as a single Basic Stamp.
I've looked at the Basic Stamp FAQ "How can I move to a PIC?". But
the information there seems to point to different software and
hardware resources to program the chip. None of it explains what is
necessary to make the chip do work in a project environment.
As a novice I'm having trouble sorting through all of the acronyms
and information to understand what is available and or necessary to
accomplish my task. A simple link or book reference would be a more
than sufficient response.
Thanks again!
Scott
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> About the only thing you can give up from the Stamp Stack is the
> programming connector and components (two caps) -- the rest are
critical
> to the operation of the Stamp. Remember that the Stamp is a
> microcontroller so yes, it needs a clock source (resonator). And
the
> program is stored in an external EEPROM, so you need that too.
You can
> get schematics of our OEM BASIC Stamps (the parts the Stamp Stack
is
> built from) from our web site.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: Scott Wilkinson [noparse][[/noparse]mailto:smwilkinson@e...]
> Sent: Saturday, October 04, 2003 12:22 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] BS2 Without Stamp Stack
>
>
> I would like to use my SX28AC/DP Basic Stamp chip without the Stamp
> Stack II provided by www.HVWTech.com <http://www.hvwtech.com/> .
I've
> built a small PCB which has only the SX28AC/DP chip attached to it
and
> I'm attaching it to the breadboard which is set up exactly as it
was
> when I was using the Stamp Stack II (All pins, buttons, the power
supply
> and the LCD. are in the same place). I've downloaded my program
onto
> the chip (using the Stamp Stack), carefully connected the IO pins
I'm
> using, provided 5V continuous power to Vdd and Ground to Vss. But
the
> program does not seem to be running. Obviously nothing is showing
on the
> LCD but the IO pins don't change as they should either. The LCD is
> powered up and working it is just that it is not receiving input
from my
> program. What am I missing? This is a pretty basic program that
drives
> an LCD. I've included the program below but the problem should
not be
> the program. The program runs fine when connected through the
Stamp
> Stack. Do I need to connect a resonator to OSC1 and OSC2? Is
there
> some sort of power up sequence I'm not following? Remember, I'm
new to
> electronics and BS programming so I may be missing something that
is
> plain
> as day to those of you who are more experienced.
>
>
>
> Thanks for your help!
>
>
>
> Scott
>
>
>
> '{$STAMP BS2sx}
>
> '{$PBASIC 2.5}
>
> Lock VAR Bit 'Used to only count button press once per press
>
> Lock = 0
>
> Trip VAR Nib 'Holds which round's score is to be Dsplyed
>
> Trip = 100
>
> TTShots VAR Word
>
> TTShots = 0
>
> TTHits VAR Word
>
> TTHits = 0
>
> TTPct VAR Word
>
> TTPct = 0
>
> 'RESET VAR Word 'Count how long reset button is held
>
> INPUT 0 'Dsply button
>
> HIGH 0
>
> INPUT 2 'Shot button
>
> HIGH 2
>
> INPUT 3 'Reset or Alt button
>
> HIGH 3
>
> INPUT 4 'Hit button
>
> HIGH 4
>
>
>
> RS PIN 5
>
> RW PIN 6
>
> E PIN 7
>
>
>
> Hole DATA @200, $0E,$1F,$1F,$1F,$1F,$1F,$0E,$00 '@100 stores
> starting at
> location 100
>
> CGRam CON $40 ' Custom character RAM
>
>
>
> SNDCHAR VAR Byte 'Char to write
>
> LoopCount VAR Byte 'Used exit wait if wait is stuck
>
> ii VAR Nib 'Used for char write loop
>
> HOLD1 VAR Word 'Holds the number of 50ms loops clear button
was
> held
> pressed
>
> Dsply VAR Bit 'Change what Dsply holds
>
> Dsply = 0 'Default to Shots Hits
>
>
>
> INIT:
>
> PAUSE 20
>
> DIRH = %11111111 ' setup pins for LCD
>
> OUTPUT 5'RS
>
> OUTPUT 6'RW
>
> OUTPUT 7'E
>
> LOW RS
>
> LOW RW
>
> OUTD = %0011
>
> PULSOUT E,1
>
> PAUSE 5
>
> OUTD = %0011
>
> PULSOUT E,1
>
> PAUSE 100
>
> OUTD = %0011
>
> PULSOUT E,1
>
> OUTH = %00001100'00001111
>
> PULSOUT E,1
>
> OUTH = %00000001
>
> PULSOUT E,1
>
> OUTH = %00000010
>
> PULSOUT E,1
>
> OUTH = %00000010
>
> PULSOUT E,1
>
> PAUSE 100
>
> GOSUB INTRO
>
> PAUSE 500
>
> 'DEBUG "INIT"
>
> 'Clear the LCD and Post Score for given round
>
> GOSUB CLEAR_LCD
>
> GOSUB CALC_PCT
>
>
>
> MAINLOOP:
>
> 'PAUSE 1000
>
> GOSUB Check_Shot
>
> GOSUB Check_Hit
>
> GOSUB Check_Reset
>
> GOSUB Check_Alt
>
> GOTO MAINLOOP
>
>
>
> Check_Shot:
>
> IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
>
> IF (IN2 = 0 AND Lock = 0) THEN
>
> Dsply = 0
>
> GOSUB Add_Shot
>
> ENDIF
>
> RETURN
>
>
>
> Check_Hit:
>
> IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
>
> IF (IN4 = 0 AND Lock = 0) THEN
>
> Dsply = 0
>
> GOSUB Add_Hit
>
> ENDIF
>
> RETURN
>
>
>
> Check_Reset:
>
> IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
>
> IF (IN3 = 0 AND Lock = 0) THEN
>
> Lock = 1
>
> GOSUB DO_RESET
>
> GOTO MAINLOOP 'Had to put in to prevent program auto
reboot???
>
> ENDIF
>
> RETURN
>
>
>
> Check_Alt:
>
> 'BUTTON 2,1,255,255,BtnWrk,1,Add_Shot
> 'pin,downstate,delay,rate,bytevariable,targetstate,address
>
> IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
>
> IF (IN0 = 0 AND Lock = 0) THEN
>
> Lock = 1
>
> IF Dsply = 1 THEN
>
> Dsply = 0'Show Shots Hits
>
> ELSE
>
> Dsply = 1'Show Pct
>
> ENDIF
>
> GOSUB Calc_Pct
>
> ENDIF
>
> GOTO MAINLOOP
>
>
>
> Add_Shot:
>
> 'WRITE 1, 0
>
> LOCK = 1
>
> READ Trip, TTShots
>
> TTShots = TTShots + 1
>
> WRITE Trip, TTShots
>
> 'I VAR Byte
>
> 'FOR I = 1 TO TTShots
>
> 'FREQOUT 1,1500,1500,2500
>
> 'NEXT
>
> GOSUB Calc_Pct
>
> GOTO MAINLOOP
>
>
>
> Add_Hit:
>
> Lock = 1
>
> READ Trip, TTShots
>
> READ (Trip + 1), TTHits 'Changed to 2 from 1 because storing
Word
> takes 2 bytes
>
> TTHits = TTHits + 1 MAX TTShots 'Can't have more hits than
shots
>
> WRITE (Trip + 1), TTHits
>
> 'FREQOUT 1,750,2500
>
> 'FREQOUT 1,750,2500
>
> GOSUB Calc_Pct
>
> 'Skip_Hit:
>
> GOTO MAINLOOP
>
>
>
> Calc_Pct:
>
> READ Trip, TTShots
>
> READ Trip+1,TTHits
>
> 'TTPct = ((TTHits * 100) / TTShots)
>
> TTPct = (TTHits * 1000) / TTShots
>
> 'WRITE (Trip + 4), TTPct 'Can always calculate percent no need to
> store
>
> GOSUB CLEAR_LCD
>
> IF Dsply < 1 THEN
>
> FOR ii=2 TO 0
>
> SNDCHAR=TTShots DIG ii + 48 ' get jth digit, add 48 for ascii
>
> GOSUB WRITE_TEXT ' put it on the lcd, not shown
>
> NEXT
>
> GOSUB POSITION_CURSOR
>
> FOR ii=2 TO 0
>
> SNDCHAR=TTHits DIG ii + 48 ' get jth digit, add 48 for ascii
>
> GOSUB WRITE_TEXT ' put it on the lcd, not shown
>
> NEXT
>
> ELSE 'Show Percent
>
> OUTH = %10000010
>
> GOSUB POSITION_CURSOR_SEND
>
> FOR ii=3 TO 0
>
> SNDCHAR=TTPct DIG ii + 48 ' get jth digit, add 48 for ascii
>
> GOSUB WRITE_TEXT ' put it on the lcd, not shown
>
> IF ii = 1 THEN
>
> SNDCHAR = %00101110'Period
>
> GOSUB WRITE_TEXT
>
> ENDIF
>
> NEXT
>
> SNDCHAR = %00100101'%
>
> GOSUB WRITE_TEXT
>
> ENDIF
>
> 'GOSUB Print
>
> RETURN
>
>
>
> DO_RESET:
>
> WRITE Trip, 0 'TTShots
>
> PAUSE 500
>
> WRITE (Trip + 1), 0 'TTHits
>
> PAUSE 500
>
> 'WRITE (Trip + 4), 0 'TTPct
>
> 'PAUSE 500
>
> GOSUB CALC_PCT
>
> RETURN
>
>
>
> DO_UNLOCK:
>
> LOCK = 0
>
> RETURN
>
>
>
> Print:
>
> 'DEBUG ? OUT15
>
> 'DEBUG ? OUT0
>
> 'DEBUG ? IN4,CR
>
> 'DEBUG ? IN3,CR
>
> 'DEBUG ? Lock, CR
>
> RETURN
>
>
>
> '
LCD
> CODE
>
> WAIT_LCD:
>
> LoopCount = LoopCount + 1
>
> LOW RS
>
> HIGH RW
>
> INPUT 15'IN DB7
>
> IF IN15 = 1 AND LoopCount < 50 THEN WAIT_LCD
>
> PULSOUT E,1
>
> LOW RW
>
> OUTPUT 15
>
> LoopCount = 0
>
> RETURN
>
>
>
> CLEAR_LCD:
>
> LOW RS
>
> LOW RW
>
> OUTH = %00000001
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> WRITE_TEXT:
>
> HIGH RS
>
> LOW RW
>
> OUTH = SNDCHAR
>
> PULSOUT E,1
>
> LOW RS
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> MOVE_RIGHT:
>
> LOW RS
>
> LOW RW
>
> OUTH = %00010000
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> SHIFT_LEFT:
>
> LOW RS
>
> LOW RW
>
> OUTH = %00011000
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> POSITION_CURSOR:
>
> LOW RS
>
> LOW RW
>
> OUTH = %10000101
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> POSITION_CURSORB:
>
> LOW RS
>
> LOW RW
>
> OUTH = %10001000
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> POSITION_CURSOR_SEND:
>
> LOW RS
>
> LOW RW
>
> OUTH = SNDCHAR
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> INTRO:
>
> HIGH RS ' prepare to
write
> CG
> data
>
> LOW RW
>
> SNDCHAR = CGRam ' point to CG RAM
>
> GOSUB POSITION_CURSOR_SEND
>
> addr VAR Byte ' address in EE
and
> Dsply
>
> FOR addr = HOLE TO HOLE + 7 ' build 4 custom chars
>
> READ addr,SNDCHAR ' get byte from EEPROM
>
> GOSUB WRITE_TEXT ' put into LCD CG RAM
>
> NEXT
>
> LOW RS
>
>
>
> GOSUB POSITION_CURSORB
>
> SNDCHAR = %01001000'H
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01001111'O
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01010100'T
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01010011'S
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01001000'H
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01001111'O
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01010100'T
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 2000
>
> SNDCHAR = %10001001'First O
>
> GOSUB POSITION_CURSOR_SEND
>
> SNDCHAR = %00000000'HOLE
>
> GOSUB WRITE_TEXT
>
> PAUSE 500
>
> SNDCHAR = %10001101'Second O
>
> GOSUB POSITION_CURSOR_SEND
>
> SNDCHAR = %00000000'HOLE
>
> GOSUB WRITE_TEXT
>
> PAUSE 2000
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
>
>
> RETURN
>
>
>
> WRITE_PINS:
>
> 'DEBUG ? IN0
>
> 'DEBUG ? IN2
>
> 'DEBUG ? IN3
>
> 'DEBUG ? IN4
>
> 'PAUSE 500
>
> 'DEBUG "INS="
>
> 'DEBUG BIN ? INS, CR
>
> 'DEBUG "OUTS="
>
> 'DEBUG BIN ? OUTS, CR
>
> 'DEBUG "DIRS="
>
> 'DEBUG BIN ? DIRS, CR
>
> 'PAUSE 500
>
> RETURN
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
is: a PIC or SX micro running a Parallax program that fetches and
executes PBASIC tokens (similar to Java bytecodes) from an external
EEPROM.
If you want to move to a single-chip solution there are many
opportunities. You can stick with Parallax and go the SX route; we have
tools and training materials. Of course, there's the PICmicro; it has a
broad line of parts and is very popular -- and some devices can use very
inexpensive tools. Atmel is also very popular, as is Motorola ... as
you can see, you have a lot of choices.
If you're an electronics/microcontroller novice you may want to spend a
bit more time with your Stamp Stack to build some confidence. Again,
you can download our SX documentation and software at no charge. And
you can also download two books by our friend -- and Stamp list
contributor -- Al Williams: "Introduction to Assembly Language
Programming with the SX Microcontroller" and "I/O Control With the SX
Microcontroller."
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: lcg30339 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=215iy7k4azqXdf-Liwiwsk06xx_XAKyz5mbsuK4Xb4lxUP3mboXBCoPWVMw6Lk6vBSeCjhWPQVgQk-S4S-asIQdanQ]smwilkinson@e...[/url
Sent: Sunday, October 05, 2003 11:24 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: BS2 Without Stamp Stack
Jon,
Thanks for the reply. I learn a little more each day. If I might
ask an uneducated follow-up question. Is there such a thing as a
Programmable Integrated Circuit that does not need external memory
(EEPROM) and resonators... to operate?
Ultimately I'd like to be able to create a low cost reproducible
product. I was hoping that the unit cost per product wouldn't cost
as much as a single Basic Stamp.
I've looked at the Basic Stamp FAQ "How can I move to a PIC?". But
the information there seems to point to different software and
hardware resources to program the chip. None of it explains what is
necessary to make the chip do work in a project environment.
As a novice I'm having trouble sorting through all of the acronyms
and information to understand what is available and or necessary to
accomplish my task. A simple link or book reference would be a more
than sufficient response.
Thanks again!
Scott
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> About the only thing you can give up from the Stamp Stack is the
> programming connector and components (two caps) -- the rest are
critical
> to the operation of the Stamp. Remember that the Stamp is a
> microcontroller so yes, it needs a clock source (resonator). And
the
> program is stored in an external EEPROM, so you need that too.
You can
> get schematics of our OEM BASIC Stamps (the parts the Stamp Stack
is
> built from) from our web site.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: Scott Wilkinson [noparse][[/noparse]mailto:smwilkinson@e...]
> Sent: Saturday, October 04, 2003 12:22 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] BS2 Without Stamp Stack
>
>
> I would like to use my SX28AC/DP Basic Stamp chip without the Stamp
> Stack II provided by www.HVWTech.com <http://www.hvwtech.com/> .
I've
> built a small PCB which has only the SX28AC/DP chip attached to it
and
> I'm attaching it to the breadboard which is set up exactly as it
was
> when I was using the Stamp Stack II (All pins, buttons, the power
supply
> and the LCD. are in the same place). I've downloaded my program
onto
> the chip (using the Stamp Stack), carefully connected the IO pins
I'm
> using, provided 5V continuous power to Vdd and Ground to Vss. But
the
> program does not seem to be running. Obviously nothing is showing
on the
> LCD but the IO pins don't change as they should either. The LCD is
> powered up and working it is just that it is not receiving input
from my
> program. What am I missing? This is a pretty basic program that
drives
> an LCD. I've included the program below but the problem should
not be
> the program. The program runs fine when connected through the
Stamp
> Stack. Do I need to connect a resonator to OSC1 and OSC2? Is
there
> some sort of power up sequence I'm not following? Remember, I'm
new to
> electronics and BS programming so I may be missing something that
is
> plain
> as day to those of you who are more experienced.
>
>
>
> Thanks for your help!
>
>
>
> Scott
>
>
>
> '{$STAMP BS2sx}
>
> '{$PBASIC 2.5}
>
> Lock VAR Bit 'Used to only count button press once per press
>
> Lock = 0
>
> Trip VAR Nib 'Holds which round's score is to be Dsplyed
>
> Trip = 100
>
> TTShots VAR Word
>
> TTShots = 0
>
> TTHits VAR Word
>
> TTHits = 0
>
> TTPct VAR Word
>
> TTPct = 0
>
> 'RESET VAR Word 'Count how long reset button is held
>
> INPUT 0 'Dsply button
>
> HIGH 0
>
> INPUT 2 'Shot button
>
> HIGH 2
>
> INPUT 3 'Reset or Alt button
>
> HIGH 3
>
> INPUT 4 'Hit button
>
> HIGH 4
>
>
>
> RS PIN 5
>
> RW PIN 6
>
> E PIN 7
>
>
>
> Hole DATA @200, $0E,$1F,$1F,$1F,$1F,$1F,$0E,$00 '@100 stores
> starting at
> location 100
>
> CGRam CON $40 ' Custom character RAM
>
>
>
> SNDCHAR VAR Byte 'Char to write
>
> LoopCount VAR Byte 'Used exit wait if wait is stuck
>
> ii VAR Nib 'Used for char write loop
>
> HOLD1 VAR Word 'Holds the number of 50ms loops clear button
was
> held
> pressed
>
> Dsply VAR Bit 'Change what Dsply holds
>
> Dsply = 0 'Default to Shots Hits
>
>
>
> INIT:
>
> PAUSE 20
>
> DIRH = %11111111 ' setup pins for LCD
>
> OUTPUT 5'RS
>
> OUTPUT 6'RW
>
> OUTPUT 7'E
>
> LOW RS
>
> LOW RW
>
> OUTD = %0011
>
> PULSOUT E,1
>
> PAUSE 5
>
> OUTD = %0011
>
> PULSOUT E,1
>
> PAUSE 100
>
> OUTD = %0011
>
> PULSOUT E,1
>
> OUTH = %00001100'00001111
>
> PULSOUT E,1
>
> OUTH = %00000001
>
> PULSOUT E,1
>
> OUTH = %00000010
>
> PULSOUT E,1
>
> OUTH = %00000010
>
> PULSOUT E,1
>
> PAUSE 100
>
> GOSUB INTRO
>
> PAUSE 500
>
> 'DEBUG "INIT"
>
> 'Clear the LCD and Post Score for given round
>
> GOSUB CLEAR_LCD
>
> GOSUB CALC_PCT
>
>
>
> MAINLOOP:
>
> 'PAUSE 1000
>
> GOSUB Check_Shot
>
> GOSUB Check_Hit
>
> GOSUB Check_Reset
>
> GOSUB Check_Alt
>
> GOTO MAINLOOP
>
>
>
> Check_Shot:
>
> IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
>
> IF (IN2 = 0 AND Lock = 0) THEN
>
> Dsply = 0
>
> GOSUB Add_Shot
>
> ENDIF
>
> RETURN
>
>
>
> Check_Hit:
>
> IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
>
> IF (IN4 = 0 AND Lock = 0) THEN
>
> Dsply = 0
>
> GOSUB Add_Hit
>
> ENDIF
>
> RETURN
>
>
>
> Check_Reset:
>
> IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
>
> IF (IN3 = 0 AND Lock = 0) THEN
>
> Lock = 1
>
> GOSUB DO_RESET
>
> GOTO MAINLOOP 'Had to put in to prevent program auto
reboot???
>
> ENDIF
>
> RETURN
>
>
>
> Check_Alt:
>
> 'BUTTON 2,1,255,255,BtnWrk,1,Add_Shot
> 'pin,downstate,delay,rate,bytevariable,targetstate,address
>
> IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
>
> IF (IN0 = 0 AND Lock = 0) THEN
>
> Lock = 1
>
> IF Dsply = 1 THEN
>
> Dsply = 0'Show Shots Hits
>
> ELSE
>
> Dsply = 1'Show Pct
>
> ENDIF
>
> GOSUB Calc_Pct
>
> ENDIF
>
> GOTO MAINLOOP
>
>
>
> Add_Shot:
>
> 'WRITE 1, 0
>
> LOCK = 1
>
> READ Trip, TTShots
>
> TTShots = TTShots + 1
>
> WRITE Trip, TTShots
>
> 'I VAR Byte
>
> 'FOR I = 1 TO TTShots
>
> 'FREQOUT 1,1500,1500,2500
>
> 'NEXT
>
> GOSUB Calc_Pct
>
> GOTO MAINLOOP
>
>
>
> Add_Hit:
>
> Lock = 1
>
> READ Trip, TTShots
>
> READ (Trip + 1), TTHits 'Changed to 2 from 1 because storing
Word
> takes 2 bytes
>
> TTHits = TTHits + 1 MAX TTShots 'Can't have more hits than
shots
>
> WRITE (Trip + 1), TTHits
>
> 'FREQOUT 1,750,2500
>
> 'FREQOUT 1,750,2500
>
> GOSUB Calc_Pct
>
> 'Skip_Hit:
>
> GOTO MAINLOOP
>
>
>
> Calc_Pct:
>
> READ Trip, TTShots
>
> READ Trip+1,TTHits
>
> 'TTPct = ((TTHits * 100) / TTShots)
>
> TTPct = (TTHits * 1000) / TTShots
>
> 'WRITE (Trip + 4), TTPct 'Can always calculate percent no need to
> store
>
> GOSUB CLEAR_LCD
>
> IF Dsply < 1 THEN
>
> FOR ii=2 TO 0
>
> SNDCHAR=TTShots DIG ii + 48 ' get jth digit, add 48 for ascii
>
> GOSUB WRITE_TEXT ' put it on the lcd, not shown
>
> NEXT
>
> GOSUB POSITION_CURSOR
>
> FOR ii=2 TO 0
>
> SNDCHAR=TTHits DIG ii + 48 ' get jth digit, add 48 for ascii
>
> GOSUB WRITE_TEXT ' put it on the lcd, not shown
>
> NEXT
>
> ELSE 'Show Percent
>
> OUTH = %10000010
>
> GOSUB POSITION_CURSOR_SEND
>
> FOR ii=3 TO 0
>
> SNDCHAR=TTPct DIG ii + 48 ' get jth digit, add 48 for ascii
>
> GOSUB WRITE_TEXT ' put it on the lcd, not shown
>
> IF ii = 1 THEN
>
> SNDCHAR = %00101110'Period
>
> GOSUB WRITE_TEXT
>
> ENDIF
>
> NEXT
>
> SNDCHAR = %00100101'%
>
> GOSUB WRITE_TEXT
>
> ENDIF
>
> 'GOSUB Print
>
> RETURN
>
>
>
> DO_RESET:
>
> WRITE Trip, 0 'TTShots
>
> PAUSE 500
>
> WRITE (Trip + 1), 0 'TTHits
>
> PAUSE 500
>
> 'WRITE (Trip + 4), 0 'TTPct
>
> 'PAUSE 500
>
> GOSUB CALC_PCT
>
> RETURN
>
>
>
> DO_UNLOCK:
>
> LOCK = 0
>
> RETURN
>
>
>
> Print:
>
> 'DEBUG ? OUT15
>
> 'DEBUG ? OUT0
>
> 'DEBUG ? IN4,CR
>
> 'DEBUG ? IN3,CR
>
> 'DEBUG ? Lock, CR
>
> RETURN
>
>
>
> '
LCD
> CODE
>
> WAIT_LCD:
>
> LoopCount = LoopCount + 1
>
> LOW RS
>
> HIGH RW
>
> INPUT 15'IN DB7
>
> IF IN15 = 1 AND LoopCount < 50 THEN WAIT_LCD
>
> PULSOUT E,1
>
> LOW RW
>
> OUTPUT 15
>
> LoopCount = 0
>
> RETURN
>
>
>
> CLEAR_LCD:
>
> LOW RS
>
> LOW RW
>
> OUTH = %00000001
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> WRITE_TEXT:
>
> HIGH RS
>
> LOW RW
>
> OUTH = SNDCHAR
>
> PULSOUT E,1
>
> LOW RS
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> MOVE_RIGHT:
>
> LOW RS
>
> LOW RW
>
> OUTH = %00010000
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> SHIFT_LEFT:
>
> LOW RS
>
> LOW RW
>
> OUTH = %00011000
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> POSITION_CURSOR:
>
> LOW RS
>
> LOW RW
>
> OUTH = %10000101
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> POSITION_CURSORB:
>
> LOW RS
>
> LOW RW
>
> OUTH = %10001000
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> POSITION_CURSOR_SEND:
>
> LOW RS
>
> LOW RW
>
> OUTH = SNDCHAR
>
> PULSOUT E,1
>
> GOSUB WAIT_LCD
>
> RETURN
>
>
>
> INTRO:
>
> HIGH RS ' prepare to
write
> CG
> data
>
> LOW RW
>
> SNDCHAR = CGRam ' point to CG RAM
>
> GOSUB POSITION_CURSOR_SEND
>
> addr VAR Byte ' address in EE
and
> Dsply
>
> FOR addr = HOLE TO HOLE + 7 ' build 4 custom chars
>
> READ addr,SNDCHAR ' get byte from EEPROM
>
> GOSUB WRITE_TEXT ' put into LCD CG RAM
>
> NEXT
>
> LOW RS
>
>
>
> GOSUB POSITION_CURSORB
>
> SNDCHAR = %01001000'H
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01001111'O
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01010100'T
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01010011'S
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01001000'H
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01001111'O
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> 'GOSUB POSITION_CURSORB
>
> SNDCHAR = %01010100'T
>
> GOSUB WRITE_TEXT
>
> GOSUB SHIFT_LEFT
>
> PAUSE 2000
>
> SNDCHAR = %10001001'First O
>
> GOSUB POSITION_CURSOR_SEND
>
> SNDCHAR = %00000000'HOLE
>
> GOSUB WRITE_TEXT
>
> PAUSE 500
>
> SNDCHAR = %10001101'Second O
>
> GOSUB POSITION_CURSOR_SEND
>
> SNDCHAR = %00000000'HOLE
>
> GOSUB WRITE_TEXT
>
> PAUSE 2000
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
> GOSUB SHIFT_LEFT
>
> PAUSE 50
>
>
>
> RETURN
>
>
>
> WRITE_PINS:
>
> 'DEBUG ? IN0
>
> 'DEBUG ? IN2
>
> 'DEBUG ? IN3
>
> 'DEBUG ? IN4
>
> 'PAUSE 500
>
> 'DEBUG "INS="
>
> 'DEBUG BIN ? INS, CR
>
> 'DEBUG "OUTS="
>
> 'DEBUG BIN ? OUTS, CR
>
> 'DEBUG "DIRS="
>
> 'DEBUG BIN ? DIRS, CR
>
> 'PAUSE 500
>
> RETURN
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
You've been most helpful. I had looked at Parallax's SX programming
kit but there was some confusion on my part because the chip that is
in my Stamp Stack is an "SX"28AC/DP. I couldn't be positive that
there was a difference or that it would sove my issues. I
appreciate you clearing that up. I'll be sure to check out each of
the resources you mentioned.
Have a great day!
Scott
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> Yes, there is such a thing -- in fact, that's what the Stamp
interpreter
> is: a PIC or SX micro running a Parallax program that fetches and
> executes PBASIC tokens (similar to Java bytecodes) from an external
> EEPROM.
>
> If you want to move to a single-chip solution there are many
> opportunities. You can stick with Parallax and go the SX route;
we have
> tools and training materials. Of course, there's the PICmicro; it
has a
> broad line of parts and is very popular -- and some devices can
use very
> inexpensive tools. Atmel is also very popular, as is Motorola ...
as
> you can see, you have a lot of choices.
>
> If you're an electronics/microcontroller novice you may want to
spend a
> bit more time with your Stamp Stack to build some confidence.
Again,
> you can download our SX documentation and software at no charge.
And
> you can also download two books by our friend -- and Stamp list
> contributor -- Al Williams: "Introduction to Assembly Language
> Programming with the SX Microcontroller" and "I/O Control With the
SX
> Microcontroller."
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: lcg30339 [noparse][[/noparse]mailto:smwilkinson@e...]
> Sent: Sunday, October 05, 2003 11:24 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: BS2 Without Stamp Stack
>
>
> Jon,
>
> Thanks for the reply. I learn a little more each day. If I might
> ask an uneducated follow-up question. Is there such a thing as a
> Programmable Integrated Circuit that does not need external memory
> (EEPROM) and resonators... to operate?
>
> Ultimately I'd like to be able to create a low cost reproducible
> product. I was hoping that the unit cost per product wouldn't
cost
> as much as a single Basic Stamp.
>
> I've looked at the Basic Stamp FAQ "How can I move to a PIC?". But
> the information there seems to point to different software and
> hardware resources to program the chip. None of it explains what
is
> necessary to make the chip do work in a project environment.
>
> As a novice I'm having trouble sorting through all of the acronyms
> and information to understand what is available and or necessary
to
> accomplish my task. A simple link or book reference would be a
more
> than sufficient response.
>
> Thanks again!
>
> Scott
>
>
> --- In basicstamps@yahoogroups.com, "Jon Williams"
<jwilliams@p...>
> wrote:
> > About the only thing you can give up from the Stamp Stack is the
> > programming connector and components (two caps) -- the rest are
> critical
> > to the operation of the Stamp. Remember that the Stamp is a
> > microcontroller so yes, it needs a clock source (resonator). And
> the
> > program is stored in an external EEPROM, so you need that too.
> You can
> > get schematics of our OEM BASIC Stamps (the parts the Stamp Stack
> is
> > built from) from our web site.
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
Original Message
> > From: Scott Wilkinson [noparse][[/noparse]mailto:smwilkinson@e...]
> > Sent: Saturday, October 04, 2003 12:22 PM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] BS2 Without Stamp Stack
> >
> >
> > I would like to use my SX28AC/DP Basic Stamp chip without the
Stamp
> > Stack II provided by www.HVWTech.com <http://www.hvwtech.com/> .
> I've
> > built a small PCB which has only the SX28AC/DP chip attached to
it
> and
> > I'm attaching it to the breadboard which is set up exactly as it
> was
> > when I was using the Stamp Stack II (All pins, buttons, the power
> supply
> > and the LCD. are in the same place). I've downloaded my program
> onto
> > the chip (using the Stamp Stack), carefully connected the IO pins
> I'm
> > using, provided 5V continuous power to Vdd and Ground to Vss.
But
> the
> > program does not seem to be running. Obviously nothing is showing
> on the
> > LCD but the IO pins don't change as they should either. The LCD
is
> > powered up and working it is just that it is not receiving input
> from my
> > program. What am I missing? This is a pretty basic program that
> drives
> > an LCD. I've included the program below but the problem should
> not be
> > the program. The program runs fine when connected through the
> Stamp
> > Stack. Do I need to connect a resonator to OSC1 and OSC2? Is
> there
> > some sort of power up sequence I'm not following? Remember, I'm
> new to
> > electronics and BS programming so I may be missing something that
> is
> > plain
> > as day to those of you who are more experienced.
> >
> >
> >
> > Thanks for your help!
> >
> >
> >
> > Scott
> >
> >
> >
> > '{$STAMP BS2sx}
> >
> > '{$PBASIC 2.5}
> >
> > Lock VAR Bit 'Used to only count button press once per
press
> >
> > Lock = 0
> >
> > Trip VAR Nib 'Holds which round's score is to be Dsplyed
> >
> > Trip = 100
> >
> > TTShots VAR Word
> >
> > TTShots = 0
> >
> > TTHits VAR Word
> >
> > TTHits = 0
> >
> > TTPct VAR Word
> >
> > TTPct = 0
> >
> > 'RESET VAR Word 'Count how long reset button is held
> >
> > INPUT 0 'Dsply button
> >
> > HIGH 0
> >
> > INPUT 2 'Shot button
> >
> > HIGH 2
> >
> > INPUT 3 'Reset or Alt button
> >
> > HIGH 3
> >
> > INPUT 4 'Hit button
> >
> > HIGH 4
> >
> >
> >
> > RS PIN 5
> >
> > RW PIN 6
> >
> > E PIN 7
> >
> >
> >
> > Hole DATA @200, $0E,$1F,$1F,$1F,$1F,$1F,$0E,$00 '@100 stores
> > starting at
> > location 100
> >
> > CGRam CON $40 ' Custom character RAM
> >
> >
> >
> > SNDCHAR VAR Byte 'Char to write
> >
> > LoopCount VAR Byte 'Used exit wait if wait is stuck
> >
> > ii VAR Nib 'Used for char write loop
> >
> > HOLD1 VAR Word 'Holds the number of 50ms loops clear
button
> was
> > held
> > pressed
> >
> > Dsply VAR Bit 'Change what Dsply holds
> >
> > Dsply = 0 'Default to Shots Hits
> >
> >
> >
> > INIT:
> >
> > PAUSE 20
> >
> > DIRH = %11111111 ' setup pins for LCD
> >
> > OUTPUT 5'RS
> >
> > OUTPUT 6'RW
> >
> > OUTPUT 7'E
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTD = %0011
> >
> > PULSOUT E,1
> >
> > PAUSE 5
> >
> > OUTD = %0011
> >
> > PULSOUT E,1
> >
> > PAUSE 100
> >
> > OUTD = %0011
> >
> > PULSOUT E,1
> >
> > OUTH = %00001100'00001111
> >
> > PULSOUT E,1
> >
> > OUTH = %00000001
> >
> > PULSOUT E,1
> >
> > OUTH = %00000010
> >
> > PULSOUT E,1
> >
> > OUTH = %00000010
> >
> > PULSOUT E,1
> >
> > PAUSE 100
> >
> > GOSUB INTRO
> >
> > PAUSE 500
> >
> > 'DEBUG "INIT"
> >
> > 'Clear the LCD and Post Score for given round
> >
> > GOSUB CLEAR_LCD
> >
> > GOSUB CALC_PCT
> >
> >
> >
> > MAINLOOP:
> >
> > 'PAUSE 1000
> >
> > GOSUB Check_Shot
> >
> > GOSUB Check_Hit
> >
> > GOSUB Check_Reset
> >
> > GOSUB Check_Alt
> >
> > GOTO MAINLOOP
> >
> >
> >
> > Check_Shot:
> >
> > IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN
DO_UNLOCK
> >
> > IF (IN2 = 0 AND Lock = 0) THEN
> >
> > Dsply = 0
> >
> > GOSUB Add_Shot
> >
> > ENDIF
> >
> > RETURN
> >
> >
> >
> > Check_Hit:
> >
> > IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN
DO_UNLOCK
> >
> > IF (IN4 = 0 AND Lock = 0) THEN
> >
> > Dsply = 0
> >
> > GOSUB Add_Hit
> >
> > ENDIF
> >
> > RETURN
> >
> >
> >
> > Check_Reset:
> >
> > IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN
DO_UNLOCK
> >
> > IF (IN3 = 0 AND Lock = 0) THEN
> >
> > Lock = 1
> >
> > GOSUB DO_RESET
> >
> > GOTO MAINLOOP 'Had to put in to prevent program auto
> reboot???
> >
> > ENDIF
> >
> > RETURN
> >
> >
> >
> > Check_Alt:
> >
> > 'BUTTON 2,1,255,255,BtnWrk,1,Add_Shot
> > 'pin,downstate,delay,rate,bytevariable,targetstate,address
> >
> > IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN
DO_UNLOCK
> >
> > IF (IN0 = 0 AND Lock = 0) THEN
> >
> > Lock = 1
> >
> > IF Dsply = 1 THEN
> >
> > Dsply = 0'Show Shots Hits
> >
> > ELSE
> >
> > Dsply = 1'Show Pct
> >
> > ENDIF
> >
> > GOSUB Calc_Pct
> >
> > ENDIF
> >
> > GOTO MAINLOOP
> >
> >
> >
> > Add_Shot:
> >
> > 'WRITE 1, 0
> >
> > LOCK = 1
> >
> > READ Trip, TTShots
> >
> > TTShots = TTShots + 1
> >
> > WRITE Trip, TTShots
> >
> > 'I VAR Byte
> >
> > 'FOR I = 1 TO TTShots
> >
> > 'FREQOUT 1,1500,1500,2500
> >
> > 'NEXT
> >
> > GOSUB Calc_Pct
> >
> > GOTO MAINLOOP
> >
> >
> >
> > Add_Hit:
> >
> > Lock = 1
> >
> > READ Trip, TTShots
> >
> > READ (Trip + 1), TTHits 'Changed to 2 from 1 because storing
> Word
> > takes 2 bytes
> >
> > TTHits = TTHits + 1 MAX TTShots 'Can't have more hits than
> shots
> >
> > WRITE (Trip + 1), TTHits
> >
> > 'FREQOUT 1,750,2500
> >
> > 'FREQOUT 1,750,2500
> >
> > GOSUB Calc_Pct
> >
> > 'Skip_Hit:
> >
> > GOTO MAINLOOP
> >
> >
> >
> > Calc_Pct:
> >
> > READ Trip, TTShots
> >
> > READ Trip+1,TTHits
> >
> > 'TTPct = ((TTHits * 100) / TTShots)
> >
> > TTPct = (TTHits * 1000) / TTShots
> >
> > 'WRITE (Trip + 4), TTPct 'Can always calculate percent no need
to
> > store
> >
> > GOSUB CLEAR_LCD
> >
> > IF Dsply < 1 THEN
> >
> > FOR ii=2 TO 0
> >
> > SNDCHAR=TTShots DIG ii + 48 ' get jth digit, add 48 for
ascii
> >
> > GOSUB WRITE_TEXT ' put it on the lcd, not shown
> >
> > NEXT
> >
> > GOSUB POSITION_CURSOR
> >
> > FOR ii=2 TO 0
> >
> > SNDCHAR=TTHits DIG ii + 48 ' get jth digit, add 48 for
ascii
> >
> > GOSUB WRITE_TEXT ' put it on the lcd, not shown
> >
> > NEXT
> >
> > ELSE 'Show Percent
> >
> > OUTH = %10000010
> >
> > GOSUB POSITION_CURSOR_SEND
> >
> > FOR ii=3 TO 0
> >
> > SNDCHAR=TTPct DIG ii + 48 ' get jth digit, add 48 for ascii
> >
> > GOSUB WRITE_TEXT ' put it on the lcd, not shown
> >
> > IF ii = 1 THEN
> >
> > SNDCHAR = %00101110'Period
> >
> > GOSUB WRITE_TEXT
> >
> > ENDIF
> >
> > NEXT
> >
> > SNDCHAR = %00100101'%
> >
> > GOSUB WRITE_TEXT
> >
> > ENDIF
> >
> > 'GOSUB Print
> >
> > RETURN
> >
> >
> >
> > DO_RESET:
> >
> > WRITE Trip, 0 'TTShots
> >
> > PAUSE 500
> >
> > WRITE (Trip + 1), 0 'TTHits
> >
> > PAUSE 500
> >
> > 'WRITE (Trip + 4), 0 'TTPct
> >
> > 'PAUSE 500
> >
> > GOSUB CALC_PCT
> >
> > RETURN
> >
> >
> >
> > DO_UNLOCK:
> >
> > LOCK = 0
> >
> > RETURN
> >
> >
> >
> > Print:
> >
> > 'DEBUG ? OUT15
> >
> > 'DEBUG ? OUT0
> >
> > 'DEBUG ? IN4,CR
> >
> > 'DEBUG ? IN3,CR
> >
> > 'DEBUG ? Lock, CR
> >
> > RETURN
> >
> >
> >
> > '
LCD
> > CODE
> >
> > WAIT_LCD:
> >
> > LoopCount = LoopCount + 1
> >
> > LOW RS
> >
> > HIGH RW
> >
> > INPUT 15'IN DB7
> >
> > IF IN15 = 1 AND LoopCount < 50 THEN WAIT_LCD
> >
> > PULSOUT E,1
> >
> > LOW RW
> >
> > OUTPUT 15
> >
> > LoopCount = 0
> >
> > RETURN
> >
> >
> >
> > CLEAR_LCD:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %00000001
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > WRITE_TEXT:
> >
> > HIGH RS
> >
> > LOW RW
> >
> > OUTH = SNDCHAR
> >
> > PULSOUT E,1
> >
> > LOW RS
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > MOVE_RIGHT:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %00010000
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > SHIFT_LEFT:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %00011000
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > POSITION_CURSOR:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %10000101
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > POSITION_CURSORB:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %10001000
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > POSITION_CURSOR_SEND:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = SNDCHAR
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > INTRO:
> >
> > HIGH RS ' prepare
to
> write
> > CG
> > data
> >
> > LOW RW
> >
> > SNDCHAR = CGRam ' point to CG RAM
> >
> > GOSUB POSITION_CURSOR_SEND
> >
> > addr VAR Byte ' address in
EE
> and
> > Dsply
> >
> > FOR addr = HOLE TO HOLE + 7 ' build 4 custom chars
> >
> > READ addr,SNDCHAR ' get byte from
EEPROM
> >
> > GOSUB WRITE_TEXT ' put into LCD CG
RAM
> >
> > NEXT
> >
> > LOW RS
> >
> >
> >
> > GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01001000'H
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01001111'O
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01010100'T
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01010011'S
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01001000'H
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01001111'O
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01010100'T
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 2000
> >
> > SNDCHAR = %10001001'First O
> >
> > GOSUB POSITION_CURSOR_SEND
> >
> > SNDCHAR = %00000000'HOLE
> >
> > GOSUB WRITE_TEXT
> >
> > PAUSE 500
> >
> > SNDCHAR = %10001101'Second O
> >
> > GOSUB POSITION_CURSOR_SEND
> >
> > SNDCHAR = %00000000'HOLE
> >
> > GOSUB WRITE_TEXT
> >
> > PAUSE 2000
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> >
> >
> > RETURN
> >
> >
> >
> > WRITE_PINS:
> >
> > 'DEBUG ? IN0
> >
> > 'DEBUG ? IN2
> >
> > 'DEBUG ? IN3
> >
> > 'DEBUG ? IN4
> >
> > 'PAUSE 500
> >
> > 'DEBUG "INS="
> >
> > 'DEBUG BIN ? INS, CR
> >
> > 'DEBUG "OUTS="
> >
> > 'DEBUG BIN ? OUTS, CR
> >
> > 'DEBUG "DIRS="
> >
> > 'DEBUG BIN ? DIRS, CR
> >
> > 'PAUSE 500
> >
> > RETURN
> >
> >
> >
> > [noparse][[/noparse]Non-text portions of this message have been removed]
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM
to
> > abuse@p...
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
'flash' memory on-chip, and 368 bytes of RAM, and
256 bytes of EEPROM. So with a 16F876, a resonator,
and a few parts (regulator, pull-up resistor) you
can build what you describe.
Some PIC parts actually have 'internal' resonators,
I'm unsure about the 16F876. Typically, the internal
clocks are only accurate to 1% or so (86,400 secs/day
means they can gain or lose 864 seconds a day) so
I tend not to use them -- but a resonator costs
$0.50 to $1.00 from Digikey, so this is no big deal.
Try http://www.phanderson.com/ Peter Anderson's site
for more info.
--- In basicstamps@yahoogroups.com, "lcg30339" <smwilkinson@e...>
wrote:
> Jon,
>
> Thanks for the reply. I learn a little more each day. If I might
> ask an uneducated follow-up question. Is there such a thing as a
> Programmable Integrated Circuit that does not need external memory
> (EEPROM) and resonators... to operate?
>
> Ultimately I'd like to be able to create a low cost reproducible
> product. I was hoping that the unit cost per product wouldn't cost
> as much as a single Basic Stamp.
>
> I've looked at the Basic Stamp FAQ "How can I move to a PIC?". But
> the information there seems to point to different software and
> hardware resources to program the chip. None of it explains what is
> necessary to make the chip do work in a project environment.
>
> As a novice I'm having trouble sorting through all of the acronyms
> and information to understand what is available and or necessary to
> accomplish my task. A simple link or book reference would be a more
> than sufficient response.
>
> Thanks again!
>
> Scott
>
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > About the only thing you can give up from the Stamp Stack is the
> > programming connector and components (two caps) -- the rest are
> critical
> > to the operation of the Stamp. Remember that the Stamp is a
> > microcontroller so yes, it needs a clock source (resonator). And
> the
> > program is stored in an external EEPROM, so you need that too.
> You can
> > get schematics of our OEM BASIC Stamps (the parts the Stamp Stack
> is
> > built from) from our web site.
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
Original Message
> > From: Scott Wilkinson [noparse][[/noparse]mailto:smwilkinson@e...]
> > Sent: Saturday, October 04, 2003 12:22 PM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] BS2 Without Stamp Stack
> >
> >
> > I would like to use my SX28AC/DP Basic Stamp chip without the
Stamp
> > Stack II provided by www.HVWTech.com <http://www.hvwtech.com/> .
> I've
> > built a small PCB which has only the SX28AC/DP chip attached to
it
> and
> > I'm attaching it to the breadboard which is set up exactly as it
> was
> > when I was using the Stamp Stack II (All pins, buttons, the power
> supply
> > and the LCD. are in the same place). I've downloaded my program
> onto
> > the chip (using the Stamp Stack), carefully connected the IO pins
> I'm
> > using, provided 5V continuous power to Vdd and Ground to Vss.
But
> the
> > program does not seem to be running. Obviously nothing is showing
> on the
> > LCD but the IO pins don't change as they should either. The LCD
is
> > powered up and working it is just that it is not receiving input
> from my
> > program. What am I missing? This is a pretty basic program that
> drives
> > an LCD. I've included the program below but the problem should
> not be
> > the program. The program runs fine when connected through the
> Stamp
> > Stack. Do I need to connect a resonator to OSC1 and OSC2? Is
> there
> > some sort of power up sequence I'm not following? Remember, I'm
> new to
> > electronics and BS programming so I may be missing something that
> is
> > plain
> > as day to those of you who are more experienced.
> >
> >
> >
> > Thanks for your help!
> >
> >
> >
> > Scott
> >
> >
> >
> > '{$STAMP BS2sx}
> >
> > '{$PBASIC 2.5}
> >
> > Lock VAR Bit 'Used to only count button press once per press
> >
> > Lock = 0
> >
> > Trip VAR Nib 'Holds which round's score is to be Dsplyed
> >
> > Trip = 100
> >
> > TTShots VAR Word
> >
> > TTShots = 0
> >
> > TTHits VAR Word
> >
> > TTHits = 0
> >
> > TTPct VAR Word
> >
> > TTPct = 0
> >
> > 'RESET VAR Word 'Count how long reset button is held
> >
> > INPUT 0 'Dsply button
> >
> > HIGH 0
> >
> > INPUT 2 'Shot button
> >
> > HIGH 2
> >
> > INPUT 3 'Reset or Alt button
> >
> > HIGH 3
> >
> > INPUT 4 'Hit button
> >
> > HIGH 4
> >
> >
> >
> > RS PIN 5
> >
> > RW PIN 6
> >
> > E PIN 7
> >
> >
> >
> > Hole DATA @200, $0E,$1F,$1F,$1F,$1F,$1F,$0E,$00 '@100 stores
> > starting at
> > location 100
> >
> > CGRam CON $40 ' Custom character RAM
> >
> >
> >
> > SNDCHAR VAR Byte 'Char to write
> >
> > LoopCount VAR Byte 'Used exit wait if wait is stuck
> >
> > ii VAR Nib 'Used for char write loop
> >
> > HOLD1 VAR Word 'Holds the number of 50ms loops clear
button
> was
> > held
> > pressed
> >
> > Dsply VAR Bit 'Change what Dsply holds
> >
> > Dsply = 0 'Default to Shots Hits
> >
> >
> >
> > INIT:
> >
> > PAUSE 20
> >
> > DIRH = %11111111 ' setup pins for LCD
> >
> > OUTPUT 5'RS
> >
> > OUTPUT 6'RW
> >
> > OUTPUT 7'E
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTD = %0011
> >
> > PULSOUT E,1
> >
> > PAUSE 5
> >
> > OUTD = %0011
> >
> > PULSOUT E,1
> >
> > PAUSE 100
> >
> > OUTD = %0011
> >
> > PULSOUT E,1
> >
> > OUTH = %00001100'00001111
> >
> > PULSOUT E,1
> >
> > OUTH = %00000001
> >
> > PULSOUT E,1
> >
> > OUTH = %00000010
> >
> > PULSOUT E,1
> >
> > OUTH = %00000010
> >
> > PULSOUT E,1
> >
> > PAUSE 100
> >
> > GOSUB INTRO
> >
> > PAUSE 500
> >
> > 'DEBUG "INIT"
> >
> > 'Clear the LCD and Post Score for given round
> >
> > GOSUB CLEAR_LCD
> >
> > GOSUB CALC_PCT
> >
> >
> >
> > MAINLOOP:
> >
> > 'PAUSE 1000
> >
> > GOSUB Check_Shot
> >
> > GOSUB Check_Hit
> >
> > GOSUB Check_Reset
> >
> > GOSUB Check_Alt
> >
> > GOTO MAINLOOP
> >
> >
> >
> > Check_Shot:
> >
> > IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
> >
> > IF (IN2 = 0 AND Lock = 0) THEN
> >
> > Dsply = 0
> >
> > GOSUB Add_Shot
> >
> > ENDIF
> >
> > RETURN
> >
> >
> >
> > Check_Hit:
> >
> > IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
> >
> > IF (IN4 = 0 AND Lock = 0) THEN
> >
> > Dsply = 0
> >
> > GOSUB Add_Hit
> >
> > ENDIF
> >
> > RETURN
> >
> >
> >
> > Check_Reset:
> >
> > IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
> >
> > IF (IN3 = 0 AND Lock = 0) THEN
> >
> > Lock = 1
> >
> > GOSUB DO_RESET
> >
> > GOTO MAINLOOP 'Had to put in to prevent program auto
> reboot???
> >
> > ENDIF
> >
> > RETURN
> >
> >
> >
> > Check_Alt:
> >
> > 'BUTTON 2,1,255,255,BtnWrk,1,Add_Shot
> > 'pin,downstate,delay,rate,bytevariable,targetstate,address
> >
> > IF(IN0 > 0 AND IN2 > 0 AND IN3 > 0 AND IN4 > 0) THEN DO_UNLOCK
> >
> > IF (IN0 = 0 AND Lock = 0) THEN
> >
> > Lock = 1
> >
> > IF Dsply = 1 THEN
> >
> > Dsply = 0'Show Shots Hits
> >
> > ELSE
> >
> > Dsply = 1'Show Pct
> >
> > ENDIF
> >
> > GOSUB Calc_Pct
> >
> > ENDIF
> >
> > GOTO MAINLOOP
> >
> >
> >
> > Add_Shot:
> >
> > 'WRITE 1, 0
> >
> > LOCK = 1
> >
> > READ Trip, TTShots
> >
> > TTShots = TTShots + 1
> >
> > WRITE Trip, TTShots
> >
> > 'I VAR Byte
> >
> > 'FOR I = 1 TO TTShots
> >
> > 'FREQOUT 1,1500,1500,2500
> >
> > 'NEXT
> >
> > GOSUB Calc_Pct
> >
> > GOTO MAINLOOP
> >
> >
> >
> > Add_Hit:
> >
> > Lock = 1
> >
> > READ Trip, TTShots
> >
> > READ (Trip + 1), TTHits 'Changed to 2 from 1 because storing
> Word
> > takes 2 bytes
> >
> > TTHits = TTHits + 1 MAX TTShots 'Can't have more hits than
> shots
> >
> > WRITE (Trip + 1), TTHits
> >
> > 'FREQOUT 1,750,2500
> >
> > 'FREQOUT 1,750,2500
> >
> > GOSUB Calc_Pct
> >
> > 'Skip_Hit:
> >
> > GOTO MAINLOOP
> >
> >
> >
> > Calc_Pct:
> >
> > READ Trip, TTShots
> >
> > READ Trip+1,TTHits
> >
> > 'TTPct = ((TTHits * 100) / TTShots)
> >
> > TTPct = (TTHits * 1000) / TTShots
> >
> > 'WRITE (Trip + 4), TTPct 'Can always calculate percent no need
to
> > store
> >
> > GOSUB CLEAR_LCD
> >
> > IF Dsply < 1 THEN
> >
> > FOR ii=2 TO 0
> >
> > SNDCHAR=TTShots DIG ii + 48 ' get jth digit, add 48 for
ascii
> >
> > GOSUB WRITE_TEXT ' put it on the lcd, not shown
> >
> > NEXT
> >
> > GOSUB POSITION_CURSOR
> >
> > FOR ii=2 TO 0
> >
> > SNDCHAR=TTHits DIG ii + 48 ' get jth digit, add 48 for ascii
> >
> > GOSUB WRITE_TEXT ' put it on the lcd, not shown
> >
> > NEXT
> >
> > ELSE 'Show Percent
> >
> > OUTH = %10000010
> >
> > GOSUB POSITION_CURSOR_SEND
> >
> > FOR ii=3 TO 0
> >
> > SNDCHAR=TTPct DIG ii + 48 ' get jth digit, add 48 for ascii
> >
> > GOSUB WRITE_TEXT ' put it on the lcd, not shown
> >
> > IF ii = 1 THEN
> >
> > SNDCHAR = %00101110'Period
> >
> > GOSUB WRITE_TEXT
> >
> > ENDIF
> >
> > NEXT
> >
> > SNDCHAR = %00100101'%
> >
> > GOSUB WRITE_TEXT
> >
> > ENDIF
> >
> > 'GOSUB Print
> >
> > RETURN
> >
> >
> >
> > DO_RESET:
> >
> > WRITE Trip, 0 'TTShots
> >
> > PAUSE 500
> >
> > WRITE (Trip + 1), 0 'TTHits
> >
> > PAUSE 500
> >
> > 'WRITE (Trip + 4), 0 'TTPct
> >
> > 'PAUSE 500
> >
> > GOSUB CALC_PCT
> >
> > RETURN
> >
> >
> >
> > DO_UNLOCK:
> >
> > LOCK = 0
> >
> > RETURN
> >
> >
> >
> > Print:
> >
> > 'DEBUG ? OUT15
> >
> > 'DEBUG ? OUT0
> >
> > 'DEBUG ? IN4,CR
> >
> > 'DEBUG ? IN3,CR
> >
> > 'DEBUG ? Lock, CR
> >
> > RETURN
> >
> >
> >
> > '
LCD
> > CODE
> >
> > WAIT_LCD:
> >
> > LoopCount = LoopCount + 1
> >
> > LOW RS
> >
> > HIGH RW
> >
> > INPUT 15'IN DB7
> >
> > IF IN15 = 1 AND LoopCount < 50 THEN WAIT_LCD
> >
> > PULSOUT E,1
> >
> > LOW RW
> >
> > OUTPUT 15
> >
> > LoopCount = 0
> >
> > RETURN
> >
> >
> >
> > CLEAR_LCD:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %00000001
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > WRITE_TEXT:
> >
> > HIGH RS
> >
> > LOW RW
> >
> > OUTH = SNDCHAR
> >
> > PULSOUT E,1
> >
> > LOW RS
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > MOVE_RIGHT:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %00010000
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > SHIFT_LEFT:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %00011000
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > POSITION_CURSOR:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %10000101
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > POSITION_CURSORB:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = %10001000
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > POSITION_CURSOR_SEND:
> >
> > LOW RS
> >
> > LOW RW
> >
> > OUTH = SNDCHAR
> >
> > PULSOUT E,1
> >
> > GOSUB WAIT_LCD
> >
> > RETURN
> >
> >
> >
> > INTRO:
> >
> > HIGH RS ' prepare
to
> write
> > CG
> > data
> >
> > LOW RW
> >
> > SNDCHAR = CGRam ' point to CG RAM
> >
> > GOSUB POSITION_CURSOR_SEND
> >
> > addr VAR Byte ' address in
EE
> and
> > Dsply
> >
> > FOR addr = HOLE TO HOLE + 7 ' build 4 custom chars
> >
> > READ addr,SNDCHAR ' get byte from EEPROM
> >
> > GOSUB WRITE_TEXT ' put into LCD CG RAM
> >
> > NEXT
> >
> > LOW RS
> >
> >
> >
> > GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01001000'H
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01001111'O
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01010100'T
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01010011'S
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01001000'H
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01001111'O
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > 'GOSUB POSITION_CURSORB
> >
> > SNDCHAR = %01010100'T
> >
> > GOSUB WRITE_TEXT
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 2000
> >
> > SNDCHAR = %10001001'First O
> >
> > GOSUB POSITION_CURSOR_SEND
> >
> > SNDCHAR = %00000000'HOLE
> >
> > GOSUB WRITE_TEXT
> >
> > PAUSE 500
> >
> > SNDCHAR = %10001101'Second O
> >
> > GOSUB POSITION_CURSOR_SEND
> >
> > SNDCHAR = %00000000'HOLE
> >
> > GOSUB WRITE_TEXT
> >
> > PAUSE 2000
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> > GOSUB SHIFT_LEFT
> >
> > PAUSE 50
> >
> >
> >
> > RETURN
> >
> >
> >
> > WRITE_PINS:
> >
> > 'DEBUG ? IN0
> >
> > 'DEBUG ? IN2
> >
> > 'DEBUG ? IN3
> >
> > 'DEBUG ? IN4
> >
> > 'PAUSE 500
> >
> > 'DEBUG "INS="
> >
> > 'DEBUG BIN ? INS, CR
> >
> > 'DEBUG "OUTS="
> >
> > 'DEBUG BIN ? OUTS, CR
> >
> > 'DEBUG "DIRS="
> >
> > 'DEBUG BIN ? DIRS, CR
> >
> > 'PAUSE 500
> >
> > RETURN
> >
> >
> >
> > [noparse][[/noparse]Non-text portions of this message have been removed]
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p...