Have done some test a while back on Timers 0 and 1 on 1939 chip and all went just fine.
Ioannis
Have done some test a while back on Timers 0 and 1 on 1939 chip and all went just fine.
Ioannis
Ok, well that's promising cause it also has the enhanced 16bit timer1.
https://ww1.microchip.com/downloads/.../40001574C.pdf
I even made sure to put the INCLUDES in the exact same order, but the error persists.
It's either something totally obvious, or painfully obscure.![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
FOUND IT!
https://www.picbasic.co.uk/forum/sho...8683#post28683
Got some reading to do...The Elapsed-18.bas only has constants for 4,8,10,20 and 40 mhz.
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Unfortunately I am away from any lab and cannot test again.
It will take some time till I can do that...
I recall that I did not use exactly Elapsed Timer but the DT-INTS only. Maybe that is why it worked OK. In any case it should work with Elapsed also.
Ioannis
You beat me! Nice you found that detail! Hope it works OK now. But you use a 16F series chip not 18F.
Ioannis
Of course I had to open a can of worms.
This thread goes into detail how Darrel's Elapsed timer is off by 1:
https://www.picbasic.co.uk/forum/sho...789#post132789The value he used for each of the Oscillator rates is (1) less than it should be.
The reason is that he calculated the Timer1 counter overflow value as 65535 instead of using 65536.
Timer1 is a 16bit counter from 0 to 65535.
It takes 65536 counts to overflow (Wrap back to 0) and trigger the Timer1 interrupt.
This means that his 10ms interrupt will actually run longer by (1) instruction than it should.
Note to self: TimerCalc is in MultiCalc by Mr. E; (Timer Helper).![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Great! Just confirm it counts correctly now.
Ioannis
It compiles, but now I have to find the correct value.
I'm now on Art's thread trying to find that out:
https://www.picbasic.co.uk/forum/sho...020#post156020
EDIT: Darrel talks about the Prescaler and adding NOPs here:
https://www.picbasic.co.uk/forum/sho...9649#post69649
And that's about where my eyes start glossing over. I had also read a comment (somewhere) about Darrel using a prescaler of 2 for 64MHz, so I'm pretty sure I'm on the right track.
EDIT SOME MORE: For future me when I'm looking for the same answer, Prescaler is controlled in T1CON.
Last edited by Demon; - 23rd August 2024 at 01:37.
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Ok, I couldn't figure out how to incorporate Prescaler in Art's formula, so I took another route:
- used Preload from 16MHz
- set Prescaler to 1:2
Counter on LCD worked as expected.
https://www.picbasic.co.uk/forum/sho...025#post156025
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Art's formula with Prescaler:
65535 - (((( MHz / Prescaler ) / 4 ) x 10000 ) - 8 )
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Bookmarks