Author Topic: Please I need some help with PIC16F18855  (Read 1340 times)

0 Members and 1 Guest are viewing this topic.

Offline KYU_SkuizzTopic starter

  • Newbie
  • Posts: 4
  • Country: ch
Please I need some help with PIC16F18855
« on: September 24, 2024, 10:54:27 am »
Hello everyone,

I’m an apprentice electronics technician. I need to create a 32.768 kHz oscillator with a PIC16F18855 for an RTC (MCP79412) because I forgot to include a quartz crystal on my PCB. :palm:

My first question is: can I make it using Timer2 or some other method? And how to make it ?

Second question: In the MCP79412, X1 is the input, but what about X2? What is its purpose?

If you have any other questions, don't hesitate, I'll respond as quickly as possible.
Thanks
 

Online woofy

  • Frequent Contributor
  • **
  • Posts: 416
  • Country: gb
    • Woofys Place
Re: Please I need some help with PIC16F18855
« Reply #1 on: September 24, 2024, 11:14:52 am »
X2 is the output when using a 32KHz crystal.
The MCP79412 will need to be put into external oscillator mode if you want to use the PIC.
If you are using the internal oscillator in the PIC, don't bother, it won't be accurate enough for an RTC. If you are using an external crystal then it may be possible, but you haven't said what the frequency is.
Note also it will not be able to keep time when the CPU is powered off. In that case you may as well just use the CPU to track time with a timer interrupt, until you can get the PCB revised.
 
The following users thanked this post: KYU_Skuizz

Online JPortici

  • Super Contributor
  • ***
  • Posts: 3635
  • Country: it
Re: Please I need some help with PIC16F18855
« Reply #2 on: September 24, 2024, 12:56:26 pm »
You could use the NCO (which can run in power waving modes as well), though woofy has valid concerns about the clock source, if you're using the internal FRC you might as well ditch the RTC entirely and do it in software inside the PIC
 
The following users thanked this post: KYU_Skuizz

Online voltsandjolts

  • Supporter
  • ****
  • Posts: 2758
  • Country: gb
Re: Please I need some help with PIC16F18855
« Reply #3 on: September 24, 2024, 01:11:53 pm »
Why not just bodge a crystal onto the RTC pins?
Get a crystal with legs and couple of small through-hole caps, job done.
Tricky for TFDN package but possible.
 
The following users thanked this post: Ian.M, KYU_Skuizz

Offline KYU_SkuizzTopic starter

  • Newbie
  • Posts: 4
  • Country: ch
Re: Please I need some help with PIC16F18855
« Reply #4 on: September 24, 2024, 01:24:34 pm »
@woofy
Thank you for the answer. As I mentioned earlier, my PCB has already been ordered, so I cannot add anything else.

For timekeeping, this is supposed to work normally. A battery has been placed on the Vbat pin of the RTC. However, I have the impression that without a crystal, I am in trouble; I suppose that the oscillation will not occur, and therefore my battery will be of no use.

For accuracy, I might be able to tinker with something less than ideal to salvage what I can, but it won't be clean, that's for sure, and it won't be much more precise, ironic for a clock, haha (my project).

You mentioned that I didn't provide the frequency, so I'm not sure I understood, so I will list them all here:

Input frequency to the RTC: 32.768 kHz
Internal PIC frequency: 4 MHz
Frequency of my stupidity: at least four times a day.
Sorry if I'm not specific with the terminology; I'm not a native English speaker.
 

Offline KYU_SkuizzTopic starter

  • Newbie
  • Posts: 4
  • Country: ch
Re: Please I need some help with PIC16F18855
« Reply #5 on: September 24, 2024, 01:27:58 pm »
@JPortici

it could work, however, I have to use the RTC.
Its in my requirements document :/
« Last Edit: September 24, 2024, 01:37:19 pm by KYU_Skuizz »
 

Offline KYU_SkuizzTopic starter

  • Newbie
  • Posts: 4
  • Country: ch
Re: Please I need some help with PIC16F18855
« Reply #6 on: September 24, 2024, 01:36:12 pm »
Why not just bodge a crystal onto the RTC pins?
Get a crystal with legs and couple of small through-hole caps, job done.
Tricky for TFDN package but possible.

I'm not sure I understand. Do I take a through-hole quartz and connect it directly to the pins of the RTC? It's funny because that's exactly the kind of tinkering I would do, haha.
However, I didn't understand what "small through-hole caps" are. Could you explain that to me?
 

Online voltsandjolts

  • Supporter
  • ****
  • Posts: 2758
  • Country: gb
Re: Please I need some help with PIC16F18855
« Reply #7 on: September 25, 2024, 08:05:46 am »
Why not just bodge a crystal onto the RTC pins?
Get a crystal with legs and couple of small through-hole caps, job done.
Tricky for TFDN package but possible.

I'm not sure I understand. Do I take a through-hole quartz and connect it directly to the pins of the RTC? It's funny because that's exactly the kind of tinkering I would do, haha.
However, I didn't understand what "small through-hole caps" are. Could you explain that to me?

Maybe these parts:
uk.farnell.com/4165725
uk.farnell.com/2860107

Assembly diagram:
« Last Edit: September 25, 2024, 08:15:17 am by voltsandjolts »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf