PROBLEMS WHEN COMPILING RTC

Foro para hablantes de español que deseen escribir en su lengua materna.

Moderator: Benj

Post Reply
MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

PROBLEMS WHEN COMPILING RTC

Post 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
Attachments
PANTALLA TFT ILI9341 - RTCC.fcfx
(12.06 KiB) Downloaded 73 times

User avatar
LeighM
Matrix Staff
Posts: 2052
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post 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
Attachments
PIC16BIT_CAL_I2C.c
(27.91 KiB) Downloaded 64 times
PIC16BIT_CAL_RTC.c
(9.34 KiB) Downloaded 76 times
24FJ1024GB610.fcdx
(47.99 KiB) Downloaded 70 times

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post 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
Attachments
PANTALLA TFT ILI9341 - RTCC.fcfx
(13.61 KiB) Downloaded 67 times

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post 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.
Attachments
rtcc.pdf
(108.98 KiB) Downloaded 79 times

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post 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

User avatar
Benj
Matrix Staff
Posts: 14867
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post 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.

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post 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

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post by MOCUELSL »

FORGIVES

RTCCON2Hbits.DIV = 0x3FFF;

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post by MOCUELSL »

[img]Topic%20review[/img]

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post by MOCUELSL »

PIC24FJ1024GB610.png
(84.62 KiB) Downloaded 3688 times

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post by MOCUELSL »

PIC24FJ1024GB610_.png
(239.12 KiB) Downloaded 3688 times

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post 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

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post by MOCUELSL »

PANTALLA TFT ILI9341 - RTCC.fcfx
(18.67 KiB) Downloaded 76 times

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post 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

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post by MOCUELSL »

PIC16BIT_CAL_RTC.c
(9.31 KiB) Downloaded 66 times

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post 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.

MOCUELSL
Posts: 58
Joined: Fri Jun 01, 2018 12:52 pm
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post by MOCUELSL »

PIC16BIT_CAL_RTC.c
(9.42 KiB) Downloaded 90 times

User avatar
Benj
Matrix Staff
Posts: 14867
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Post by Benj »

Thanks for letting us know how you overcame the problem and glad it is working correctly for you now.

Post Reply