I am using a 16F18326 and I want to gate one of the 16-bit timers using an external input.
The datasheet is not informative, but could I make a big assumption that setting TxGPPS (x=1,3,5) to one of the pins is the correct way to input a gate signal.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A tough one to answer. Assumming Timer1 on PortA.0 as below. Change to timer 3 or 5 as appropiate and checkout the T1GPPS
Dirporta.5outDirporta.0inT1CKIPPS=0x05' RA5->TMR1:T1CKIT1GPPS = 0x00 'RA0->TMR1:T1GInittimer1Ext,PS_1'you need to set PS_1 to the correct valueT1GCON = 0x80 'handcrankthT1GONvalue.T1GSST1G_pin;TMR1GEenabled;T1GTMdisabled;T1GPOLlow;T1GGO_nDONEdone;T1GSPMdisabledSetTimer1(0x1234)'somevalue you needT1CON = 0x81 'handcrankT1Convalue.T1CKPS1:1;T1SOSCT1CKI_enabled;T1SYNCsynchronize;TMR1CSExternal;TMR1ONenabled;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. Looks like I will have to try it and see what happens.
I am going to use the internal LF oscillator and have two timers running off it one of them will be gated by a dust/particle detector. The detector normally produces a high signal, but when a atmospheric particle is detected it goes low. The number and lenght of the low pulses give the number and size of the particle (at least I think so again the datasheet is a bit vague - it's a stbm271).
I have tried using a resistor capacitor arrangement to sort of integrate the output, but it seems the high and low output drift to some extent so it would not be very accurate.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It turned out to be fairly straightforward. The problem was the lack of detail on the gate pin in the datasheet.
So I've got timer1 and timer3 running off the LFINTOSC and timer3 only counts when the gate pin is low. Seems to still work in SLEEP so that will save some power.
It turned out to be fairly straightforward. The problem was the lack of detail on the gate pin in the datasheet.
So I've got timer1 and timer3 running off the LFINTOSC and timer3 only counts when the gate pin is low. Seems to still work in SLEEP so that will save some power.
I am using a 16F18326 and I want to gate one of the 16-bit timers using an external input.
The datasheet is not informative, but could I make a big assumption that setting TxGPPS (x=1,3,5) to one of the pins is the correct way to input a gate signal.
Would interrupt on pin change and the interrupt start the timer work?
A tough one to answer. Assumming Timer1 on PortA.0 as below. Change to timer 3 or 5 as appropiate and checkout the T1GPPS
Thanks. Looks like I will have to try it and see what happens.
I am going to use the internal LF oscillator and have two timers running off it one of them will be gated by a dust/particle detector. The detector normally produces a high signal, but when a atmospheric particle is detected it goes low. The number and lenght of the low pulses give the number and size of the particle (at least I think so again the datasheet is a bit vague - it's a stbm271).
I have tried using a resistor capacitor arrangement to sort of integrate the output, but it seems the high and low output drift to some extent so it would not be very accurate.
It turned out to be fairly straightforward. The problem was the lack of detail on the gate pin in the datasheet.
So I've got timer1 and timer3 running off the LFINTOSC and timer3 only counts when the gate pin is low. Seems to still work in SLEEP so that will save some power.
It turned out to be fairly straightforward. The problem was the lack of detail on the gate pin in the datasheet.
So I've got timer1 and timer3 running off the LFINTOSC and timer3 only counts when the gate pin is low. Seems to still work in SLEEP so that will save some power.