I hope someone can help me. I'm totally new to this,(and probably too old to be starting) but I wan't to eventually control 3 stepper motors with potentiometers using an ATmega8.
I've managed to get one working:
/* Program is supposed to read voltage on C0 and produce a number from 0-255 and, depending on the value the stepper motor turns (anti)clockwise and proportionally varies speed)*/
int main (void)
ADMUX=0x60; //Sets reference vcc and left adjusts the reading
ADCSRA=0xEB;//Turns on EDEN, ADSC, ADATE and devides the clock rate by 8
sei(); // Enable Global Interrupts
DDRD = 0xF0;
time=(1000/(ADCH-100)); // should give 6.6 to 33 ms delay
PORTD = 0b10000000;
PORTD = 0b11000000;
etc. (I know there's better ways to do this but I'm still trying out different patterns)
time=(5+(ADCH/5)); // should give a 5-35 ms delay
PORTD = 0b00010000;
PORTD = 0b00100000;
} // between 120 and 135 nothing
I've hunted around all the forums etc. and spent many hours trying to figure out appropriate interrupt routines, but totally failed to get any sign of multi channel ADC reading.
I've seen the recent stepper motor project posting. It looks fantastic, but too far up the learning curve for me.
Guidance on the next step appreciated please. There has to be a better answer than replicating the existing set up three times.