Hello, I'm new to AVR Assembly, and I was needing help on getting an idea on how to program an AT tiny 2313 that matches the following description in AVR studio 4.
The Micro Controller Unit will generate a pulse that is started by an external interrupt. The pulse duration will be determined by an 8-bit number input on port B. The 8-bit number will be compared with a counter that will be incremented every 200 mS. This will set the pulse time from 0 to a little over 50 seconds in increments of 0.2 seconds.
When an external interrupt is triggered, the interrupt routine will read the PortB input value, turn on an LED connected tp portD6, load a starting value in a timer and start the timer. If the value on PortB is zero it should return without turning on the LED or starting the timer. The interrupt should be triggered when releasing the push button.
When the timer overflows it will trigger and interrupt. In the interrupt routine the timer will need to be loaded with a starting value.
The interrupt routine will increment a counter. The counter will be compared with the 8-bit value that was read on the PortB input pins. When the counter equals the 8-bit number, the output pulse will be turned off and the timer will be stopped.
Another External Interrupt will be configured with a routine that will tuirn off the output pulse and stop the timer. This routine can be used when the pulse duration has elapsed also. This interrupt should be triggered when pressing the button.
Any thoughts would be much appreciated.