Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
Here is the project file. When I open it, I get red triangles next to servo banks
struct pintime { unsigned char pin; unsigned short ticks;};pintime pin_off_time[18] = { ... };
struct outputs { unsigned char rega; unsigned char regb; unsigned char regc;}; outputs cur = { 0x3f, 0x3f, 0x3f };
struct time_outputs { unsigned short ticks; outputs vals;};time_outputs table[18]; for (int ix = 0; ix < 18; ++ix) { time_outputs[ix].ticks = pin_off_time[ix].time; clear_bit(time_outputs[ix].vals, pin_off_time[ix].pin; }
disable_interrupts(); outputs val = { 0x3f, 0x3f, 0x3f }; write_pins(val); TIMER = 0; for (unsigned char ix = 0; ix < 18; ++ix) { while (TIMER < table[ix].ticks) { /* do nothing */ } write_pins(table[ix].vals); } enable_interrupts();
Putting some code into a $2.50 AVR CPU is a lot cheaper than buying a $25 servo controller board, though! And then you can talk to that thing using I2C from your other CPU.