View previous topic :: View next topic |
Author |
Message |
Renju1988
Joined: 13 May 2015 Posts: 5
|
Internal RTC in PIC18F46J50 |
Posted: Wed May 13, 2015 12:32 pm |
|
|
Hi,
I am Renjith. I am working on PIC18f46j50. I have implemented internal RTC, and my program is getting worked fine, i have configured RTC to work with external clock of timer1. I have provided external timer1 clock with 32.768Khz crystal with 12pf capacitor grounded. My problem is, when I am checking the time is running littile faster, for 1 day I am getting an additional 4 minutes.
I need to know whether i should select any particular crystal oscillator. What about oscillator ppm, also about capacitor value. I have read that if values of capacitor changed time may also vary.
Please help me...... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19479
|
|
Posted: Wed May 13, 2015 1:48 pm |
|
|
First look at AN1288 from Microchip. Also AN588.
Your problem could be crystal selection, capacitor value, or pickup from another signal.
If your crystal is meant to require 12pF load capacitance, you don't want 12pF capacitors. The crystal sees as it's load capacitance, the capacitance of the track to one pin, paralleled to the pin capacitance, paralleled with the capacitor on this pin, _in series_ with the same set of capacitances on the other pin.
Typical pin capacitances and track capacitances will sum to perhaps 7pF total (depends massively on your board layout...). So your crystal would 'see' 7pF+12pF in series with the same again. About 9.5pF.
Also, you need to look at what the quoted accuracy of your crystal is. Cheap ones may only give a few seconds a day _at best_. Accuracy costs money. |
|
|
Renju1988
Joined: 13 May 2015 Posts: 5
|
|
Posted: Wed May 13, 2015 10:43 pm |
|
|
Thank you Ttelmah,
I will go through the application notes, thank you once again. |
|
|
Renju1988
Joined: 13 May 2015 Posts: 5
|
USB Bootloader |
Posted: Fri May 15, 2015 1:44 am |
|
|
I am using the USB bootloader which comes with ccsc compiler. I have edited it for my PIC18f46j50. i have got it worked and i uploaded an application program using siow. But one major problem is my bootloader size is taking only 10% ROM, but it is taking almost 45%of RAM.
Is it like that. or is my program error.
Because of bootloader taking this much RAM, my main appilication program with oled display is not not working, but when i uploaded a small program, its worked fine. Main application program is working when i uploaded it with a programmer.
Is there any way to reduce the bootloader RAM consumption. i am using ex_usb_bootloader program as bootloader.
Please help me. |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
Re: USB Bootloader |
Posted: Fri May 15, 2015 1:56 am |
|
|
It doesn't matter how much RAM the bootloader uses. The main application code and the bootloader run independently and the main code will reuse any RAM the bootloader uses, just as it reuses any peripherals. Bootloaders are likely to use a lot of RAM as they have to buffer large chunks of code. This limits their usefulness on PICs with very limited RAM, regardless of the size of ROM/program memory.
One thing to remember though, is that if the main code has just been bootloaded, the contents of any RAM that it doesn't initialise will be whatever the bootloader left in there. It's never good to rely on uninitialised RAM having a particular content - maybe 0x00 or 0xFF - but with bootloaders and any other warm start situation (where the PIC has been restarted after having run) its especially troublesome.
Of course, the bootloader and main code must be in program memory (ROM) at the same time, so it does matter how big the bootloader code is. |
|
|
Renju1988
Joined: 13 May 2015 Posts: 5
|
|
Posted: Tue May 19, 2015 2:33 am |
|
|
I have got the boot-loader working fine. But my program was getting slow, then i checked my code and the loader program, then i realized that the loader doesn't support interrupts in application. But I need to use two interrupts. Timer0 and external interrupts.
Is it possible. |
|
|
Renju1988
Joined: 13 May 2015 Posts: 5
|
|
Posted: Thu May 21, 2015 11:20 pm |
|
|
Is there any way to use interrupts along with my application with USB bootloader. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19479
|
|
Posted: Fri May 22, 2015 12:36 am |
|
|
The USB bootloader allows interrupts in the main code _provided_ you have "USB_ISR_POLLING" defined in the bootloader. This is the default behaviour. |
|
|
|