View previous topic :: View next topic |
Author |
Message |
MHz
Joined: 28 Sep 2007 Posts: 123
|
Posted: Sun Jul 10, 2011 3:36 pm Post subject: tiny2313 and PCINTx ? |
|
|
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 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 |
|
|
cucuruzel
Joined: 18 Mar 2010 Posts: 53 Location: Cluj-Napoca
|
Posted: Sun Jul 10, 2011 5:19 pm Post subject: |
|
|
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 |
|
|
MHz
Joined: 28 Sep 2007 Posts: 123
|
Posted: Sun Jul 10, 2011 5:46 pm Post subject: |
|
|
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 |
|
|
cucuruzel
Joined: 18 Mar 2010 Posts: 53 Location: Cluj-Napoca
|
Posted: Sun Jul 10, 2011 6:26 pm Post subject: |
|
|
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 |
|
|
MHz
Joined: 28 Sep 2007 Posts: 123
|
Posted: Sun Jul 10, 2011 9:02 pm Post subject: |
|
|
BINGO! Now the program compiles flawless
Thank you cucuruzel!
I will dig into more details tomorrow. Maybe more questions will come up. Stay tuned pls.
Thanks again |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Mon Jul 11, 2011 5:58 am Post subject: |
|
|
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 |
|
|
MHz
Joined: 28 Sep 2007 Posts: 123
|
Posted: Mon Jul 11, 2011 9:27 am Post subject: |
|
|
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
Thank you |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Jul 11, 2011 9:33 am Post subject: |
|
|
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. _________________ Mark |
|
Back to top |
|
|
MHz
Joined: 28 Sep 2007 Posts: 123
|
Posted: Mon Jul 11, 2011 9:42 am Post subject: |
|
|
... 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 |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Jul 11, 2011 9:59 am Post subject: |
|
|
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. _________________ Mark |
|
Back to top |
|
|
|