OSC 64 (16 + PLL)
PS:00000000 00000100 <--- Dec=4
TC:01100011 11001000 <--- Dec=25544
I had same results manually this afternoon.
Robert
OSC 64 (16 + PLL)
PS:00000000 00000100 <--- Dec=4
TC:01100011 11001000 <--- Dec=25544
I had same results manually this afternoon.
Robert
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 next whats in T1CON ?
Looking at the datasheet for 18F44K22, timer 1 has a 2 bit prescaler.
4 (100) takes 3 bits.
Gonna try timer 2.
...
13.0 TIMER2/4/6 MODULE p.175
...
• 8-bit Timer and Period registers (TMRx and PRx,
respectively)
• Readable and writable (both registers)
• Software programmable prescaler (1:1, 1:4, 1:16)
• Software programmable postscaler (1:1 to 1:16)
...
EDIT: Darn, DT Elapsed include only has Timer1...
Robert
Last edited by Demon; - 23rd December 2014 at 03:31.
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!
Was looking at T1CON register and noticed this:
So that is 2 bits.TxCKPS<1:0>: Timer1/3/5 Input Clock Prescale Select bits
11 = 1:8 Prescale value
10 = 1:4 Prescale value
01 = 1:2 Prescale value
00 = 1:1 Prescale value
T1CON=00000000Code:bit 7-6 TMRxCS<1:0>: Timer1/3/5 Clock Source Select bits 11 =Reserved. Do not use. 10 =Timer1/3/5 clock source is pin or oscillator: If TxSOSCEN = 0: External clock from TxCKI pin (on the rising edge) If TxSOSCEN = 1: Crystal oscillator on SOSCI/SOSCO pins 01 =Timer1/3/5 clock source is system clock (FOSC) 00 =Timer1/3/5 clock source is instruction clock (FOSC/4) bit 5-4 TxCKPS<1:0>: Timer1/3/5 Input Clock Prescale Select bits 11 = 1:8 Prescale value 10 = 1:4 Prescale value 01 = 1:2 Prescale value 00 = 1:1 Prescale value bit 3 TxSOSCEN: Secondary Oscillator Enable Control bit 1 = Dedicated Secondary oscillator circuit enabled 0 = Dedicated Secondary oscillator circuit disabled bit 2 TxSYNC: Timer1/3/5 External Clock Input Synchronization Control bit TMRxCS<1:0> = 1X 1 = Do not synchronize external clock input 0 = Synchronize external clock input with system clock (FOSC) TMRxCS<1:0> = 0X This bit is ignored. Timer1/3/5 uses the internal clock when TMRxCS<1:0> = 1X. bit 1 TxRD16: 16-Bit Read/Write Mode Enable bit 1 = Enables register read/write of Timer1/3/5 in one 16-bit operation 0 = Enables register read/write of Timer1/3/5 in two 8-bit operation bit 0 TMRxON: Timer1/3/5 On bit 1 = Enables Timer1/3/5 0 = Stops Timer1/3/5 Clears Timer1/3/5 Gate flip-flop
Robert
Last edited by Demon; - 23rd December 2014 at 03:42.
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!
ITS NOT using the prescaler those bits need to be 00 ie 1:1
@64mhz with a preload of 25544 you get a tmr1 int every 2.5mS dt's int routine inc's the tips counter till its 4 then inc's the elapsed time clock I count ie once every 10mS
next step after confirming t1con is ok is to toggle a pin in the int routine as per what Sheldon suggested and verify 2.5mS ints are occurring
In the Elapsed include:
Darryl talks about a post-scaler. Timers 1, 3 and 5 have none for a 18F44K22?Code:... ' -------------- calc timer reload Constants ------------------------------- ASM T1PS = 1 ; start with 1:1 postscaler TimerConst = ((OSC*1000000)/4/100) ; how many timer ticks will it take while TimerConst > 65400 ; if it's more than the timer can count T1PS = T1PS * 2 ; double the postscaler TimerConst = TimerConst / 2 ; halve the count endw TimerConst = 65536 - TimerConst + 8 ; final reload value ...
Neither does Timer 0, only Timers 2,4 and 6 have pre and post-scalers.
Robert
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!
hence the T1PS VARDarryl talks about a post-scaler. Timers 1, 3 and 5 have none for a 18F44K22?
Neither does Timer 0, only Timers 2,4 and 6 have pre and post-scalers
t1con looks good should be 0 or 1 (on or off) depending on what the int routine is up to
Bookmarks