I have a circuit with atmega8 + basic . I want to use "sleep mode" and need your help.
my cricuit have a keyboard 3*4 . my microcontroler wait for recive a nomber from keyboard whole time, I want my microcontroler go to sleep mod when not switched any keyboard figure . how can i use "sleep mode" in progeram (basic) ?
Might want to post what you have done so far and naming the basic compiler can't hurt
Have you read up on the sleep command? You will get more help if you post the work you have already done, otherwise no one will do your project/homework for you.
Thanks mramos1
I use the bascom basic compiler
My project is simple digital key
In my pogeram I use the below command
.
.
A=Getkbd()
.
So my microcontroller whole time wait for get a number
I want to add a “sleep command” to my program for reduce the
Power used by microcontroller .
I know there are some sleep commands for AVR microcontroller like as :
IDLE – POWER DOWN – STANDBY and …
Also I use a internal crystal in program .
Thanks for ur reply
I don't use basic but for any compiler, for going to sleep mode you have to load the MCUCR register of atmega with appropriate value to select one of the five sleep modes: standby, power-down, power-save, idle or ADC noise reduction mode (refer to datasheet for MCUCR bits description)
for your application, you can load MCUCR with 0xa0 or 0xb0 for power-down or power-save mode respectively and enable external interrupt.
After setting MCUCR, just put the SLEEP instruction in your code where ever you want the controller to go to sleep.
the controller will wake-up whenever the external interrupt signal is applied (i.e. a key is pressed).
That document is quite old. If you have 4x4 keypad project for Atmel AVR, try Googling "avr 4x4 keypad".. you will find lots of good tutorials and C-code.