PropBasic code for QuickStart board
Bean
Posts: 8,129
I just got my QuickStart boards.
Nice job Prarallax. Even the packaging impressed me.
So I've been working on a little PropBasic demo program, and here it is.
Bean
Nice job Prarallax. Even the packaging impressed me.
So I've been working on a little PropBasic demo program, and here it is.
' PropBasic demo program for Parallax QuickStart board
' Reads the buttons and displays the button state on the LEDs
' and also sends the buttons value to the Parallax Serial Terminal @ 115200 baud
'
DEVICE P8X32A,XTAL1, PLL16X
FREQ 80_000_000
Buttons PIN 7..0 ' QuickStart button pins
LEDs PIN 23..16 LOW ' QuickStart LED pins
temp VAR LONG ' Holds button value
ascii HUB STRING(4) ' Holds button value as ascii
ReadButtons FUNC 0 ' Function to read QuickStart buttons
PROGRAM Start ' Start program at "Start:" label
Start:
DO
temp = ReadButtons ' Get the button states
LEDs = temp ' Set the LEDs to the button states
ascii = STR temp, 3 ' Convert the buttons value to ascii
ascii = ascii + "," ' Append a comma to the value
SEROUT 30, T115200, ascii ' Send the value to PST
LOOP ' Repeat forever
END
FUNC ReadButtons
HIGH Buttons ' Make button pins high
NOP ' Give them a little bit of rise time
INPUT Buttons ' Make the button pins inputs
PAUSEUS 20 ' Give some time for them to be low if a finger is on them
__param1 = Buttons ^ 255 ' Save the inverted button state (read as zero if pressed)
LOW Buttons ' I found that making the buttons low when done makes them more stable
RETURN __param1 ' Return the inverted button states
ENDFUNC
Bean

Comments
roflmao!!
That Lincoln quote nearly made me spit soda on my
netbook..LoL
Propbasic without any problem but when I try to compile the it with the Propeller Tool I got this error:: "Expected a constant, unary operator, or "(".
Reading this thread does not look like there was a problem with the demo program - maybe it is just the Porpeller Tool. Can you help - a newbie with Propeller?
Thanks.
Great demo program Bean, thanks.
Bean
Ray