Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

wakeup on pin change int on ATTiny44

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
jasreb

Bascom Member



Joined: 03 Dec 2004
Posts: 41

uk.gif
PostPosted: Thu Oct 18, 2007 10:35 pm    Post subject: wakeup on pin change int on ATTiny44 Reply with quote

Hi there

I would like to use PCINT9 (portb.1) on ATTiny44 to wake the device from powerdown when the pin goes low level. If I have read the datasheet correctly this should not be a problem.. however..

Bascom 1.11.8.7 does not seem to recognise

config int9 = xxx

or

config pcint9 = xxx

or even

config int1 = xxx

presumably because the ATtiny44.dat file is not up to date to support the multiple pin change interrupts available on the newer devices?

I looked at the ATtiny44 data sheet and pp52-55 seem to imply that portb.1 (PCINT9) can be used to generate a INT1 interrupt if the appropriate bit in the PCMSK1 register is set... is this correct?

if so, my problem is if I can't even get Bascom to config int1 how can I get PCINT9 to work for me? All I want is for PCINT9 to wake the device from powerdown and execute main code loop.

thank you in advance for any advice... :;
Back to top
View user's profile
DToolan

Bascom Member



Joined: 14 Aug 2004
Posts: 1384
Location: Dallas / Fort Worth, Texas (USA)

blank.gif
PostPosted: Thu Oct 18, 2007 11:14 pm    Post subject: Reply with quote

Search this forum for PCINT and you'll find lots of information
Back to top
View user's profile Yahoo Messenger
jasreb

Bascom Member



Joined: 03 Dec 2004
Posts: 41

uk.gif
PostPosted: Thu Oct 18, 2007 11:23 pm    Post subject: Reply with quote

this is what I have so far..

Code:


Pcmsk1 = &B00000010                                         'pin change int PCINT1 on PCINT9 enabled
Gimsk = &B00100000                                          'enable PCint1

Enable Interrupts

Enable Pcint1                      'this may be superfluous?

On Pcint1 Wakeup  'On PCInt1 Wakeup

Powerdown            'goto sleep here

mainloop:

'do stuff here
goto mainloop

End

wakeup:                'PCINT interrupt routine
Disable Pcint1                                              'ignore further pin changes while awake
Goto Mainloop                                               'start running main prog
Return

 
Back to top
View user's profile
jasreb

Bascom Member



Joined: 03 Dec 2004
Posts: 41

uk.gif
PostPosted: Thu Oct 18, 2007 11:27 pm    Post subject: Reply with quote

The

Gimsk = &B00100000

line stops the programme running at all...

If it is commented out, program never goes to sleep, it just runs mainloop programme as normal...?
Back to top
View user's profile
jasreb

Bascom Member



Joined: 03 Dec 2004
Posts: 41

uk.gif
PostPosted: Thu Oct 18, 2007 11:31 pm    Post subject: Reply with quote

DToolan wrote:
Search this forum for PCINT and you'll find lots of information


... I did... which is how I got to here... Wink
Back to top
View user's profile
DToolan

Bascom Member



Joined: 14 Aug 2004
Posts: 1384
Location: Dallas / Fort Worth, Texas (USA)

blank.gif
PostPosted: Fri Oct 19, 2007 12:28 am    Post subject: Reply with quote

See what this does for you...
Code:
$regfile = "attiny44.dat" 'register file for MEGA128-16
$crystal = 8000000 '8MHz crystal
$hwstack = 32   ' default use 32 for the hardware stack
$swstack = 10   ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space

PCMSK1 = &B00000010   'pin change interrupt on PCINT9 enabled
GIMSK = &B00100000    'enable pin change on pin group 8 ~ 11

On PCINT1 Wakeup      'On pin change interrupt Wakeup

Enable Interrupts

Powerdown             'goto sleep here

mainloop:             '<-this will be carried out after awakened

'do stuff here
goto mainloop

END

wakeup:                'pin change interrupt routine
PCMSK1 = &B00000000    'disable PCINT9 while awake
Return
Back to top
View user's profile Yahoo Messenger
jasreb

Bascom Member



Joined: 03 Dec 2004
Posts: 41

uk.gif
PostPosted: Sun Oct 21, 2007 12:52 am    Post subject: Reply with quote

DToolan wrote:
See what this does for you...
Code:
$regfile = "attiny44.dat" 'register file for MEGA128-16
$crystal = 8000000 '8MHz crystal
$hwstack = 32   ' default use 32 for the hardware stack
$swstack = 10   ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space

PCMSK1 = &B00000010   'pin change interrupt on PCINT9 enabled
GIMSK = &B00100000    'enable pin change on pin group 8 ~ 11

On PCINT1 Wakeup      'On pin change interrupt Wakeup

Enable Interrupts

Powerdown             'goto sleep here

mainloop:             '<-this will be carried out after awakened

'do stuff here
goto mainloop

END

wakeup:                'pin change interrupt routine
PCMSK1 = &B00000000    'disable PCINT9 while awake
Return


thanks for the assistance, I think I have it working at last... will post the working code up soon.. it is a strangely enjoyable exercise discovering bits of Bascom that don't quite do what you think they will, and digging a little deeper to solve it. Of course, having expert (patient) assistance from you guys makes it all a lot more achievable!
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum