Shop OBEX P1 Docs P2 Docs Learn Events
Push button — Parallax Forums

Push button

DinodenDinoden Posts: 19
edited 2009-10-29 21:28 in Propeller 1
Hi.
I have done a lot of pic programming and want to try the Propeller. I have done a lot of reading on the Propeller but have a simple test I seem to have problems with. I would like to try to press a button and have a led turn on when the button is high, and turn off when the button is low. Does not have to latch. I just want to become familiar with the first step for me. I wrote a program that the Propeller accepts with out errors but it does not work. I have done a few programs on blinking Leds, running two cogs etc. but now I want to try some external input. Any help would be appriciated.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-29 18:40
    As usual with any question here, you need to provide a schematic drawing of what you have and you need to provide a listing of your program. DO NOT cut and paste your program into a message. It will lose its formatting and become useless. Use the Attachment Manager that you get by using the Post Reply button. You could also use the [noparse][[/noparse] code ] and [noparse][[/noparse] /code ] tags (without the extra spaces). Keep in mind that these tags will not work as you expect if you have any subscripts in your program. You have to put spaces inside the [noparse][[/noparse] ] to prevent the forum software from interpreting the subscript as a formatting command.
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-10-29 19:24
    Why don't you read the Education Lab? It's a very good walkthrou to the propeller programming. Have a look into the sticky threads, there you find the links.

    If you have questions you should be more specific. What programming language are we talking about?

    SPIN? PASM? C?
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-10-29 19:28
    Your if statements are wrong!

    You do an assignment and not a comparison. := assign, == compare

    And you don't need the temp variable at all.

    repeat
      outa[noparse][[/noparse] 0 ]:=ina[noparse][[/noparse] 15 ]
    
  • DinodenDinoden Posts: 19
    edited 2009-10-29 19:34
    Hi.

    Sorry I was talking SPIN language.

    What is the Education LAB? I only have the Propeller chip. I build all the circuit boards my self for downloading (USB to serial, pcb's for testing etc.) All my resources come from the internet and the programming manual that I downloaded.

    Thanks
  • DinodenDinoden Posts: 19
    edited 2009-10-29 19:35
    Thanks MagIO2. I will try this. This is what I have been looking for!
  • photomankcphotomankc Posts: 943
    edited 2009-10-29 19:43
    Dinoden said...
    Hi.

    Sorry I was talking SPIN language.

    What is the Education LAB? I only have the Propeller chip. I build all the circuit boards my self for downloading (USB to serial, pcb's for testing etc.) All my resources come from the internet and the programming manual that I downloaded.

    Thanks

    The PE LABs manual is in the help menu of the Propeller Tool I think, or as a download from Parallax support for the Propeller. It's a series of tutorials on the Propeller and the basics of coding for it and controlling I/O. Based around a breadboarded Propeller DIP.
  • hover1hover1 Posts: 1,929
    edited 2009-10-29 19:46
    Are you using a 10MHZ xtal? A custom hardware platform?

    (_clkmode = xtal2 + pll8x '80MHz (10MHz x 8)
    _xinfreq = 10_000_000 )

    You could still use XTAL1 with 10MHZ i believe.

    http://www.parallax.com/tabid/442/Default.aspx

    is where you would find Propeller Education Kit Labs. A must read!

    Jim
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-10-29 19:47
    Education lab is a document. It teaches you the basics of propeller programming with simple hardware. A resistor here a LED there .. pushbuttons ... It's descriptions are based on the demo-board setup, but you don't need a demo-board for working through the lessons. As I said, you find the link to the document in one of the sticky threads.
  • DinodenDinoden Posts: 19
    edited 2009-10-29 21:28
    Thanks to all again for your great help!
    I will try this as soon as I get home.
Sign In or Register to comment.