These XMOS chips are different than any other chips I've played with in the past.
But I'm also finding them quite powerful.
I'm not sure which GPIO pin you are referring to, but I can do a quick breakdown of the entire wiggle.xc file here..
lines 1-6 are comments
lines 8-11 include header files that are needed
line 13 defines "PERIOD" as 20 million
lines 15 - 20 are more comments
Lines 23 to 30 define names for the pins we want, and also define
which core each is connected to, and most are also defined as
inputs or outputs.
The choice to use "pin_" at the beginning of each name is to help code
readability as well, so you'll know you're looking at a pin definition in the code.
Lines 37 to 40 launch two threads.. one on core 0 and one on core 1.
They are both running the same code, but have different pins and different periods.
Obviously the pin connected to core 0 goes with the thread running on core 0,
same same for core 1.
lines 45 to 91 are a function that is not being used in this example.
It was commented out back on line 39.
Finally, lines 93 to 110 are the "Flash" routine, running concurrently on separate
threads in two separate cores. Each of those threads will use a timer in addition to the
single bit output that was specified.
Please forgive if I gave more information than you needed. I figure if it's out here for
everyone to read, I might as well cover all the bases.
Some ideas for tinkering:
At lines 38 and 40 you can play with period to change the flash rates.
The originals are set to PERIOD and PERIOD * 8, if you changed the second one
to period / 4 the slowest flashing LED would flash 32 times faster.
If you're really feeling adventurous, you could modify the code around lines 100 to 110,
and start dimming the LEDs instead of just on-off. Google "Pulse Width Modulation" to
see how. We are now holding the ON and OFF times equal, but that could be changed
easily. Once the total (ON + OFF) period is short enough, your eye will just see an
Writing a zero, "pin_XYZ <: 0;" turns ON the LED, writing a one, "pin_XYZ <:1;" turns it OFF.
I would strongly advise that you play only with the LED pins at this time.
In particular, writing to pin_LPC_AD would be very bad.
Once you have built a new executable (.xc) file, just set the tooltype to
sys:utilities/Xena/XTools/XRUNXE, then change the startup to shell, no prompt.
You can then load and run just by double-clicking.
The XReset tool will stop any code you have loaded.
Don't be afraid to ask questions.. I'll answer as best I can.