PIC32 RTCC

An area to discuss 32-bit PIC specific problems and examples

Moderator: Benj

Post Reply
r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

PIC32 RTCC

Post by r_teixeir »

Hi Benj,
I am thinking about using the components for rtcc for pic32, but the components for this were not deployed yet. I use the easypic fusion with pic32mx795f512l.
I Checked that there were updates for pic8 and pic16 rtcc but not for pic32. Do you have an estimate date for the pic32 deployment rtcc components?

I appreciate
Thanks

Rod

User avatar
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: PIC32 RTCC

Post by Benj »

Hi Rod,

I've moved your post into a new topic as it's not stricly related to the updates and I would like to keep that topic clean.

It should be quite easy to add the RTCC code for PIC32 so I'll investigate this for you.

User avatar
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: PIC32 RTCC

Post by Benj »

Right I think I have it done correctly now.

Firstly extract the updated definition files into your "Flowcode 7/FCD/PIC32" folder.
PIC32.zip
(171.72 KiB) Downloaded 305 times
Next copy the following file into your "Flowcode 7/CAL" folder.
includes.c
(25.01 KiB) Downloaded 283 times
Finally copy the following file into your "Flowcode 7/CAL/PIC32BIT" folder.
PIC32BIT_CAL_RTC.c
(4.77 KiB) Downloaded 308 times
Let me know how you get on.

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: PIC32 RTCC

Post by r_teixeir »

Hi Benj
Thanks for the files. I tried to run a simple hello world with code generated with a RTCC component. I also included a GLCD KS0108 which is the only way to see if any data is displayed. I uploaded the files, but I couldn´t be able to get it running. I then created another project with just a printed hello world on the GLCD KS0108 and also, couldn´t be able to run. I tried to follow the same exactly configuration for the fuses on mikroC and flowcode 7 to avoid any mistakes.
I dont know if my code for the RTC is right though, can you give me any hints so I could start a RTCC code.
The KS0108 that own has a controller which is totally compatible with the samsung chip KS0108 which is the module: WDG0151-TMI-V#N00, IC NT7107, NT7108C. The picture that I upload for the pin out of the GLCD you can see that I considered what is in the code that I configured in connections Flowcode 7 and also from the picture attached. Some of the pins I couldnt find on the connections, I was able to find from the table options in conecctions, I was ableto see only by searching on picture of the chip.

Thanks Benj

Rod
Attachments
Consider GLCD - KS0108 - instead of TFT -.jpg
Consider GLCD - KS0108 - instead of TFT -.jpg (108.07 KiB) Viewed 10669 times
Timer1_Teste.fcfx
(12.41 KiB) Downloaded 252 times
GLCD_Example.fcfx
(9.03 KiB) Downloaded 254 times

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: PIC32 RTCC

Post by r_teixeir »

Hi Benj I had a mistake in one of the bits for the hello world GLCD, and finally was able to run the glcd code.
On the other side, the code for the RTCC no sucess at all. Couldnt be able to run the code and I loose a lot of time trying to correct the fuses because when I upload the program to mikroprog it changes the fuses as you explained in another post on the forum.

Thanks

Rod
Attachments
Timer1_Teste.fcfx
(12.41 KiB) Downloaded 279 times
GLCD_Example.fcfx
(9.03 KiB) Downloaded 279 times

User avatar
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: PIC32 RTCC

Post by Benj »

Hi Rod,

For the RTCC to function I believe you need a 32.768 KHz crystal across OSC2 and you probably also need to enable OSC2 in the configuration settings.

When you write a value to the RTCC does the value get set. For example if you set the hours to 16 then do you get 16 when you read back the hours?

Can you attach a version of your program with the RTC component.

I have followed the datasheet and RTCC addition so I beleive the Flowcode code for the RTCC should be correct. However I could be wrong.

I've got a PIC32MX veroboard design that I could try and rig up with the RTCC crystal to double check if things are right as a fall back option if you're still having difficulties.

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: PIC32 RTCC

Post by r_teixeir »

Hi benj,
"For the RTCC to function I believe you need a 32.768 KHz crystal across OSC2 and you probably also need to enable OSC2 in the configuration settings."

