oguzmania
Joined: 24 Mar 2008 Posts: 2
|
Using INT RB & Timer 1 In 16F877 |
Posted: Thu Jun 05, 2008 10:16 am |
|
|
Hi i am newbie of this forum , CCS C and PIC.
Firstly i am sorry for my bad English.
If I explain my project;
I have 4 equivalent sound detector circuit and then i will use op-amp in the exit of this 4 circuits.If detector detects sound op-amp (comparator) shows +5V , if not it shows 0 V.
This detector circuit's microphones are in different points.So if i send a sound signal ,the signal arrives this detectors in different times.
Firstly i am using 16F877 and exit of comparator line combined RB<4:7>
For example;
1.detector:RB4
2.detector:RB5
3.detector:RB6
4.detector:RB7
I want to find this different times.(Or time differences)
I want to find time differences with using INT_RB and Timer1.
I set Timer 1 with using my conditions.(Example; using sound velocity etc...)
I don't want to using Timer 1 with it's interrupt.
In my calculation i must measure 30us to 30 msn (Timer 1 64536-65536)
For example i made an audio signal and signal arrives this 4 detector in 4 different times.But i don't know which detector detects firstly.
I said this detectors times like a constant;
Time1 is Detector 1's.
Time2 is Detector 2's.
Time3 is Detector 3's.
Time4 is Detector 4's.
This constants are a kind of Timer 1's values.
When the signal arrives a detector the timer 1 is starting.And then we wait the other 3 detectors Logical 1 signals.When a detector detects signal we find the 2. value with timer 1.And we wait other 2 detector signals.
I want to find with time differences not using interrupt timer 1.
And when RB<4:7>pins 5V-->0V i don't want a new interrupt.
But i didn't make it in CCS.
I want like that ;
if detector1 is logical1;
if (input(pin_b4))
timer 1 starts
and time1=0
if (input(pin_b5))
time2=get_timer1()
if (input(pin_b6))
time3=get_timer1()
if (input(pin_b7))
time4=get_timer1()
But in this way i must know the detecting row.This row is Det.1-2-3 and 4 but in my condition i dont know the row it may be 1-3-2-4 , 2-3-1-4 etc. there are 16 different way.
Problem is i dont know which detector detects firstly.
I am waiting your answers.I hope i explained my problem...
Peace be with you...
Oguz |
|