Think the issue is around the decision loop
![Confused :?](./images/smilies/icon_confused.gif)
have tried
if Seconds_Count >=
but this didn't work either
is this because the interrupt is not jumping correctly ?
or do I place the seconds count decision within the interrupt ?
Steve
Moderator: Benj
Code: Select all
Transition on T0CKI external pin
Code: Select all
Internal Clock
Code: Select all
46875.000Hz
is accessed 46875 times a second or once every 1/46875 sec = 21.33 microseconds.TMR0
Code: Select all
Int_counter = 20
Code: Select all
Int_counter = 183
Code: Select all
prescaler
Code: Select all
post scaler
Code: Select all
rollover value
No problem.Steve001 wrote:more than likely will need your need help changing to timer 2
I just wanted to see my project was working so I got seconds to increment all the the time and roll over when they reached 65535.Steve001 wrote:adjustable timer for my v drive, this timer is for the sample time 1 - 120 seconds when i get it working
Code: Select all
MOD
Code: Select all
If: Seconds MOD 15 = 0
Code: Select all
If: Seconds MOD SampleTime = 0
Myself then Ben in much more detail covered it from this post.Steve001 wrote:need to read up on MOD Function
Code: Select all
Mon Feb 29, 2016 6:18 pm
Yes indeed.Steve001 wrote:my decision box to exit the loop should be checking for 0
Code: Select all
If: Seconds MOD 19 = 0
Code: Select all
If: Seconds MOD 45 = 0
Code: Select all
If: Seconds MOD 200 = 0
Code: Select all
if temp=200
Code: Select all
(Seconds MOD ADC_Val = 0) && (Seconds <> 0)
There is a 1ms delay within main loop, so if looped 200 times then 200ms has elapsed.Steve001 wrote:Can you please explain the loopCode: Select all
if temp=200
&& is just logical ANDSteve001 wrote:Not too sure what this is doing either ( && ) , is this if the calculation reminder = 0 and the seconds count is 0 then goto "no"
Code: Select all
if Seconds MOD ADC_Val = 0
Yes that is expected.Steve001 wrote:Program is working now but the timings are slightly out
Code: Select all
Prescaler 16
Code: Select all
Postscaler 16
Code: Select all
Rollover 125
Code: Select all
If: Int_Count = 183
Code: Select all
If: Int_Count = 375
Code: Select all
Rollover
Sent you a PM regarding that.Steve001 wrote:How would i check the rtc on a variable delay to decide to take a measurement and then write to the Vdrive ?