hi all, i’m new to FIRST, but not programming.
i’ve read all the recommended reading as per mark mcleod and whatever else i could dig up online.

i know how to program in c and have a little bit of an idea as to how things work.

what i still don’t understand is, does pwm<integer goes here> == pin<$1>?

i should also mention that i like to work under linux and know that the 2.4 compiler works under wine, but can i load the hex output into the robot using ifiloader in wine?

all help is appreciated.


I don’t really understand the first question.

As for the second about ifiloader, sciguy125 wrote a linux port called IFI Loader Reloaded.

pwm01 is the first pwm 3-pin set. I don’t know if that’s what your looking for, but ok. A slightly better explanation would be nice.

what i still don’t understand is, does pwm<integer goes here> == pin<$1>?

that was really weird short hand for pwm01 == pin01?

it would be nice if there was some sort of chart that displayed all of that, not just for pwm outputs of the rc but of the camera, etc.

The PWMs pins are in a 3x16 row. Each column of 3 is one PWM. One pin is the ground, one is the power and one is the signal. If you have any questions dont hesitate to ask.

I think what your are asking is how to turn on a motor. Just setting the variable pwm01 will turn on (or off) the motor connected to the first pwm output. The reason all you need to do is set it is because that variable is returned to the master controller and it “writes” it to the register that turns on the motor.

In the default code its just set to the value from the joystick:
pwm01 = p1_y;

Note: to turn a motor off, set it to 127. Values less than 127 are reverse, values greater than 127 are forward. Its range is 0-255.

You can see all the variable you get for input and that you can set for output in the header file ifi_aliases.h


For programming in linux you can also use picloader to flash the controller. It’s available from sourceforge: There’s no gui with this, but you can use a text mode view with it if you use picloader_textmode.

Assigning a value to a PWM output is not the same as turning a digital output on or off. PWM<x> is a data variable in the block of data which is passed back to the master microprocessor. The master microprocessor handles the radio link and generating the motor signals (there is a way to directly control some of the motor signals, but lets not worry about that at this point). PWM stands for Pulse Width Modulated. The signal on the pwm pin is a stream of pulses at a frequency of about 50-55Hz. The width of the pulse varies between 750 us and 2250 us. A 127 value to the pwm variable generates a pulse width of 1500 us and the motor response to this no movement. A 0 value is full speed in one direction and 255 is full speed in the opposite direction.

i think what i am confused about the most is how does all the wiring work?
i think code wise i am fine, but when it comes time to test the code, i’m going to have a lot of problems. where do i connect what to make interrupts work beyond the software abstraction?

thanks for all the responses thus far. they are much appreciated.