Menu

Sleep and Interrupt not working

Waqar
2011-05-16
2013-05-30
  • Waqar

    Waqar - 2011-05-16

    Hello guys,

                          Trying to run this simple program, neither sleep not Interrupt working correctly, I am using Proteus 7.6 Professional to simulate it. It keeps blinking LED at PortC.0

    ;Chip Settings
    #chip 90s8535,8
    ;Interrupt Handlers
    On Interrupt ExtInt0 Call second_blinky
    Main:
    set PortC.0 on
    wait 1 s
    set PortC.0 off
    wait 1 s
    asm sleep
    Goto main
    Sub second_blinky
        set PortC.1 on
        wait 1 s
        set PortC.1 off
        wait 1 s
    End Sub
    
     
  • gcha44

    gcha44 - 2011-05-16

    Hi,
    If you choose ExtInt0 for interrupt , you must first define PortD.2 as an input port :
    Dir PortD.2 in .
    So , when an event occurs on PortD.2 , an  interrupt is generated
    GC

     
  • Waqar

    Waqar - 2011-05-20

    Hello GC,
    Thanks for your reply, tried it and it didn't work, also tried asm sleep without interrupt no luck, I believe 90S8535 is not fully supported by GCB compiler, am I correct?

     
  • gcha44

    gcha44 - 2011-05-20

    Hi,
    At the begining GCBasic was realized to work with PICs , but ATMEL's µC are now supported . I often use Atmega's and it works very well.
    AT90S8535 has a register named  MCUCR .  If you want to be in SLEEPmode , bit6 ( SE=Sleep Enable) of MCUCR must be set (1)  and bits 5 and 4 (SM1 SM0) determine what sleep mode you want .
    Try to do  set MCUCR.6 on ,   but  left MCUCR 5-4 =0 ( iddle mode)
    I hope that instruction 'll help you
    Regards

     
  • Waqar

    Waqar - 2011-05-21

    Hey GC,
    Tried this but no luck

    ;Chip Settings
    #chip 90s8535,8
    ;Interrupt Handlers
    On Interrupt ExtInt0 Call second_blinky
    Dir PortD.2 in
    Main:
    set PortC.0 on
    wait 1 s
    set PortC.0 off
    wait 1 s
    Set MCUCR.6 on
    Set MCUCR.5 off
    Set MCUCR.4 off
    Goto main
    Sub second_blinky
        set PortC.1 on
        wait 1 s
        set PortC.1 off
        wait 1 s
    End Sub
    

    I think something real bad going on inside my AVR : (

     

Log in to post a comment.