As a newbie I’ve managed to get multiple timers and Interrupts working flashing LED at different rates (all be it with hap hazard timing so far). Thanks to John for the pointers.
I'm currently writing up my learning pitfalls and currently cleaning my working code, happy to post them if anyone would like my examples, not perfect but better then I've been able to find.
Timers and OSC's :-
I’m trying to understand Oscillators and Timers in more detail. I’ve read the data sheets, I’ve read their various programing docs, I looked at examples (you can never find what you need,
) but I’m not understanding the Oscillators relationship with the timers.
I know I’m being dumb, but, the docs say INTOSC is 16Mhz and INTRC is 32kHz, and that timer 1 and 3 I think it was are linked. Looking at the Logic diagrams left me unsure. I’m beginning to think I can only set 1 Oscillator which effect all Timers, but other parts of the doc talk about T1 and T3 only being effected? I know I can play with this.
I would just like to understand a little bit more and a few pointers before spending hours getting it wrong.
So may I ask a few questions, and then I can go and re-read.
Background :-
Once my skills have improved, my long term project needs to read a slow changing SQ Wave (0hz to 400hz, and create 2 different (SQ Wave) output (PWM signals?) which are in the same range but slightly different to the input, but both varying and drive from the input with various corrections.
Thus I’m thinking 32kHz timer would save lots of extra divide routines.
Questions :-
Regards Geoff.
After 25yrs plus off writing Corporate Business Applications and Database's, this is so much more fun
I'm currently writing up my learning pitfalls and currently cleaning my working code, happy to post them if anyone would like my examples, not perfect but better then I've been able to find.
Timers and OSC's :-
I’m trying to understand Oscillators and Timers in more detail. I’ve read the data sheets, I’ve read their various programing docs, I looked at examples (you can never find what you need,
I know I’m being dumb, but, the docs say INTOSC is 16Mhz and INTRC is 32kHz, and that timer 1 and 3 I think it was are linked. Looking at the Logic diagrams left me unsure. I’m beginning to think I can only set 1 Oscillator which effect all Timers, but other parts of the doc talk about T1 and T3 only being effected? I know I can play with this.
I would just like to understand a little bit more and a few pointers before spending hours getting it wrong.
So may I ask a few questions, and then I can go and re-read.
Background :-
Once my skills have improved, my long term project needs to read a slow changing SQ Wave (0hz to 400hz, and create 2 different (SQ Wave) output (PWM signals?) which are in the same range but slightly different to the input, but both varying and drive from the input with various corrections.
Thus I’m thinking 32kHz timer would save lots of extra divide routines.
Questions :-
- If I set the Oscillators via INTRC to 32kHz, It looks like it will effects all Timers, does it?
- I assume the CPU core speed is not effected?
- Can the various timers be set to different Oscillators?
- Given my Long term project and I using the wrong functionality, i.e. Interrupts to read and timers to write the new SQ Wave
- I’ve also read somewhere you can capture a signal into a timer, but I’m still thinking my interrupt capture is better, not sure why yet
- The 2 SQ Ware outputs need to be autonomous with the main code as other functions will be running adjusting their output
- On one test when I switched timer0 of if seemed to switch time 3 off, the question is are there dependency's between timers ?
- I’ve also read somewhere you can capture a signal into a timer, but I’m still thinking my interrupt capture is better, not sure why yet
Regards Geoff.
After 25yrs plus off writing Corporate Business Applications and Database's, this is so much more fun
Last edited: