Code: Select all
**** Build of configuration Debug for project XC1A-Sequence-LED-Project ****
xmake all
Building file: ../src/xc1a-sequence-led.xc
Invoking: XC Compiler
xcc -O0 -g -Wall -c -o "src/xc1a-sequence-led.o" "../src/xc1a-sequence-led.xc" "../XC-1A.xn"
../src/xc1a-sequence-led.xc: In function `main':
../src/xc1a-sequence-led.xc:16: error: `cledG' undeclared (first use in this function)
../src/xc1a-sequence-led.xc:16: error: (Each undeclared identifier is reported only once
../src/xc1a-sequence-led.xc:16: error: for each function it appears in.)
../src/xc1a-sequence-led.xc:16: error: `cled0' undeclared (first use in this function)
../src/xc1a-sequence-led.xc:16: error: `PERIOD' undeclared (first use in this function)
../src/xc1a-sequence-led.xc:16: error: `cled1' undeclared (first use in this function)
../src/xc1a-sequence-led.xc:17: error: parse error at end of input
xmake: *** [src/xc1a-sequence-led.o] Error 1
Code: Select all
#include <platform.h>
void tokenFlash (chanend left, chanend right, out port led, int delay, int isMaster) {
timer tmr;
unsigned t;
if (isMaster) /* master inserts token into ring */
right <: 1;
while (1) {
int token;
left :> token; /* input token from left neighbor */
led <: 1;
tmr :> t;
tmr when timerafter (t+ delay ) :> void;
led <: 0;
right <: token; /* output token to right neighbor */
}
}
int main (void) {
chan c0, c1, c2, c3;
par {
on stdcore [0]: { cledG <: 1;
tokenFlash (c0, c1, cled0, PERIOD, 1);
}
on stdcore [1]: tokenFlash (c1, c2, cled1, PERIOD, 0);
// other cores
}
return 0;
}