|
|
View previous topic :: View next topic |
Author |
Message |
Frnc_Ad
Joined: 14 Jun 2005 Posts: 1 Location: brazil
|
External Interrup Rb0 |
Posted: Tue Jun 14, 2005 6:58 am |
|
|
As I can read the time of the rb0 pin receiving sianis from codigo of bars for this pin. |
|
|
valemike Guest
|
|
Posted: Tue Jun 14, 2005 7:14 am |
|
|
If i think i know what you are asking, you want to know the time that an rB0 interrupt occurred.
I am not aware of any "timestamping" for the rb0 interrupt. YOu can however use the CCP module, using a capture pin, e.g. CCP1.
You can implement a timestamp in software though. That is, you must save the value of a running timer (e.g. Timer1) in a RAM variable. Be aware though that this is not as precise as a capture interrupt, since you will have interrupt latency delaying the execution of your ISR. But this does give a coarse timestamp, and may be consistent enough since you'll always have a consistent interrupt latency. (Unless of course, if you have multiple pending interrupt service routines, then your latency can get increased; that's why i say it is 'coarse'). |
|
|
Guest
|
Re: External Interrup Rb0 |
Posted: Thu Jun 16, 2005 5:33 pm |
|
|
Frnc_Ad wrote: | As I can read the time of the rb0 pin receiving sianis from codigo of bars for this pin. |
In the first part, (L_TO_H )when I dumb of 0 for 1 the value in pin rb0 I count the time that was in 1 and configure for descending edge (H_TO_L).
My problem is inside of interrupt, as to make with that software understands that it must make the second part of the interruption
In the second part the routine must keep the value in zero.
Interrupt routine.
#int_ext
void int_ext_isr(void)
{
int x,i;
static boolean led;
if (intedg==1)
{
intf = 0;
//test interrupt
led = !led;
output_bit (pin_c4,led);
if(var1 == 6)
{
var1 = 0;
}
var1 = var1 + 1;
x=get_rtcc();
valor1[var1];
//write mem. RAM o val. "x" na pos "valor1" do bank 0
write_bank(0 ,valor1,x);
set_timer0(0);
ext_int_edge(0,H_TO_L);
}
else
{
intf = 0;
if(var1 == 6)
{
var1 = 0;
}
var1 = var1 + 1;
x=get_rtcc();
valor0[var1];
write_bank(0 ,valor0,x);
set_timer0(0);
ext_int_edge(0,L_TO_H); .
}
} |
|
|
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|