PROBLEMS WHEN COMPILING RTC
Moderator: Benj
-
- Posts: 59
- Joined: Fri Jun 01, 2018 12:52 pm
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
PROBLEMS WHEN COMPILING RTC
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 304 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
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
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 309 times
-
- PIC16BIT_CAL_RTC.c
- (9.34 KiB) Downloaded 313 times
-
- 24FJ1024GB610.fcdx
- (47.99 KiB) Downloaded 284 times
-
- Posts: 59
- Joined: Fri Jun 01, 2018 12:52 pm
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
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
regards
- Attachments
-
- PANTALLA TFT ILI9341 - RTCC.fcfx
- (13.61 KiB) Downloaded 295 times
-
- Posts: 59
- Joined: Fri Jun 01, 2018 12:52 pm
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
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 317 times
-
- Posts: 59
- Joined: Fri Jun 01, 2018 12:52 pm
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
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
Regards
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
Hello,
You can either edit this line of the PIC16BIT_CAL_RTC file.
to something like this, changing the 1 to the value you require.
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.
Either way let us know how you get on.
You can either edit this line of the PIC16BIT_CAL_RTC file.
Code: Select all
RTCCON2Lbits.PS = MX_RTC_PRESCALER; //Set the RTCC Prescaler
Code: Select all
RTCCON2Lbits.PS = 1; //Set the RTCC Prescaler
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 59
- Joined: Fri Jun 01, 2018 12:52 pm
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
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
REGARDS
-
- Posts: 59
- Joined: Fri Jun 01, 2018 12:52 pm
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
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
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
-
- Posts: 59
- Joined: Fri Jun 01, 2018 12:52 pm
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
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
SALUDOS
-
- Posts: 59
- Joined: Fri Jun 01, 2018 12:52 pm
- Has thanked: 8 times
- Been thanked: 5 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
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.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PROBLEMS WHEN COMPILING RTC
Thanks for letting us know how you overcame the problem and glad it is working correctly for you now.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel