Timer1 Does not work
Moderator: Benj
-
- Posts: 41
- Joined: Sun Mar 01, 2020 1:39 pm
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Timer1 Does not work
Hello
For RTC Clock:
Timer1 Clock Source 32.768khz Xtal Does not work
FLOW proteus
For RTC Clock:
Timer1 Clock Source 32.768khz Xtal Does not work
FLOW proteus
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Timer1 Does not work
Hello,
Have you tried this on real hardware or just inside the Proteus sim?
Have you tried this on real hardware or just inside the Proteus sim?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Timer1 Does not work
Hello,
The setup is fairly straightforward and looks to be correct, could it be a Proteus sim problem? If you could try it on real hardware then that might give a much better indication.
The setup is fairly straightforward and looks to be correct, could it be a Proteus sim problem? If you could try it on real hardware then that might give a much better indication.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 41
- Joined: Sun Mar 01, 2020 1:39 pm
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Timer1 Does not work
Hello Ben
I tried it on real hardware.Unfortunately it did not work.
Also in the interrupt frequency section, interrupt frequency is created from the main source frequency.
And files
I tried it on real hardware.Unfortunately it did not work.
Also in the interrupt frequency section, interrupt frequency is created from the main source frequency.
And files
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Timer1 Does not work
Hello,
Hmm the generated code does look ok, I've just compared it with the datasheet and I cant see any problems.
Can you send us a schematic of your current hardware setup so we can investigate what the problem might be. I tried your Proteus file but it isn't opening in my version.
Have you confirmed the chip is running, using a 1 second flasher test?
Hmm the generated code does look ok, I've just compared it with the datasheet and I cant see any problems.
Can you send us a schematic of your current hardware setup so we can investigate what the problem might be. I tried your Proteus file but it isn't opening in my version.
Have you confirmed the chip is running, using a 1 second flasher test?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 41
- Joined: Sun Mar 01, 2020 1:39 pm
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Timer1 Does not work
Hi ben
This is the schematic of my circuit:
I designed the same Flasher circuit for one second, but it didn't work
This is the schematic of my circuit:
I designed the same Flasher circuit for one second, but it didn't work
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Timer1 Does not work
Hello,
You have the configuration setup for an 20MHz external oscillator but this is not supplied on the schematic. First concentrate on this and getting the 1 second flasher running.
Next the crystal across the T1 pins needs capacitors to ground on both of the pins, datasheet specifies 33pf.
You have the configuration setup for an 20MHz external oscillator but this is not supplied on the schematic. First concentrate on this and getting the 1 second flasher running.
Next the crystal across the T1 pins needs capacitors to ground on both of the pins, datasheet specifies 33pf.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 41
- Joined: Sun Mar 01, 2020 1:39 pm
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Timer1 Does not work
Hello Ben
I made the changes you mentioned(In real hardware), but nothing happened again
I acted according to the data sheet
But in interrupt settings, the interrupt frequency changes with clock speed change,That shouldn't be the case
I made the changes you mentioned(In real hardware), but nothing happened again
I acted according to the data sheet
But in interrupt settings, the interrupt frequency changes with clock speed change,That shouldn't be the case
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Timer1 Does not work
Hello,
Is the one second flasher test now working? Nothing will work if this isn't working.
https://www.matrixtsl.com/wiki/index.ph ... ED_flasher
The interrupt properties interrupt frequency is wrong and is not calculated correctly. Its a bug that has been there for a while. It basically cannot know the frequency of your external input and so treats it as off the main clock. This can be ignored and won't cause any problems.
Is the one second flasher test now working? Nothing will work if this isn't working.
https://www.matrixtsl.com/wiki/index.ph ... ED_flasher
The interrupt properties interrupt frequency is wrong and is not calculated correctly. Its a bug that has been there for a while. It basically cannot know the frequency of your external input and so treats it as off the main clock. This can be ignored and won't cause any problems.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 41
- Joined: Sun Mar 01, 2020 1:39 pm
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Timer1 Does not work
Hello Ben
Thanks for the reply.
The microcontroller works with the one-second flasher you provided,But I want to work with Clock Source 32,768 kHz(T1CKI/T1CKO).
I want to design a watch using the internal RTC microcontroller.
Can't this problem be solved?
Thanks for the reply.
The microcontroller works with the one-second flasher you provided,But I want to work with Clock Source 32,768 kHz(T1CKI/T1CKO).
I want to design a watch using the internal RTC microcontroller.
Can't this problem be solved?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Timer1 Does not work
Hello,
Could it be your crystal at fault? Do you have a link to the crystal you are using so we can look at the specifications.
The code Flowcode is producing all looked ok to me but there could be something additional I am missing. I'll have another go through the datasheet just to try and be sure.
Could it be your crystal at fault? Do you have a link to the crystal you are using so we can look at the specifications.
The code Flowcode is producing all looked ok to me but there could be something additional I am missing. I'll have another go through the datasheet just to try and be sure.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 41
- Joined: Sun Mar 01, 2020 1:39 pm
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Timer1 Does not work
Hello Ben
.
I used 32.768khz crystal.
The crystal is perfectly healthy because I tested it in another circuit.I think the flowcode program code is incorrect.
.
I used 32.768khz crystal.
The crystal is perfectly healthy because I tested it in another circuit.I think the flowcode program code is incorrect.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Timer1 Does not work
There are a few hints here that could help.
https://www.microchip.com/forums/m947335.aspx
I've looked at the code and it looks ok.
Maybe try setting the T1OSO pin (C0) to be an output by writing to the pin using an output icon before enabling the timer interrupt.
Maybe also try writing to the T1CON register yourself inside a c icon after enabling the interrupt to see if this helps.
This should set 1:1 prescale, T1OSCEN enabled, TMR1CS External Clock, Enable Timer1
Maybe also try
Which adds that the external clock sould be synchronised with the internal clock.
If all else fails maybe try a different crystal. The load capacitance/resistance of your crystal could be causing issues on the older 16F873A device.
https://www.microchip.com/forums/m947335.aspx
I've looked at the code and it looks ok.
Maybe try setting the T1OSO pin (C0) to be an output by writing to the pin using an output icon before enabling the timer interrupt.
Maybe also try writing to the T1CON register yourself inside a c icon after enabling the interrupt to see if this helps.
Code: Select all
T1CON = 0x0B;
Maybe also try
Code: Select all
T1CON = 0x0F;
If all else fails maybe try a different crystal. The load capacitance/resistance of your crystal could be causing issues on the older 16F873A device.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 41
- Joined: Sun Mar 01, 2020 1:39 pm
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Timer1 Does not work
hello ben
I used the codes you provided in the program,But again nothing happened and the hardware did not work.
I used the codes you provided in the program,But again nothing happened and the hardware did not work.
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Timer1 Does not work
Hi.
Did you probe the XT pins with a scope to see what the XT signal looks like and it drive level???`
if so can you post the scope print !
if not then do it
Did you probe the XT pins with a scope to see what the XT signal looks like and it drive level???`
if so can you post the scope print !
if not then do it
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 41
- Joined: Sun Mar 01, 2020 1:39 pm
- Has thanked: 1 time
- Been thanked: 2 times
- Contact:
Re: Timer1 Does not work
hi...
I also tested with an oscilloscope,Crystal bases have no signal
Timer 1 does not work with the 32,768 clock source because I think the code has a problem.
I also tested with an oscilloscope,Crystal bases have no signal
Timer 1 does not work with the 32,768 clock source because I think the code has a problem.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Timer1 Does not work
Hello,
If all else fails maybe try a different crystal. The load capacitance/resistance of your crystal could be causing issues on the older 16F873A device.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel