Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic code for QuickStart board — Parallax Forums

PropBasic code for QuickStart board

BeanBean Posts: 8,129
edited 2012-10-24 05:30 in Propeller 1
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.
' 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

  • HumanoidoHumanoido Posts: 5,770
    edited 2011-06-09 18:42
    Very nice, Bean. Thanks!
  • SSteveSSteve Posts: 808
    edited 2011-06-09 23:12
    Bean wrote: »
    "the trouble with quotes on the internet is that it is nearly impossible to discern if they are genuine." - abraham lincoln

    roflmao!!
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-06-10 01:34
    That's nice Bean! :-)

    That Lincoln quote nearly made me spit soda on my
    netbook..LoL

    images?q=tbn:ANd9GcQMjFmlJ0PUgZxhAsriLUk9YqeVy-FwpVvMVkRmKj_aazbBRINBkQ
  • Reyp2000Reyp2000 Posts: 10
    edited 2012-10-24 00:36
    Hi Bean, I just downloaded your PropBasic and I was browsing the forum for info on programming my new Quickstart board and I saw your Demo Program. I tried it and it goes thru

    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.
    878 x 496 - 53K
  • kuronekokuroneko Posts: 3,623
    edited 2012-10-24 01:01
    Reyp2000 wrote: »
    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 "(".
    @@@ is an extension only available for BST (download).
  • Reyp2000Reyp2000 Posts: 10
    edited 2012-10-24 01:46
    Thanks for the response Kuroneko. I figure there must be some compatability issue so I downloaded the BST and recompile the Bean's demo program and it work.

    Great demo program Bean, thanks.
  • BeanBean Posts: 8,129
    edited 2012-10-24 04:09
    Viewport also supports the @@@ prefix.

    Bean
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-10-24 05:30
    SimpleIDE also supports the @@@ prefix, I think. I had to run a program that had @@@ prefix in it, and it ran on SimpleIDE.

    Ray
Sign In or Register to comment.