PROBLEMS WHEN COMPILING RTC
Moderator: Benj
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 418 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
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 400 times
-
- PIC16BIT_CAL_RTC.c
- (9.34 KiB) Downloaded 428 times
-
- 24FJ1024GB610.fcdx
- (47.99 KiB) Downloaded 365 times
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 400 times
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 423 times
- 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
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
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
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