Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Pin change interrupt on ATTINY4313

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
bgardner

Bascom Member



Joined: 09 Apr 2004
Posts: 46
Location: Everett, WA

usa.gif
PostPosted: Sun Feb 24, 2013 1:24 am    Post subject: Pin change interrupt on ATTINY4313 Reply with quote

I am using Bascom 2.0.7.6 and attempting to use pin change interrupts on an ATTINY4313 for use with an encoder. Looking at the .DAT file for this chip, it looks like the correct pin change interrupt would be PCINTD and, although it does not show up in red in the editor, it works correctly for the ON PCINTD command, it does not work for the enable PCINTD command. I was able to get the interrupts to work by setting the correct bit but was wondering if I was doing something wrong if there is a problem with the .DAT file? Here's the relevant code:

Code:

Cha Alias Pind.4
Chb Alias Pind.5
Config Cha = Input
Config Chb = Input
Set Portd.4
Set Portd.5

Pcmsk2 = &B00110000
Set Gimsk.pcie2
'Enable Pcintd
On Pcintd Pcint2_isr

Enable Interrupts
 


Thanks for any response.

Bob

(BASCOM-AVR version : 2.0.7.6 , Latest : 2.0.7.6 )
Back to top
View user's profile Visit poster's website
hgrueneis

Bascom Member



Joined: 04 Apr 2009
Posts: 906
Location: A-4786 Brunnenthal

austria.gif
PostPosted: Sun Feb 24, 2013 2:51 am    Post subject: Reply with quote

Why Pcintd?
Try PCINT2 instead.
Hubert
Back to top
View user's profile
bgardner

Bascom Member



Joined: 09 Apr 2004
Posts: 46
Location: Everett, WA

usa.gif
PostPosted: Sun Feb 24, 2013 4:55 am    Post subject: Reply with quote

Well, because when I tried PCINT2, I get an error message that says "unknown interrupt source".

Bob
Back to top
View user's profile Visit poster's website
hgrueneis

Bascom Member



Joined: 04 Apr 2009
Posts: 906
Location: A-4786 Brunnenthal

austria.gif
PostPosted: Mon Feb 25, 2013 12:53 am    Post subject: Reply with quote

Sorry, I just now took a look at the ATtiny4313.dat file.
At least in my version of Bascom (2.0.7.6) all of the options are missing and the intlist is as it seems not complete.
Just compare with ATtiny2313A.dat file (memory is different there).
You best write an email to Bascom Support for a correction request.
Hubert
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6198
Location: Holland

blank.gif
PostPosted: Tue Feb 26, 2013 11:55 pm    Post subject: Reply with quote

there was a typo in the bit name.
just replace the intlist section for this one :

[INTLIST]
count=20
INTname1=INT0,$001,GIMSK.INT0,EIFR.INTF0
INTname2=INT1,$002,GIMSK.INT1,EIFR.INTF1
INTname3=ICP1@CAPTURE1,$003,TIMSK.ICIE1,TIFR.ICF1
INTname4=OC1A@COMPARE1A,$004,TIMSK.OCIE1A,TIFR.OCF1A
INTname5=OVF1@TIMER1,$005,TIMSK.TOIE1,TIFR.TOV1
INTname6=OVF0@TIMER0,$006,TIMSK.TOIE0,TIFR.TOV0
INTname7=URXC@SERIAL,$007,UCSRB.RXCIE,UCSRA.RXC
INTname8=UDRE,$008,UCSRB.UDRIE,UCSRA.UDRE
INTname9=UTXC,$009,UCSRB.TXCIE,UCSRA.TXC
INTname10=ACI,$00a,ACSR.ACIE,ACSR.ACI
INTname11=PCINT0@PCINTB,$00B,GIMSK.PCIE0,EIFR.PCIF0
INTname12=OC1B@COMPARE1B,$00C,TIMSK.OCIE1B,TIFR.OCF1B
INTname13=OC0A@COMPARE0A,$00D,TIMSK.OCIE0A,TIFR.OCF0A
INTname14=OC0B@COMPARE0B,$00E,TIMSK.OCIE0B,TIFR.OCF0B
INTname15=USI_START,$00F,USICR.USISIE,USISR.USISIF
INTname16=USI_OVF,$010,USICR.USIOIE,USISR.USIOIF
INTname17=EERDY,$011,EECR.EERIE
INTname18=WDT@WATCHDOG,$012,WDTCR.WDIE,WDTCR.WDIF
INTname19=PCINT1@PCINTA,$013,GIMSK.PCIE1,EIFR.PCIF1
INTname20=PCINT2@PCINTD,$014,GIMSK.PCIE2,EIFR.PCIF2

atmel started to use PCINTA, B etc. instead of the PCINT0, 1 , 2 etc. The PCINTA makes sense indeed but only when all pins are on the same port.

_________________
Mark
Back to top
View user's profile Visit poster's website
RobDee

Bascom Member



Joined: 04 Feb 2007
Posts: 8

usa.gif
PostPosted: Wed Mar 18, 2015 8:52 pm    Post subject: No PCMSKx -ATTINY2313a Reply with quote

I'm building an external int. using PortB 6 & 7 driving an encoder. I see the PCINTB is now working but there seems to be no place for the mask to select the ports. I tried assembly but it doesn't recognize the PCMSK0 for the 2313a tiny:

Bascom 2.077

$regfile = "attiny2313a.dat"

.
.
.

!ldi r16,$60
!out PCMSK0,r16

Thanks for the time and help,
Rob
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6198
Location: Holland

blank.gif
PostPosted: Wed Mar 18, 2015 8:59 pm    Post subject: Reply with quote

for tiny2313A, atmel uses pcmsk, pcmsk1 and pcmsk2. So there is no pcmsk0.
so use :
pcmsk=&H60

_________________
Mark
Back to top
View user's profile Visit poster's website
RobDee

Bascom Member



Joined: 04 Feb 2007
Posts: 8

usa.gif
PostPosted: Wed Mar 18, 2015 9:30 pm    Post subject: Reply with quote

Thanks for the help and fast response Mark!
Best,
Robert
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR 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