December 23, 2015 at 9:14 am #4168
My project involves sliced time multitasking. I am new to this. Please help me in writing the code.My project involves sliced time multitasking. I am new to this. Please help me in writing the code.
The main function of this device is to measure rms current and to set alarm if the measured current exceeds the pickup value.The alarm has to be reset by 3 mechanisms- a reset switch, a reset signal and auto reset time. The second function is to detect low battery volatge of the device and indicate the low volatge by an LED.
I have been told to use 2 timer interrupts as explained below:
1) 16 current samples (ADC samples) needs to be captured every 20 msec. Hence a timer interrupt of 1.25 msec has to be generated.
2) A second timer interrupt of 10 msec has to be generated each time for following tasks:
a) Read settings- pickup value, response time(40 msec/50 msec/60 msec/ 80 msec) and reset time( 1 hour/2 hour/3 hour/4 hour)
b) Measure rms current based on the samples captured. The samples are squared and added. The entire sum is divided by 16. This factor is now square rooted.
c) To check if the measured current exceeds the pickup value for more than set response time.
d) If yes then indicate the fault by LED continuously & by relay output (DO).
e) The fault can be reset by 3 mechanisms-a reset switch, a reset signal and auto reset time.
Check if reset switch is being pressed or a reset signal is getting detected. Parallely wait for set reset time. If at all a signal/switch being pressed gets detected or the reset timer gets elapsed then again check if the current is lesser than pickup. If yes then clear the LED and de-energized the DO. If not then again indicate fault by LED and by DO (relay).
f) In the same ISR, we need to check the battery voltage by reading another ADC. If the voltage is low then indicate it by another LED.December 23, 2015 at 9:16 am #13593
My major concern here is how to use 10ms interrupt to wait for time which is greater than 10 msec.
Also I forgot to mention that the device should be in sleep mode.December 26, 2015 at 7:17 pm #13603Ashutosh BhattParticipant
u hv given very deep and long description of ur problem. but is seems to be easy. u just hv to go through timer interrupts theory points and u will be able to do itDecember 28, 2015 at 3:30 am #13605
I have to use 2 timer interrupts in sleep mode. I am using pic16f1787 as my controller.It has only 1 timer which can be used in sleep mode. How should I manage the other timer interrupt?
- You must be logged in to reply to this topic.