Please how to show me to use wider port as well as maximum numbers of pins that I can use (I want to use this code for 50 transducers).
Thanks all
Code: Select all
#include <xs1.h>
port p0 = XS1_PORT_1E;
port p1 = XS1_PORT_1F;
port p2 = XS1_PORT_1G;
port p3 = XS1_PORT_1H;
port p4 = XS1_PORT_1I;
port p5 = XS1_PORT_1J;
port p6 = XS1_PORT_1K;
port p7 = XS1_PORT_1D;
void forty(port p, unsigned short edge_clk_cnt) {
for(int i = 0; i <=100; i++) {
p @ edge_clk_cnt <: 0;
edge_clk_cnt += 1250;
p @ edge_clk_cnt <: 1;
edge_clk_cnt += 1250;
}
}
int main(void) {
while(1) {
unsigned short phase0 = (2500 * 0)/360;
unsigned short phase1 = (2500 * 10)/360;
unsigned short phase2 = (2500 * 20)/360;
unsigned short phase3 = (2500 * 30)/360;
unsigned short phase4 = (2500 * 40)/360;
unsigned short phase5 = (2500 * 50)/360;
unsigned short phase6 = (2500 * 60)/360;
unsigned short phase7 = (2500 * 60)/360;
unsigned int current;
p0 <: 0 @ current;
current += 5000;
par {
forty(p0, phase0 + current);
forty(p1, phase1 + current);
forty(p2, phase2 + current);
forty(p3, phase3 + current);
forty(p4, phase4 + current);
forty(p5, phase5 + current);
forty(p6, phase6 + current);
forty(p6, phase7 + current);
}
}
return 0;
}