Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

PCINT6 on ATMega169

 
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
JMe

Bascom Member



Joined: 11 Nov 2005
Posts: 20

belgium.gif
PostPosted: Tue Jan 17, 2006 6:05 pm    Post subject: PCINT6 on ATMega169 Reply with quote

Hello
may you help me ?
I try to configure PCINT6 on an ATMega169.
This ATMega169 is the heart of my Butterfly.
I want to generate an interrupt on the falling edge of a pulse connected to (D0/PCINT6)PE6.
This is the only one pin i found on my Butterfly able to accept external interrupt request.
I am not very familiar with setup of internal register.
Many thanks in advance for your help
Regards from Belgium
Jacques
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: Wed Jan 18, 2006 1:42 am    Post subject: Reply with quote

Quote:
I want to generate an interrupt on the falling edge of a pulse connected to (DO/PCINT6)PE6.

First off, you cannot detect the type of edge to trigger on for a PCINTn. PCINTn reacts to any change in state (rising or falling). The best you can do is test PinE.6 after an interrupt to see if it is high or low.

Some form of the following "should" work for you...

Code:

$regfile = "m169def.dat"
$crystal = 8000000
$baud = 9600

DIM State As Byte

'------[ Pin Change ]-------------------------------------------------------------
'
'PortE and PortB have alternate pin change interrupt functions... pcint15 through pcint0

SET EIMSK.6 '<-- this is the pin change interrupt enable bit for PortE (PCInt7 through PCInt0)

'the following sets PortE.0 as a source for pin change interrupt
PCMSK0 = &B00000001

ON PCINT0 pin_change0_isr

Enable Interrupts

'
'------[ Main ]----------------------------------------------------------------
'

Do
  'something
Loop

'
'------[ Interrupt service routines ]-------------------------------------------
'

pin_change0_isr:

 State = PinE.0

 PRINT "Interrupt sensed on PinE.0 transition to "; State

Return
Back to top
View user's profile Yahoo Messenger
JMe

Bascom Member



Joined: 11 Nov 2005
Posts: 20

belgium.gif
PostPosted: Thu Jan 19, 2006 3:01 pm    Post subject: Reply with quote

Hello DToolan,

many thanks for your help
Regards
Jacques
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