1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

atmega8 (sleep mode) hellp

Discussion in 'AVR' started by arkani, Oct 12, 2008.

  1. arkani

    arkani New Member

    Joined:
    Oct 11, 2008
    Messages:
    14
    Likes:
    0
    Hi everyone!

    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) ?

    Many thanks in advance
     
  2. mramos1

    mramos1 Active Member

    Joined:
    Sep 15, 2005
    Messages:
    2,403
    Likes:
    9
    Location:
    Boynton Beach, Florida USA
    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.
     
  3. arkani

    arkani New Member

    Joined:
    Oct 11, 2008
    Messages:
    14
    Likes:
    0
    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
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. mramos1

    mramos1 Active Member

    Joined:
    Sep 15, 2005
    Messages:
    2,403
    Likes:
    9
    Location:
    Boynton Beach, Florida USA

    Not up on that compiler. I use RVKBASIC from bastoc.com for AVR projects.

    Are you trying to wake-up on a key-press? Really need to see a schematic. Maybe someone that knows bascom will pop in here. Or hit AVRfreaks.com.

    If I get time I will see if I can get the manual for it online later. Always open to a new compiler.
     
  6. CCD

    CCD New Member

    Joined:
    Jul 27, 2008
    Messages:
    74
    Likes:
    1
    Location:
    Chennai, India
  7. arkani

    arkani New Member

    Joined:
    Oct 11, 2008
    Messages:
    14
    Likes:
    0
    thanks my friends : mramos & CCDCCD / this link not useful to learn how to use a sleep command in progeram.

    I need to know which sleep command i should to use
    I trying to wake-up on a key-press
     
  8. CCD

    CCD New Member

    Joined:
    Jul 27, 2008
    Messages:
    74
    Likes:
    1
    Location:
    Chennai, India
    Hi,
    here is another document from atmel which perfectly describes what you are looking for (only that the code is in assembly).

    http://www.electro-tech-online.com/custompdfs/2008/10/doc1232.pdf

    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).

    -------------
    Design with Microcontrollers
     
    • Like Like x 1
  9. arkani

    arkani New Member

    Joined:
    Oct 11, 2008
    Messages:
    14
    Likes:
    0
    thanks CCD
    tnx for ur hellp
     
  10. saudaratofiq

    saudaratofiq New Member

    Joined:
    Nov 4, 2015
    Messages:
    2
    Likes:
    0
  11. koolguy

    koolguy Active Member

    Joined:
    Aug 24, 2010
    Messages:
    2,196
    Likes:
    9
    Hi CCD,
    The micro project you are making are impressive.
    Data loggers.
     
  12. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    ONLINE
    Last edited: Nov 4, 2015
  13. saudaratofiq

    saudaratofiq New Member

    Joined:
    Nov 4, 2015
    Messages:
    2
    Likes:
    0
    Ok misterT,
    thanks for the help
     

Share This Page