alzomor
Advanced Member level 2
Hi
Our application is to measure the time between one reference signal R1 and two other signals S1 & S2.
We use PIC24FJ128GA106 , the reference signal R1 is connected to extenal interrupt signal and the two other signals S1 & S2 are connected to a capture pin.
the ISR for the extenal iterrupt pin "R1" triggers the two capture finctions by SW trigger and when any of the two other signals S1 & S2 arrives on the capture pin the timer is stopped and it's value is red during the capture ISR.
Capture function is clocked form the main oscillator and we are using an external 32MHz crystal to clock the micor .
in order to svae battery the micro is kept in sleep mode and exits sleep mode by the external interrupt and after measuring the two signals and sendeng them using RF link the micro is returned to sleep mode.
I face two problms
A)when the micro exits from sleep mode it's not operating from the external crystal and it depends on the internal 8MHZ crytal for a while before switching to the external crystal, is the time between exting from sleep mode till switching to the external 32 MHZ crystal determnistic? and How much is it? can we keep the external 32MHZ on during sleep?
b)the vlue of the capture is not accurate and the cariance for the exact value is about 150 count in the timer, How can I get more accurate measurment from the capture when I exit from sleep mode.
Best Regards
Hossam Alzomor
Our application is to measure the time between one reference signal R1 and two other signals S1 & S2.
We use PIC24FJ128GA106 , the reference signal R1 is connected to extenal interrupt signal and the two other signals S1 & S2 are connected to a capture pin.
the ISR for the extenal iterrupt pin "R1" triggers the two capture finctions by SW trigger and when any of the two other signals S1 & S2 arrives on the capture pin the timer is stopped and it's value is red during the capture ISR.
Capture function is clocked form the main oscillator and we are using an external 32MHz crystal to clock the micor .
in order to svae battery the micro is kept in sleep mode and exits sleep mode by the external interrupt and after measuring the two signals and sendeng them using RF link the micro is returned to sleep mode.
I face two problms
A)when the micro exits from sleep mode it's not operating from the external crystal and it depends on the internal 8MHZ crytal for a while before switching to the external crystal, is the time between exting from sleep mode till switching to the external 32 MHZ crystal determnistic? and How much is it? can we keep the external 32MHZ on during sleep?
b)the vlue of the capture is not accurate and the cariance for the exact value is about 150 count in the timer, How can I get more accurate measurment from the capture when I exit from sleep mode.
Best Regards
Hossam Alzomor