Shop OBEX P1 Docs P2 Docs Learn Events
newbie help needed on basic programming. — Parallax Forums

newbie help needed on basic programming.

FanTFanT Posts: 10
edited 2006-08-24 18:20 in BASIC Stamp
hi ppl, i have been having problems trying to even do simple single LED on and off setup on my BS2.

i'm using a board of education (Rev C)
BS2.
1 LED and 1 220 resister.



' {$STAMP BS2}
' {$PBASIC 2.5}
LOW 10
PAUSE 8
HIGH 10
END

this is all i typed but nothing seems to lights up.
i tried following exactly as the 1 in BS2 tutorial.pdf aso...but nothing is working.
i tried doing serial LCD. juz to switch on the backlit..but nothing is working as well..

ID icon shows tat everything is fine.
So can anyone advice me on wat can be the possible problem that i am facing here?
lots of thanks .

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2006-08-23 06:29
    LED's have a polarity, are you sure the leads are not swapped?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • FanTFanT Posts: 10
    edited 2006-08-23 06:37
    yes yes
    very sure on that..

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    SEROUT 14,84,[noparse][[/noparse]22,12,17]
    PAUSE 5000

    SEROUT 14,84,[noparse][[/noparse]"hi hi",13,
    ············· "cya"]

    END



    Is this a correct command to display LCD?
    do u know wat does 84 means?
    i wish to light up the backlit, according to the pdf, 17 to light up..but it does not.
    nothing is displayed upon download of program.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-23 14:11
    FanT,

    ·· Whoa!· Let's slow down/backup-up a bit...We haven't even helped you with the LED and you're on to something else·more complex.· On your LED, the way you have the code, presumably the LED is active-low, which means that the Anode should be connected to Vdd and the Cathode to the I/O pin (through the 220-ohm resistor, of course).· The problem is that your PAUSE statement is set for only 8 ms, which isn't really enough time to see anything.· Then you turn the LED off and end the program.· I would recommend reading the "What's A Microcontroller?" tutorial, which you can download for free in PDF format at the link below (botttom of page).· It starts off with blinking an LED and gradually gets into more advanced things.· I hope this helps.· Take care.

    http://www.parallax.com/detail.asp?product_id=28152

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • RDL2004RDL2004 Posts: 2,554
    edited 2006-08-23 18:06
    I agree with Chris, the LED blinks too fast for you to see. Try this instead:



    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    DO

    LOW 10
    PAUSE 500
    HIGH 10
    PAUSE 500

    LOOP
  • FanTFanT Posts: 10
    edited 2006-08-23 19:36
    alrite..thx guys
    i took the advice and yup..LED is working... =-)
    i studied microcontroller b4.. but i deal with Microchips product...
    this is my 1st time looking at PBasic

    one thing i'm not familiar with in Pbasic is this words

    SEROUT TxPin, Baud19200, [noparse][[/noparse]$F8,$02,$0D,$08,$14,$10,$09,$0D,$02]

    does $ refers to Hex value?
    and the number is the value?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-23 19:42
    FanT,

    ·· Correct...Values preceeded by $ are HEX values.· That is to say this is how the programmer is referring to the values.· Whether you specify HEX, Binary or just use plain old decimal, the data all goes out the serial pin the same way (binary bits).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • FanTFanT Posts: 10
    edited 2006-08-24 18:20
    Thank you very much for the informations
    You have been a great help =)

    Still working on my programming as of now. ^^"
Sign In or Register to comment.