Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Output Port States — Parallax Forums

Propeller Output Port States

tj_saggutj_saggu Posts: 3
edited 2012-09-20 19:56 in Propeller 1
Hi I am trying to turn an LED on, on one of the I/O ports.
I don't want it to toggle or anything.
Just want to set OUTA :=1 and activate the LED on power-up.

How does one go about to do that ?

????????????????
MainThread

DIRA := 1
OUTA := 1 ' LED turns on ?

????????????????

thanks, :smile:

Comments

  • ElectricAyeElectricAye Posts: 4,561
    edited 2012-09-20 11:59
    tj_saggu wrote: »
    Hi I am trying to turn an LED on, on one of the I/O ports. ...

    
       dira[1] := 1 ' Set Pin 1 to serve as an output
       outa[1] := 1 ' Set Pin 1 high
    
    

    Learn more at this link. Download the free tutorials to really learn more.

    http://forums.parallax.com/showthread.php?89958-Propeller-Education-Kit-Labs-Tools-and-Applications
  • tj_saggutj_saggu Posts: 3
    edited 2012-09-20 13:02
    thank you for your reply.
    I tried that, every time I set the port to high... it glitches and sets the port back to low.
    Do I need to put it in a (while loop) repeat loop ?

    thanks
  • ElectricAyeElectricAye Posts: 4,561
    edited 2012-09-20 13:12
    tj_saggu wrote: »
    .....
    I tried that, every time I set the port to high... it glitches and sets the port back to low....

    When your program gets to its end, if there isn't some code to keep the Propeller "awake" it will basically shut itself down and go to sleep, so to speak.

    If you put a do-nothing repeat loop at the end of the program, then the Propeller will remain "on-line" and keep the pins in the states at which you instructed them to be.

    Like this:

    
       dira[1] := 1 ' Set Pin 1 to serve as an output
       outa[1] := 1 ' Set Pin 1 high
    
    repeat ' Repeat forever (stay here at this line forever) to keep the program alive
    
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-20 19:56
    tj_saggu wrote: »
    Hi I am trying to turn an LED on, on one of the I/O ports.
    I don't want it to toggle or anything.
    Just want to set OUTA :=1 and activate the LED on power-up.

    How does one go about to do that ?

    ????????????????
    MainThread

    DIRA := 1
    OUTA := 1 ' LED turns on ?

    ????????????????

    thanks, :smile:

    If you want to interact with the Propeller chip and the board you could load my Tachyon Forth onto it and then you could test these kind of things out in a heartbeat via a serial terminal connection (same as the programming port) in plain text.
    If you type --> 0 PINSET <-- it will make P0 an output and high instantly.
    If you type --> BEGIN 0 PINSET 100d ms 0 PINCLR 100d ms AGAIN <-- then it will flash on and off forever etc as soon as you hit the enter key. Look at the links in my sig.
Sign In or Register to comment.