Example Open Source Waveform Code
The following microcontroller C code is used for the generation of the 100 hz wave using a 909 hz carrier. We used a 909 hz carrier for optimized transformer performance and longer battery life. Modifying the code is easy. We did not bother with interrupts from a timer since precision is not needed and hard coding is more flexible for “tweaking” the transformer.
void CES_100_2ear()
{
ces_counter2 = 23604; // 28916; goes for 4 minutes
CES2_PWR = 1;
CES1_PWR = 1; // initial state
do
{
CES1_PWR = 0;
delay_us(500); // Wait for 0.5 ms sec
CES1_PWR = 1;
delay_us(500); // Wait for 0.5 ms sec
CES2_PWR = 0;
delay_us(500); // Wait for 0.5 s sec
CES2_PWR = 1;
delay_us(500); // Wait for 0.5 s sec
CES1_PWR = 0;
delay_us(500); // Wait for 0.5 ms sec
CES1_PWR = 1;
delay_us(500); // Wait for 0.5 ms sec
CES2_PWR = 0;
delay_us(500); // Wait for 0.5 s sec
CES2_PWR = 1;
delay_us(500); // Wait for 0.5 s sec
delay_us(6062); // tweak to 100 hz
ces_counter2 = ces_counter2 – 1;
}
while (ces_counter2 != 0);
}