Yes the easypic fusion board has a 32.768 Khz crystal across OSC2. This is another doubt that I have considering that I configured the OSC2, but still couldnt be able to run. Suppose I have another application that requires great amount of processing data running in parallel fo example serial COM GLCD and the RTCC: Can the configuration of fuses for OSC2 and the HS or XT be considered at the same application using these tasks and different processing? In the code that I tried to run I was thinking about this issue that is why I wanted to get work the glcd first and then the RTCC displaying data on the KS0108.
Iam at work right now, so when I get back home I´ll try to run the code again with the configs your mentioned. As you do have a board for the MX, yes I would like that, if you can post a screen shot of the fuses config of your code so I can see if I can have the same results including the display of data of the KS0108 that would be great.

Thanks again for your time

Rod
Attachments
32Khz.jpg
32Khz.jpg (99.36 KiB) Viewed 10634 times

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: PIC32 RTCC

Post by r_teixeir »

Hi Benj,
I was able to get the print of data displayed on the KS0108 but the values are not changing. I tried to include as you can see on the code an increment for variables hour, min and sec, but they are not changing at all.
As you mentioned on your last post, I enabled the secondary oscillator and I also enabled primary as XT with PLL, the result was a faster display of data on the screen. The only problem is the incrementing of value. I tried different configurations but this one was the best. If I only let enabled the secondary oscillator and external clock as primary enabled with no PLL, data are not displayed on the KS0108.

Am I on the right track? Next step, Ill try to include some buttons so I can set manualy a timer for each variable.

OBS: Another thing that I had to change on the code, was the component option for KS0108, in the simulation and download of the code I had to use to controller count option number 3 for 192x64, instead of the 128x64 which is the real hardware that I have. Can you explained me why this is happenning, because I believe I should be using in simulation the same as in hardware correct?

Thanks

Rod
Attachments
Timer_Test1.fcfx
(18.6 KiB) Downloaded 276 times
KS0108_Pic_Timer.jpg
KS0108_Pic_Timer.jpg (80.95 KiB) Viewed 10613 times

User avatar
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: PIC32 RTCC

Post by Benj »

Hi Rod,

I've looked at your program and have some suggestions.

1) The RTC initialise is currently being called as port of your main loop. Move this from the Timer macro into the Inicio macro to avoid calling it repeatedly.

2) The same goes for setting the values for the date and time, Your Timer macro should only contain the Get component macros. All the Set component macros should be outside of your main loop.

Hopefully this will help.

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: PIC32 RTCC

Post by r_teixeir »

Hi Benj I did the modifications you mentioned and it worked. Thank you! The only problem is that the refreshing of data displayed into the KS0108 for every second has to be clear, otherwise the numbers get overlaping to each other. I tried different places for the component macro clear display, but the numbers on the screen are jumpie! I Figure that the clear display has to inside the main loop because it will always be true that it needs to be clear the display for a new data to come up. I Uploaded the code so you can see.

Do you have any suggestions for the display?

Thanks Rod
Attachments
Timer_Test1.fcfx
(18.23 KiB) Downloaded 267 times

User avatar
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: PIC32 RTCC

Post by Benj »

Hi Rod,

When printing the time and date strings simply set the Transparent parameter to 0 instead of 1. This will ensure the text prints correctly and without overlapping. This should mean you no longer need to call the clear display macro in your loop.

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: PIC32 RTCC

Post by r_teixeir »

Hi Benj, I tried to do the modifications but i didnt work out. I will try some more approaches and see if I can pull this off.
And Ill get back to you.

Thanks

Rod

r_teixeir
Posts: 96
Joined: Fri Jul 15, 2016 10:51 am
Has thanked: 24 times
Been thanked: 5 times
Contact:

Re: PIC32 RTCC

Post by r_teixeir »

Hi Benj It worked the modifications that I did on the code, no need to include the clear display indeed.
Iam trying to turn a led on with if the count of minutes reach to 17 and stay off otherwise, but no success.
I read a post that you said if there is anybody interested on the alarm you would have to include something....Well Iam interested! I Have an application which needs to be synchronized with a timer clock and I would like to include the timer alarm for it in order to turn off the system.

Do you still have to deploy anything (inlcude anything) for the RTCC Alarm? If not let me know that I will work on a program and then Ill post here so we can have a fresh start.

Thank you

Rod

Post Reply