View Full Version : Working with PINS in C

12-26-2009, 10:40 AM
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?

12-26-2009, 11:17 AM
Check their Tutorials section (http://www.dragonsgate.net/pub/help/iccprop/2-Tutorials.html). It should give you enough info to get started.

12-26-2009, 04:12 PM
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 [waitcnt(clkfreq + cnt)]. Now what is the equivilent C syntax?

Nick Mueller
12-27-2009, 02:23 AM
> 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).


Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

12-27-2009, 10:20 AM
void msleep(int milliseconds); ... it's in the linked example