The Godfather talking
You think I am funny guy huh?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 03, 2016, 06:43:38 18:43


Login with username, password and session length


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

Posts: 9

Thank You
-Given: 8
-Receive: 4


« on: July 14, 2010, 03:42:18 03: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