Internal Real Time Clock RTCC PIC8 & PIC16

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

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:

Internal Real Time Clock RTCC PIC8 & PIC16

Post by Benj »

Hello,

I've managed to spend some time investigating the RTCC peripheral on board the PIC 8-bit and 16-bit devices and think I now have it cracked.

Below are a set of files designed to allow you to test out the new functionality.

Simply extract the files into your "Flowcode 7" folder and restart Flowcode to apply the changes.
Flowcode 7 RTCC.zip
(1.25 MiB) Downloaded 647 times
The updated Real Time Clock (RTC) component is then available from the storage component category.

If you have a go then let us know how you get on.

If all is well then I will add these files to the main updates archive.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by QMESAR »

Thank you very much Ben highly apprecaited :D

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: Internal Real Time Clock RTCC PIC8 & PIC16

Post by Benj »

Currently no alarm support, let me know if this is a requirement for anyone and what you would need the alarm to be able to do.

viki2000
Posts: 190
Joined: Mon Jul 07, 2014 9:38 am
Has thanked: 30 times
Been thanked: 77 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by viki2000 »

The Alarms would be useful.
I intend to use DSPIC33FJ64GP802 or DSPIC33FJ128GP802. They have inside RTCC and Alarms.
https://eu.mouser.com/search/ProductDet ... 64GP802ISP
https://eu.mouser.com/search/ProductDet ... 28GP802ISP
Microchip info about RTCC for dsPIC33F/PIC24H Family:
http://ww1.microchip.com/downloads/en/D ... 70301C.pdf
http://ww1.microchip.com/downloads/en/D ... 05193a.pdf
The Alarm macro when is called, it should provide a test bit true if the alarms take/took place and false before that time – that for simple test in a loop. And additional to that it would be useful to provide an interrupt, which would not require any loop for test. In the interrupt macro the user cam then write his code. That is described in the above pdf files. The alarm is also mentioned to be “ONE-SHORT ALARM” and with “CHIME DISABLE/ENABLE”:
Is it any “RTCC CALIBRATION” implemented in the RTCC component?

viki2000
Posts: 190
Joined: Mon Jul 07, 2014 9:38 am
Has thanked: 30 times
Been thanked: 77 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by viki2000 »

Does anyone tried the RTC component and it works?
If yes, then with what MCU? Do you have a test program?
I have tried RTC with dsPIC33FJ128GP802 and for me it does not work. I opened up a question here:
viewtopic.php?f=7&t=19621

viki2000
Posts: 190
Joined: Mon Jul 07, 2014 9:38 am
Has thanked: 30 times
Been thanked: 77 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by viki2000 »

Would be possible to share the source code of the RTC, so we can start debug it, because it seems it has errors, I think in initialization, in some cases as dsPIC33FJ128GP802 for example?
If not, can you debug it or try to find out what other settings, C code must be added to the existing component to make it run properly with dsPIC33FJ128GP802 for example?

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: Internal Real Time Clock RTCC PIC8 & PIC16

Post by Benj »

Hi Viki,

I've sent you a PM with the component source so you can have a look. Could it be a chip configuration issue?

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by stefan.erni »

Hi Ben

I have a Pic32MZ2048 with a internal RTCC. But if I use component RTC from FC7.3, I can only choose DS1307 or DS3231.

How can I choose the internal RTCC from the PIC?

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: Internal Real Time Clock RTCC PIC8 & PIC16

Post by Benj »

Hi Stefan,

What's the rest of the PIC32 part number so I can look at the specific definition file?

Pic32MZ2048...... Matches with 24 devices.

:D

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by stefan.erni »

Hi Ben

I used the PIC32MZ2048EFG100

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: Internal Real Time Clock RTCC PIC8 & PIC16

Post by Benj »

Hello,

I have added the RTCC definition to the FCDX file and hopefully that is all that's required.

Simply copy the attached file to your "Flowcode 7/FCD/PIC32" folder and restart Flowcode and the Internal option should then be available for you.
32MZ2048EFG100.fcdx
(74.04 KiB) Downloaded 239 times
Let us know how you get on.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by stefan.erni »

Hi Ben

Now I can choose the internal RTCC.
But I can only choose the external osci on the componet properties.

Even if the external clock for the RTCC is selected I think the internal osci is connected.

good that I need the internal osci anyway.

It's working nice.

Clock_int_diagram1.PNG
(40.87 KiB) Downloaded 5389 times
Clock_int1.PNG
(24.92 KiB) Downloaded 5389 times

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by stefan.erni »

Hi Ben

The component RTC from FC7 is a very nice way to use a timer, alarm and RAM (buffered with a battery)

It's support the very accurate time chip DS3231 and the "old" DS1307 with a RAM.

