PROBLEMS WHEN COMPILING RTC

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

Moderator: Benj

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Mon Jun 11, 2018 8:02 am

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 50 times

User avatar
LeighM
Matrix Staff
Posts: 1962
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 474 times
Been thanked: 674 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby LeighM » Mon Jun 11, 2018 10:46 am

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
(28.72 KiB) Downloaded 44 times
PIC16BIT_CAL_RTC.c
(9.72 KiB) Downloaded 49 times
24FJ1024GB610.fcdx
(48 KiB) Downloaded 47 times

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Tue Jun 12, 2018 7:39 am

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 49 times

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Wed Jun 13, 2018 1:10 pm

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 57 times

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Fri Jun 15, 2018 5:02 pm

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: 14553
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4585 times
Been thanked: 4234 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby Benj » Fri Jun 15, 2018 5:30 pm

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: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Fri Jun 15, 2018 7:43 pm

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: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Fri Jun 15, 2018 7:53 pm

FORGIVES

RTCCON2Hbits.DIV = 0x3FFF;

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Fri Jun 15, 2018 8:43 pm

[img]Topic%20review[/img]

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Fri Jun 15, 2018 8:52 pm

PIC24FJ1024GB610.png
PIC24FJ1024GB610.png (84.62 KiB) Viewed 2791 times

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Fri Jun 15, 2018 8:57 pm

PIC24FJ1024GB610_.png
PIC24FJ1024GB610_.png (239.13 KiB) Viewed 2791 times

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Sat Jun 16, 2018 6:47 pm

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: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Sat Jun 16, 2018 6:51 pm

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

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Sat Jun 16, 2018 9:28 pm

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: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Sat Jun 16, 2018 9:29 pm

PIC16BIT_CAL_RTC.c
(9.69 KiB) Downloaded 44 times

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Tue Jun 19, 2018 10:08 am

RTC.png
RTC.png (116.91 KiB) Viewed 2712 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.
These users thanked the author MOCUELSL for the post:
Benj (Wed Jun 20, 2018 2:00 pm)
Rating: 5.26%
 

MOCUELSL
Posts: 51
Joined: Fri Jun 01, 2018 12:52 pm
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby MOCUELSL » Wed Jun 20, 2018 5:42 pm

PIC16BIT_CAL_RTC.c
(9.8 KiB) Downloaded 67 times

User avatar
Benj
Matrix Staff
Posts: 14553
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4585 times
Been thanked: 4234 times
Contact:

Re: PROBLEMS WHEN COMPILING RTC

Postby Benj » Thu Jun 21, 2018 12:18 pm

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