Page 1 of 1

PROBLEMS WHEN COMPILING RTC

Posted: Mon Jun 11, 2018 8:02 am
by MOCUELSL
Good morning Benj, I'm working with professional V8 flowcode, I want to use the RTC component with my Pic24FJ1024GB610 chip in my project, but when compiling I always get error 1 and I do not know what may be due; I am enclosing the file so you can tell me if it is a chip or programming error. Thanks in advance

Re: PROBLEMS WHEN COMPILING RTC

Posted: Mon Jun 11, 2018 10:46 am
by LeighM
Could you try with the attached updated files.

C:\ProgramData\MatrixTSL\FlowcodeV8\FCD\PIC16\24FJ1024GB610.fcdx
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC16BIT\PIC16BIT_CAL_RTC.c
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC16BIT\PIC16BIT_CAL_I2C.c

Re: PROBLEMS WHEN COMPILING RTC

Posted: Tue Jun 12, 2018 7:39 am
by MOCUELSL
Good morning Benj, thank you very much for your solution, it compiles perfectly, now I have a problem and I ask the PTC18FJ1024GB610 internal RTC clock for hours, minutes and seconds, send them to me at high speed, I have tried all the possible combinations of the fuses but I have not been able to find out the problem. I attached the file to see if you can help me. Thank you.
regards

Re: PROBLEMS WHEN COMPILING RTC

Posted: Wed Jun 13, 2018 1:10 pm
by MOCUELSL
good morning Benj, we are using an oscillator of 32,768khz, we believe that the value of the RTCCON2H register does not have the appropriate value for this oscillator.

Re: PROBLEMS WHEN COMPILING RTC

Posted: Fri Jun 15, 2018 5:02 pm
by MOCUELSL
GOOD AFTERNOON BENJ, THERE IS ANY WAY TO BE ABLE TO CHANGE THE VALUE OF THE VARIABLE (MX_RTC_DIVIDER) OF THE COMPONENT Internal RTC.

Regards

Re: PROBLEMS WHEN COMPILING RTC

Posted: Fri Jun 15, 2018 5:30 pm
by Benj
Hello,

You can either edit this line of the PIC16BIT_CAL_RTC file.

Code: Select all

RTCCON2Lbits.PS = MX_RTC_PRESCALER;		//Set the RTCC Prescaler
to something like this, changing the 1 to the value you require.

Code: Select all

RTCCON2Lbits.PS = 1;		//Set the RTCC Prescaler
Or you can call the initialise function as is leaving the CAL file untouched and then change the register value yourself using the following code in a C code icon.

Code: Select all

		RTCCON1Lbits.RTCEN = 0;					//Disable RTCC

		//Enable RTCC Register Writes.
		asm volatile ("DISI #6");
		asm volatile ("MOV #NVMKEY, W1");
		asm volatile ("MOV #0x55, W2");
		asm volatile ("MOV W2, [W1]");
		asm volatile ("MOV #0xAA, W3");
		asm volatile ("MOV W3, [W1]");
		//asm volatile ("BCLR RTCCON1L, #WRLOCK");
		RTCCON1Lbits.WRLOCK = 0;
		asm volatile ("nop");
		asm volatile ("nop");

		RTCCON2Lbits.PS = 1;		//Set the RTCC Prescaler

		RTCCON1Lbits.RTCEN = 1;					//Enable RTCC
Either way let us know how you get on.

Re: PROBLEMS WHEN COMPILING RTC

Posted: Fri Jun 15, 2018 7:43 pm
by MOCUELSL
IT DOES NOT WORK WHAT I WANT TO DO IS CHANGE THE VALUE OF THE RECORD, (RTCCON2Hbits.DIV = 3FFF;) TO USE A 32,768khz OSCILLATOR IN A PIC 24FJ1024GB610

REGARDS

Re: PROBLEMS WHEN COMPILING RTC

Posted: Fri Jun 15, 2018 7:53 pm
by MOCUELSL
FORGIVES

RTCCON2Hbits.DIV = 0x3FFF;

Re: PROBLEMS WHEN COMPILING RTC

Posted: Fri Jun 15, 2018 8:43 pm
by MOCUELSL
[img]Topic%20review[/img]

Re: PROBLEMS WHEN COMPILING RTC

Posted: Fri Jun 15, 2018 8:52 pm
by MOCUELSL
PIC24FJ1024GB610.png
(84.62 KiB) Downloaded 3688 times

Re: PROBLEMS WHEN COMPILING RTC

Posted: Fri Jun 15, 2018 8:57 pm
by MOCUELSL
PIC24FJ1024GB610_.png
(239.12 KiB) Downloaded 3688 times

Re: PROBLEMS WHEN COMPILING RTC

Posted: Sat Jun 16, 2018 6:47 pm
by MOCUELSL
con este código el RTCC funciona a su velocidad pero hay un error en la variable que mide los minutos, los mide como si segundos.



RTCCON1Lbits.RTCEN = 0; //Disable RTCC

//Enable RTCC Register Writes.
asm volatile ("DISI #6");
asm volatile ("MOV #NVMKEY, W1");
asm volatile ("MOV #0x55, W2");
asm volatile ("MOV W2, [W1]");
asm volatile ("MOV #0xAA, W3");
asm volatile ("MOV W3, [W1]");
//asm volatile ("BCLR RTCCON1L, #WRLOCK");
RTCCON1Lbits.WRLOCK = 0;
asm volatile ("nop");
asm volatile ("nop");

RTCCON2Lbits.CLKSEL = 0;
RTCCON2Lbits.PS = 0;
RTCCON2Lbits.FDIV = 0;
RTCCON2H = 0x3fff;

RTCCON1Lbits.RTCEN = 1; //Enable RTCC

Re: PROBLEMS WHEN COMPILING RTC

Posted: Sat Jun 16, 2018 6:51 pm
by MOCUELSL
PANTALLA TFT ILI9341 - RTCC.fcfx
(18.67 KiB) Downloaded 270 times

Re: PROBLEMS WHEN COMPILING RTC

Posted: Sat Jun 16, 2018 9:28 pm
by MOCUELSL
Hola Benj e encontrado el fallo del código te lo envió para que lo puedas revisar e incluir en la actualización esta probado físicamente en una placa con el PIC24FJ1024GB610 con un oscilador de 32,768 kHz.

SALUDOS

Re: PROBLEMS WHEN COMPILING RTC

Posted: Sat Jun 16, 2018 9:29 pm
by MOCUELSL
PIC16BIT_CAL_RTC.c
(9.31 KiB) Downloaded 249 times

Re: PROBLEMS WHEN COMPILING RTC

Posted: Tue Jun 19, 2018 10:08 am
by MOCUELSL
RTC.png
(116.91 KiB) Downloaded 3609 times
GOOD BENJ DAYS, THE MARKED IN BLUE ARE THE CHANGES I HAVE MADE FOR THE INTERNAL RTCC OF THE PIC24FJ1024GB610 TO WORK WITH A CRYSTAL OF 32,768 kHz. EVERYTHING IS TESTED PHYSICALLY ON A BOARD.

Re: PROBLEMS WHEN COMPILING RTC

Posted: Wed Jun 20, 2018 5:42 pm
by MOCUELSL
PIC16BIT_CAL_RTC.c
(9.42 KiB) Downloaded 277 times

Re: PROBLEMS WHEN COMPILING RTC

Posted: Thu Jun 21, 2018 12:18 pm
by Benj
Thanks for letting us know how you overcame the problem and glad it is working correctly for you now.