Is it possible soon to include the Chip DS3232 that has both, very accurate time and RAM?
DM323X.PNG
(43.92 KiB) Downloaded 5369 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: Internal Real Time Clock RTCC PIC8 & PIC16

Post by Benj »

Hello,

I've now added the option to allow you to switch between external and internal clock sources. You were right that it showed the external clock but actually used the internal clock.

If you want to try the latest for me then please follow the steps below.

The attached file needs to be placed into the "Flowcode 7/CAL/PIC32" folder.
PIC32BIT_CAL_RTC.c
(4.84 KiB) Downloaded 193 times
Then these updated definition files must be extracted to the "Flowcode 7/FCD/PIC32" folder before restarting Flowcode.
PIC32.zip
(340.99 KiB) Downloaded 190 times
I'll add the DS3232 to the list, should be fairly simple to add when we next get some free time.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by stefan.erni »

Hi Ben

Thank for all the infos.
I tried and it's working to switch to the extern OSCI.

But it's not alway starting the OSCI
The quarz is like on picture Q1 connected
to Pin C13 and C14.
I tried all gain and kickstart of the SOSC but still not stable.


Next week I will trie on an another board with a Pic and a different way to connect the OSCI


Q1.PNG
(39.95 KiB) Downloaded 5359 times
Q2.PNG
(63.07 KiB) Downloaded 5359 times

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by stefan.erni »

Hi Ben

The DS3232 is working with the DS3231 componet except the RAM.
Is it possible to have it soon for FC8?
It helps me to save a few configurations bytes

I'll add the DS3232 to the list, should be fairly simple to add when we next get some free time.

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: Internal Real Time Clock RTCC PIC8 & PIC16

Post by Benj »

Hello,

Thanks for reminding me :wink:

I've pushed a v8 update now with a mod to the RTC component for the DS3232.

Let me know how you get on.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by stefan.erni »

Hi Ben
Thank you for the help.

Set and get of time of the DS3232 is working still fine.

Set and get of RAM is not working. It's not freezing but if I set the Ram-addres 1 to value 65, I always read an 0.

Also the number ram of 55 is not like in the data sheet ...
But 55 would be enough....

♦ 236 Bytes of Battery-Backed SRAM

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: Internal Real Time Clock RTCC PIC8 & PIC16

Post by Benj »

Hi Stefan,

Many thanks for letting me know. I've fixed the tool tips so they now correct show the right address range and also found and also hopefully fixed the bug stopping the RAM from being accessed.

Let us know how you get on.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by stefan.erni »

Hi Ben

Thank you Ben. It's perfect now.

something to smile
How to set the time if there is no keyboard or comunication or for the prototype.....

If both (string) format are the same then it would be even easier
RTCC_Auto_id.PNG
(88.24 KiB) Downloaded 4481 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by medelec35 »

stefan.erni wrote:How to set the time if there is no keyboard or comunication or for the prototype.....
If you're interested, I used to set time and date via PC (from the PC clock time) and UART to USB converter.
I also created an Android mobile app which can set the time and date of RTC to the time on the phone via Bluetooth.
I could help you with that.
Martin

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by stefan.erni »

Thank you Martin for the help

Unfortunately, I have no uart or bluetooth available on this board. What I have is the ESP8266 wifi module. To creat a wifi and accessing it from an Internet explorer works fine. somehow I will transmit the time this way.

regards

Stefan

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by AbhijitR »

medelec35 wrote:
stefan.erni wrote:How to set the time if there is no keyboard or comunication or for the prototype.....
If you're interested, I used to set time and date via PC (from the PC clock time) and UART to USB converter.
I also created an Android mobile app which can set the time and date of RTC to the time on the phone via Bluetooth.
I could help you with that.
Hello! Martin

I was trying to search something relevant to your post, is it possible in FC8 to use some function so that the actual date and time from the computer will be transferred or programmed while compelling the flow chart, more or less like programming the "Programmable Relay" like ZELIO or LOGO manufactured by Schneider or Siemens.

Thank you.

Regards
Abhi

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: Internal Real Time Clock RTCC PIC8 & PIC16

Post by Benj »

Hello Abhi,
is it possible in FC8 to use some function so that the actual date and time from the computer will be transferred or programmed while compelling the flow chart
The "Auto Version Identifier" component available from the Storage component category (now Data -> Storage) will do this for you.

Here is the Wiki page on the component.
https://www.matrixtsl.com/wiki/index.ph ... 91fb19f63f

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Internal Real Time Clock RTCC PIC8 & PIC16

Post by AbhijitR »

Hello! Ben
Good morning

Many thanks for the reply, I will try that out today and keep you posted.

Regards
Abhi

Post Reply