I am working on a little bot, my first project, need help. I learned AVR in Assembly, have no experience of using C with AVR, but I have learned C in school(simple and not to an advanced level) but that too on a PC not a uC, AVR is my first uC, I am a NEWBIE. I want to program in C.
I am using ATMega32, with all default settings. I have got 2 Motors, 2 sensors(active HIGH) these should remain OFF the line, I get HIGH when the sensor is ON THE LINE. Both motors have almost the same PWM, I have connected the sensor outputs to the INT0 and INT1 pins, need to use external interrupt and I intent to change the PWM (Phase Correct mode from Timer0 and Timer2) of motors, if the senor comes on line.
I have it on external interrupt, cause there are a few other sensors as well, which I will be constantly polling and updating some registers and outputting desired values.
1. I need to setup interrupts on ANY LOGICAL CHANGE, how to do that.
2. How to call the Interrupt, need help with the ISR(); stuff... can't figure that out.
3. How to CHECK A PARTICULAR PIN for HIGH OR LOW INPUT in C.
4. How to CHANGE A PARTICULAR PIN to HIGH OR LOW OUTPUT in C.
5. I am sure I will be posting more problems SOON...
Please HELP ME.... many thanks in advance to those who will HELP me.....
What I actually need some WELL COMMENTED SAMPLE C CODE, I am using ATMEL AVR STUDIO with AVR GCC. I am a FAST and GOOD LEARNER.....