Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

tiny2313 and PCINTx ?

 
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
MHz

Bascom Member



Joined: 28 Sep 2007
Posts: 123

germany.gif
PostPosted: Sun Jul 10, 2011 3:36 pm    Post subject: tiny2313 and PCINTx ? Reply with quote

according to the datasheet ATtiny2313 can handle pin change interrups. Scanning the BASCOM help files, the examples lib and searching the forum I didn't find anyhing usefull Confused How if ever can I use PINA.0 and PINA.1 as pin change interrupt source. Any other two pins except PIND.2 and PIND.3 will also be fine. I'm on version 2.0.1.0

Thanks
Back to top
View user's profile
cucuruzel

Bascom Member



Joined: 18 Mar 2010
Posts: 50
Location: Cluj-Napoca

romania.gif
PostPosted: Sun Jul 10, 2011 5:19 pm    Post subject: Reply with quote

check pcint_change.bas in the samples directory

for short:
Code:

Enable Pcint0                                              
On Pcint0 Isr_pcint0          
Pcmsk0 = &B00000001              

Isr_pcint0:
...
code
...
Return
 
Back to top
View user's profile Visit poster's website Yahoo Messenger
MHz

Bascom Member



Joined: 28 Sep 2007
Posts: 123

germany.gif
PostPosted: Sun Jul 10, 2011 5:46 pm    Post subject: Reply with quote

thank you cucuruzel,
my code looks exacly (?) as yours:

Enable Pcint0
On Pcint0 Encoder_switch
Pcmsk0 = &B00000011

but I get:

Error 85: unknown interruptsource [PCINT0]
error 117 unknown interrupt [PCINT0]

ist my problem ATtiny2313 specific? The example from the lib was for the m88 written.

Thanks
Back to top
View user's profile
cucuruzel

Bascom Member



Joined: 18 Mar 2010
Posts: 50
Location: Cluj-Napoca

romania.gif
PostPosted: Sun Jul 10, 2011 6:26 pm    Post subject: Reply with quote

For AtTiny2313 you should use:

$regfile = "ATtiny2313.DAT"

and

Enable Pcint
On Pcint Isr_pcint0
Pcmsk = &B00000011


as this micro has only one port change interrupt port, it is not numered with trailing zero...it is simple PCINT
Back to top
View user's profile Visit poster's website Yahoo Messenger
MHz

Bascom Member



Joined: 28 Sep 2007
Posts: 123

germany.gif
PostPosted: Sun Jul 10, 2011 9:02 pm    Post subject: Reply with quote

BINGO! Now the program compiles flawless Very Happy

Thank you cucuruzel!

I will dig into more details tomorrow. Maybe more questions will come up. Stay tuned pls.

Thanks again
Back to top
View user's profile
hgrueneis

Bascom Member



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

austria.gif
PostPosted: Mon Jul 11, 2011 5:58 am    Post subject: Reply with quote

Found the problem 1 min. after cucuruzel.
I have run into problems like that and not always think of looking for the correct register names for the chip in question, either in the data sheet or in the def file. Bascom uses the same register names like in the Atmel data sheets.
That makes us HUMAN.
Hubert
Back to top
View user's profile
MHz

Bascom Member



Joined: 28 Sep 2007
Posts: 123

germany.gif
PostPosted: Mon Jul 11, 2011 9:27 am    Post subject: Reply with quote

You're right hgrueneis. that maks us human
But:
Atmel and Bascom should use a common notification e.g. the first item starts allways with "0" like bit-numbers etc. That mak us egeneers Smile

Thank you
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4576
Location: Holland

blank.gif
PostPosted: Mon Jul 11, 2011 9:33 am    Post subject: Reply with quote

atmel changed the names of SFR and bits many times. I tried to keep it the same. At some stage it is not possible to change since it will break code.
_________________
Best regards,

Mark Alberts
MCS Electronics

http://www.mcselec.com
Back to top
View user's profile Visit poster's website
MHz

Bascom Member



Joined: 28 Sep 2007
Posts: 123

germany.gif
PostPosted: Mon Jul 11, 2011 9:42 am    Post subject: Reply with quote

... so we have to blame Atmel.

Keep on going to make BASCOM a very usefull tool Albert

Thank you!

I promise to read the atmel datasheets carefully before posting Smile
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4576
Location: Holland

blank.gif
PostPosted: Mon Jul 11, 2011 9:59 am    Post subject: Reply with quote

atmel is not to blame. when they add an option or register such as the pcint change, it was first for a few pins. so it make sense they use pcint.
when they later added pcint for all/more ports, they had to number it. Then they rename pcint to pcint0 and name the others pcint1, pcint2 etc.
often they keep the old name too with an alias.
only in some cases they had to rename for example xor was not a good name for a bit. and they could not keep the old name.

_________________
Best regards,

Mark Alberts
MCS Electronics

http://www.mcselec.com
Back to top
View user's profile Visit poster's website
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