Page 1 of 1

Timer1 Does not work

Posted: Thu Jun 25, 2020 12:57 pm
by RABO2320
Hello
For RTC Clock:
Timer1 Clock Source 32.768khz Xtal Does not work
XX.png
XX.png (14.08 KiB) Viewed 8125 times
FLOW
Xtal32.768Khz.fcfx
(10.7 KiB) Downloaded 236 times
proteus
CLK.rar
(18.64 KiB) Downloaded 266 times

Re: Timer1 Does not work

Posted: Mon Jun 29, 2020 12:07 pm
by Benj
Hello,

Have you tried this on real hardware or just inside the Proteus sim?

Re: Timer1 Does not work

Posted: Mon Jun 29, 2020 12:35 pm
by RABO2320
Hello Benj

I only tried it on proteus. :|

Re: Timer1 Does not work

Posted: Thu Jul 02, 2020 12:42 pm
by RABO2320
Helloooooo Everyone :? :? :? :? :? :? :? :? :?

Re: Timer1 Does not work

Posted: Thu Jul 02, 2020 12:49 pm
by Benj
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.

Re: Timer1 Does not work

Posted: Mon Jul 06, 2020 1:40 pm
by RABO2320
Hello Ben

I tried it on real hardware.Unfortunately it did not work. :roll:

Also in the interrupt frequency section, interrupt frequency is created from the main source frequency. :?: :!: :?:

:arrow:
X1.png
X1.png (14.56 KiB) Viewed 8010 times
And files
Xtal32.768Khz.fcfx
(9.21 KiB) Downloaded 278 times
CLK2.rar
(18.11 KiB) Downloaded 287 times

Re: Timer1 Does not work

Posted: Wed Jul 08, 2020 11:24 am
by Benj
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?

Re: Timer1 Does not work

Posted: Wed Jul 08, 2020 12:21 pm
by RABO2320
Hi ben

This is the schematic of my circuit:
:arrow:
1sec.PNG
1sec.PNG (191.14 KiB) Viewed 7966 times
:!: :!: :!:
I designed the same Flasher circuit for one second, but it didn't work

Re: Timer1 Does not work

Posted: Wed Jul 08, 2020 12:28 pm
by Benj
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.
OSc.jpg
OSc.jpg (26.44 KiB) Viewed 7965 times

Re: Timer1 Does not work

Posted: Thu Jul 09, 2020 12:32 pm
by RABO2320
Hello Ben

I made the changes you mentioned(In real hardware), but nothing happened again :( :( :(
:arrow:
Capture.PNG
Capture.PNG (175.41 KiB) Viewed 7931 times
I acted according to the data sheet
:arrow:
1.PNG
1.PNG (209.91 KiB) Viewed 7931 times
:?:

But in interrupt settings, the interrupt frequency changes with clock speed change,That shouldn't be the case :?: :!: :?:
:arrow:
X1.png
X1.png (15.65 KiB) Viewed 7931 times

Re: Timer1 Does not work

Posted: Fri Jul 10, 2020 11:28 am
by Benj
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.

Re: Timer1 Does not work

Posted: Tue Jul 14, 2020 1:23 pm
by RABO2320
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? :?: :!: :?:

Re: Timer1 Does not work

Posted: Tue Jul 14, 2020 2:00 pm
by Benj
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.

Re: Timer1 Does not work

Posted: Fri Jul 17, 2020 11:53 am
by RABO2320
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. :idea: :idea: :idea:

Re: Timer1 Does not work

Posted: Fri Jul 17, 2020 12:00 pm
by Benj
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.

Code: Select all

T1CON = 0x0B;
This should set 1:1 prescale, T1OSCEN enabled, TMR1CS External Clock, Enable Timer1

Maybe also try

Code: Select all

T1CON = 0x0F;
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.

Re: Timer1 Does not work

Posted: Sat Jul 18, 2020 12:06 pm
by RABO2320
hello ben

I used the codes you provided in the program,But again nothing happened and the hardware did not work.
:( :!: :?: :!:
T1CKI_T1CKO.fcfx
(9.08 KiB) Downloaded 246 times

Re: Timer1 Does not work

Posted: Sun Jul 19, 2020 6:56 am
by QMESAR
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

Re: Timer1 Does not work

Posted: Sun Jul 19, 2020 1:56 pm
by RABO2320
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.

:?: :?: :!: :!: :?: :?:

Re: Timer1 Does not work

Posted: Sat Jul 25, 2020 3:22 pm
by RABO2320
Hi Ben
please check it.

Re: Timer1 Does not work

Posted: Sun Aug 02, 2020 12:41 pm
by RABO2320
Hi

Please someone to guide

Re: Timer1 Does not work

Posted: Mon Aug 03, 2020 12:28 pm
by Benj
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.