PDA

View Full Version : Pic18f24j50 usb>>rtc



PlantBob
- 8th February 2011, 12:00
I am using a PIC18F24J50 that has a internal RTC, I need to be able to set the time from a VB program over USB, I can get the data from the VB program to the PIC, I just need to to know how to set the clock once I get the data. I will send something like this:

Time: 06:59:23
Date: 02:08:2011

Thanks,
Bob

rmteo
- 8th February 2011, 21:13
Have you checked Chapter 16 of the device data sheet?

PlantBob
- 8th February 2011, 23:44
Yes, I looked at section 16.2.2.1 and it states if I want to use the internal Oscillator by setting CONFIG3L<1>, I just can't find anyone who knows where you set that. Any idea?

mackrackit
- 8th February 2011, 23:49
You set the fuses in the PBP *.inc file or in code space.
http://www.picbasic.co.uk/forum/showthread.php?t=543

To find all of the options go to the MPASM Suite
C:\Program Files\Microchip\MPASM Suite

And find the *.inc file for your chip there, do not modify this file.

PlantBob
- 9th February 2011, 13:11
Read the post, looked in the 18F24J50.inc file and still not seeing anything that references settiing
CONFIG3L<1>

Bruce
- 9th February 2011, 14:03
PBP include files do NOT include every single config option. They're normally only going to include just enough to help you get the PIC up & running.

It's up to you to read the data sheet, and config options you want to change if the default header file doesn't configure everything you want to change from the default.

For a complete list of all config options, don't look in the PBP .INC file. Look in the P18F24J50.INC file in your MPASM Suite directory. This has a list of every single config option the PIC type has, and explains what each option does.

In the microchip include file for this PIC type you'll see;

; RTCC Clock Select:
; RTCOSC = INTOSCREF RTCC uses INTRC
; RTCOSC = T1OSCREF RTCC uses T1OSC/T1CKI

Now look in the PIC data sheet config section for what each of these options are. I do not recommend you use the internal osc for RTC if you want a precise clock.