Shop OBEX P1 Docs P2 Docs Learn Events
Working with PINS in C — Parallax Forums

Working with PINS in C

kt88seampkt88seamp Posts: 112
edited 2009-12-27 03:20 in Propeller 1
In C lets say you want to make pin 8 an output and set it high·and all the other pins inputs. How·would you do it with the propeller?·

With the MSP430 microcontrollers·you simply would say something like:

P8DIR = 0x01 // Make pin 8 an output.

P8OUT = 0x01 // Make pin 8 high.

The imagecraft compiler does not work that way. I don't think you can work with individual bits like that. How do you with the propeller?

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2009-12-26 04:17
    Check their Tutorials section. It should give you enough info to get started.
  • kt88seampkt88seamp Posts: 112
    edited 2009-12-26 09:12
    I figured out the buisness with the outputting. Now how do you work with waitcnt(count, ticks)? I was playing around with it trying to get it to wait for 80_000_000 clock cycles. In spin that is simple [noparse][[/noparse]waitcnt(clkfreq + cnt)]. Now what is the equivilent C syntax?
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-12-26 19:23
    > Now what is the equivilent C syntax?

    Don't know out of my head. But look into "propeller.h". If something like that exists, you'll find it there. Besides a mwait (IIRC).


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • jazzedjazzed Posts: 11,803
    edited 2009-12-27 03:20
    void msleep(int milliseconds); ... it's in the linked example
Sign In or Register to comment.