MIAC dsPIC Clock to Arduino Mega 2560 R3

For anyone wishing to receive additional help with a project or simply looking to hire an embedded contractor we have a few contacts who would be more then willing to help.

Moderators: Benj, Mods

Post Reply
Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by Monie Jacobsen »

Hi every one
Freelance programs!

Do you have the option of getting the Original Clock from dsMIAC to work in the Arduino Mega 2560 R3
And uses the keyboard type Flowcode Keypad (EB014)

See attached original Clock:
MIAC dsPIC Clock.fcfx
(63.45 KiB) Downloaded 400 times
Please reply to my Private messages!
Best Regard
Monie

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by Monie Jacobsen »

Hello everyone
Is there anyone on Flowcode who will help with the above post!
Best Regard
Monie

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by LeighM »

Hi Monie,
Your problem could be a hardware issue, can you attach a circuit diagram?
e.g. I asked in your previous post about pull-ups on your RTC device.
Leigh

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by Monie Jacobsen »

HI LeighM
I do not understand;-)
After all, MIAC dsPIC Clock is a built-in device that has no external device connected...
Best Regard
Monie

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by LeighM »

Hi Monie,
I don't understand either :D
Are you using an MCP7940 RTC device connected to an Arduino Mega 2560 Rev3 board?
Or do you want to convert the MIAC dsPIC example into a MIAC Arduino version?

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by Monie Jacobsen »

Hi LeighM
Yes I thought I was going to convert to Arduino Mega 2560 Rev3 board? Can I do this?

I use MCP7940 RTC device connected to an Arduino Mega 2560 Rev3 board?

Do you have any suggestions?
RTC MCP7040N.JPG
RTC MCP7040N.JPG (42.95 KiB) Viewed 15629 times
Attached files:
SolarTrackerMega2560-R3 Test RTC.fcfx
(20.22 KiB) Downloaded 366 times
Best Regard
Monie

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by LeighM »

What is your hardware? Circuit?
How are you connecting the MCP7940 RTC device to the Arduino board?
You could use any pin with the Software channel, or for hardware channel 1 use:
SCL PD0 (DIGITAL PIN 21)
SDA PD1 (DIGITAL PIN 20)
And don't forget the pull-up resistors 8)

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by Monie Jacobsen »

Hi LeighM
Display LCD I2C works fine for EB092. Can write for display!
User: SDA to Port D1 and SCL to Port D0 - This works ;-)
And user hardware channel 1
And uses pull-up resistor...

User Component: RTC (MCP7940N) (Storage)

I have tried a lot but with no luck being able to adjust the time and date..
Please see Compiler Messages:

Code: Select all

Target folder: C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2
Source name:   C:\Users\sun\OneDrive\Documents\Mega 2560 LCD I2C NEW SolarTracker\SolarTrackerMega2560-R3 011.fcfx
Title:         My Project
Description:   Tillader brugere at give en detaljeret beskrivelse af projektet.
               Disse oplysninger vises i den genererede C-kode og i nogen af dokumentationsfunktionerne i Flowcode.
Device:        ARD.ATMEGA.ATMEGA2560
Generated by:  Flowcode v8.2.0.12
Date:          Wednesday, August 14, 2019 13:14:14
Users:         1
Registered to: monie jacobsen
License key: X6U4U7
https://www.matrixtsl.com
Launching the compiler...
C:\Program Files (x86)\Flowcode\Common\Compilers\avr\batchfiles\avra.bat  atmega2560 "C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.elf" "C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c" "C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.lst"

C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2>"C:\PROGRA~2\Flowcode\Common\COMPIL~1\avr\BATCHF~1\..\bin\avr-gcc.exe" -mmcu=atmega2560 -Os -ffunction-sections -fdata-sections -funsigned-char -o "C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.elf" "C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c" -lm -Wl,-gc-sections 
In file included from C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\includes.c:432,
                 from C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c:357:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_I2C.c:175:5: error: #error "This chip does not have I2C2 capability"
In file included from C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\includes.c:432,
                 from C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c:357:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_I2C.c: In function 'FC_CAL_I2C_Master_Start_1':
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_I2C.c:292: error: 'MX_I2C_START_X' undeclared (first use in this function)
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_I2C.c:292: error: (Each undeclared identifier is reported only once
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_I2C.c:292: error: for each function it appears in.)
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_I2C.c: In function 'FC_CAL_I2C_Master_Restart_1':
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\/AVR\AVR_CAL_I2C.c:339: error: 'MX_I2C_START_X' undeclared (first use in this function)
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c: In function 'main':
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c:3448: warning: passing argument 1 of 'FCD_06ae1_rtc1__GetTime' discards qualifiers from pointer target type
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c:3459: warning: passing argument 2 of 'FCM_GetTimeString' discards qualifiers from pointer target type
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c:3469: warning: passing argument 2 of 'FCM_GetDateString' discards qualifiers from pointer target type
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c:3484: warning: passing argument 3 of 'FCM_PrintTime' discards qualifiers from pointer target type
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 011.c:3493: warning: passing argument 3 of 'FCM_PrintDate' discards qualifiers from pointer target type

Error returned from [avr-gcc.exe]

C:\Program Files (x86)\Flowcode\Common\Compilers\avr\batchfiles\avra.bat reported error code 1

Autoclose turned off


FINISHED

Adjust Date.JPG
Adjust Date.JPG (37.84 KiB) Viewed 15598 times
Cannot get "20" inserted into Macro Print Date as exemplified in Display year "2019"

See attachment:
SolarTrackerMega2560-R3 012.fcfx
(49.1 KiB) Downloaded 342 times
Best Regard
Monie

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by Monie Jacobsen »

Hello everyone
Is there anyone here who will help get the Clock to work with the use of the Arduino Mega 2560 R3??????

Code: Select all

C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 012.c: In function 'main':
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 012.c:3360: warning: passing argument 1 of 'FCD_06ae1_rtc1__GetTime' discards qualifiers from pointer target type
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 012.c:3363: warning: passing argument 2 of 'FCM_GetTimeString' discards qualifiers from pointer target type
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 012.c:3379: warning: passing argument 1 of 'FCD_06ae1_rtc1__GetDate' discards qualifiers from pointer target type
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 012.c:3382: warning: passing argument 2 of 'FCM_GetDateString' discards qualifiers from pointer target type
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 012.c:3410: warning: passing argument 3 of 'FCM_PrintTime' discards qualifiers from pointer target type
C:\Users\sun\OneDrive\DOCUME~1\MEGA25~2\SolarTrackerMega2560-R3 012.c:3419: warning: passing argument 3 of 'FCM_PrintDate' discards qualifiers from pointer target type

Error returned from [avr-gcc.exe]

C:\Program Files (x86)\Flowcode\Common\Compilers\avr\batchfiles\avra.bat reported error code 1

Autoclose turned off
How do I fix these warning: passing argument?
Best Regard
Monie

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by LeighM »

Hi Monie,
The warnings can be ignored, they are not a problem.
The error is the problem, please set connection properites for the RTC component, it should then compile OK.

I am not sure that the two I2C devices will work well on the same pins, you might need to have these on separate pins if possible.
Leigh

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: MIAC dsPIC Clock to Arduino Mega 2560 R3

Post by Monie Jacobsen »

Hi LeighM
Yes` another Pin may be used...
Do you have a suggestion for another I2C device like a Web link?
All suggestions are very welcome...
Best Regard
Monie

Post Reply