Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 30, 2024, 04:26:25 04:26


Login with username, password and session length


Pages: [1]
Print
Author Topic: Use PCIE interruptions in BASCOM AVR  (Read 9914 times)
0 Members and 1 Guest are viewing this topic.
SergioFX
Newbie
*
Offline Offline

Posts: 10

Thank You
-Given: 11
-Receive: 4


« on: July 14, 2010, 02:42:18 02:42 »

Hi, I am a member of this forum for a long time, only share information when I think I can be useful, I think this time I can be of help commenting on how you can use the PCIE interruption in Atmel ATTINY85 or ATTINY45  programming in BASCOM.

I wrote this little program that reads the interrupt vectors, and execute any routine in case the input-PCINT change state.

Code:
$regfile = "attiny45.dat"
$crystal = 1000000

Config Portb = &B11100001 'config inputs / outpus
Config Timer0 = Timer , Prescale = 1 'need timer to check interrupt vector
Dim Flag As Byte


Enable Interrupts
Enable Timer0

Set Pcmsk.pcint1 'configure pin to be sensed
Set Pcmsk.pcint2
Set Pcmsk.pcint3
Set Pcmsk.pcint4
Set Gimsk.pcie 'enable PCIE

On Timer0 Active 'go sub active

Set Portb.0 'set pin to see activity
Flag = 1
Start Timer0
Do
   Wait 5
   Flag = 0
   Wait 1
   If Flag = 0 Then
      Reset Portb.0
   End If
Loop

Stop Timer0
End

Active:
   If Gifr.pcif = 1 Then 'check interrupt
      Reset Gifr.pcif
      Flag = 1
      Set Portb.0
   End If
Return

I hope this example will be clear to everyone, I apologize to everyone for my bad English I wrote this post with the help of a translator, if anyone has doubts about the functioning of the code will answer any question with pleasure.

Thanks to all
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC