RTC5 Library and Examples

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
HowardJ
Posts: 79
Joined: 31 Jan 2010 04:44

RTC5 Library and Examples

#1 Post by HowardJ » 17 Jul 2020 05:44

This is a question for the mE team
I have ordered, but do not have yet, an RTC5 click.
I have installed the RTC5 Library, in MicroC Pro
I opened the example Click_RTC_5_PIC.c
I copied the entire program, and pasted it into a new Project .C file
It is a mess of errors!
The first error is "can't find "Click_RTC_5_types.h"
The second is "can't find "Click_RTC_5_config.h"
These are followed by dozens of errors, which I assume, are related to the two include files, but not necessarily so.
I do not know where these files are! A search of the entire mE website cannot find them! I cannot find them on my computer!
This is a little annoying.
When mE shows a Sample C Program, I expect it to work.
I expect it to work, so that I can look into it, and learn from it.
I do not expect to change the program, debug the program, search for other parts of the program, or indeed, try to read the Author's mind.
I hope to hear some helpful reply.
Thank you
Howard
Howard

User avatar
filip.grujcic
Posts: 822
Joined: 14 May 2018 08:34

Re: RTC5 Library and Examples

#2 Post by filip.grujcic » 17 Jul 2020 11:07

Hello,

Why would you copy the code to a newly created project? The example includes additional header files and dependencies, it's perfectly normal you are getting errors when trying to compile only the code from the main .c file.
Look at the screenshot below, navigate to that project and open it. That's the example you have to run.

Screenshot_3.png
Screenshot_3.png (16.36 KiB) Viewed 1537 times
Hit Alt + F9 to recompile your project, if you are still getting errors, press Ctrl + Shift + P to open search paths and in the Sources section ( .c files) add the path to where mikroSDK is installed, default is:
C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for PIC\Packages\mikroBUS BDF API\Uses

Regards,
Filip Grujcic

HowardJ
Posts: 79
Joined: 31 Jan 2010 04:44

Re: RTC5 Library and Examples

#3 Post by HowardJ » 18 Jul 2020 01:45

OK, fair enough, but where in any documentation does it say, "navigate to such and such".
You have "Library Manager" in MicroPIC Pro. "Examples" would be a nice Tab to have there.
I'm not unfamiliar with the "Projects" process, but the "Help" process in the Library Manager in relation to RTC_5_ P18 does not even suggest that there is a Project somewhere in the rat's nest that is the average C Drive on a PC computer.
Filip, I am not inclined to make too many complaints about the products, other than documentation is a tad lacking. This has been mentioned by others in the Forums over more than the last ten years, that I have been a customer.
I also realise the huge job it must be to keep up with developments, and keep up with documentation at the same time.

Anyway, thanks for the reply.
Regards
Howard
Howard

HowardJ
Posts: 79
Joined: 31 Jan 2010 04:44

Re: RTC5 Library and Examples

#4 Post by HowardJ » 18 Jul 2020 03:22

OK, further.
The Project opens from the folder as you said.
It does not compile. Errors underlined are mikrobus_logWrite( " Monday ", _LOG_LINE ); etc. etc.
The error is:
file 'easypicpro_v7_P18F87K22.c' not found

The Library tick box for Mikro SDK Libraries\MicroBUS BDF API\easypicpro_v7_P18F87K22.c is Ticked.

The files DOES exist, as I have found it (among many others) at:
"c:\users \ public\public documents \ microc pro for PIC\packages \ microbus bdf api \ uses \ __easypicpro_v7_P18F87K22.c"
(The spaces before and after the \ are just for clarity.)

So, any ideas why the compiler cannot find this file which does exist?

For fun, I changed the chip via Project Settings to an 18F45K22.
This did not tick the box for MicroBUS BDF API \ easyPIC V7 PIC18F45K22, and compiling created a lot of errors like mikrobus_logWrite( " Monday ", _LOG_LINE ); etc.
Ticking the Box, and compiling, removed all the errors, but an error remained, file 'easypicpro_v7_P18F45K22.c' not found.
(How it couldn't find the file, but fixed the errors is a bit weird. Maybe the errors are still there, just not reported.)
Perhaps the path names are not correct somewhere.

I have not seen this sort of error before, as I've never deliberately used MicroBUS BDF API files in my projects.
This is all rather messy, but I'm not all that worried. If you want to pursue it, OK, but the example as it stands is not what I want, but the file certainly helps me build something that I do want.
Regards
Howard
Howard

User avatar
filip.grujcic
Posts: 822
Joined: 14 May 2018 08:34

Re: RTC5 Library and Examples

#5 Post by filip.grujcic » 22 Jul 2020 08:48

Hello,

You just have to add the path to the search paths.
Press Ctrl + Shift + P to open them, and in the upper section (source files) click on the three dots button (...), navigate to ...\Mikroelektronika\mikroC PRO for PIC\Packages\mikroBUS BDF API\Uses and click Select folder, then click on the Add button and then OK again to close the search paths window.
Rebuild your project (Alt + F9) and the error should be gone.

Regards,
Filip Grujcic

HowardJ
Posts: 79
Joined: 31 Jan 2010 04:44

Re: RTC5 Library and Examples

#6 Post by HowardJ » 25 Jul 2020 02:51

Yes, thank you, I did figure that out for myself, and that particular error did go away.
However, a new error has arrived...
82 324 Undeclared identifier 'mikrobus_spiInit' in expression Click_RTC_5_PIC.c
90 324 Undeclared identifier '_MIKROBUS1_SPI' in expression Click_RTC_5_PIC.c
If I comment these two out, it compiles successfully, so it seems they are the only two errors.
(I assume it won't actually work without these, but commenting out merely proves they are the only two errors.)

OK, so I looked for them, and found them in easypicpro_v7_p18f87K22.h (in ....\documents\mikroc for PIC\packages\MikroBUS bdf api\uses
I added this file as a header file. I added it with the full path to the original, and I added it as a copy to the Project folder.

Either way created more errors.
11 304 error: Can't open include file "__t_pic.h" #include "__t_PIC.h" from D:/Mikro/RTC/RTC5 Click/mE Example/Click_RTC_5_PIC.c: 34: #include "easypicpro_v7_P18F87K22.h" 1 error in preprocessor. d:\mikro\rtc\rtc5 click\me example\easypicpro_v7_p18f87k22.h
(Why these errors did not come up when I merely commented out the two previous errors, I have no idea!)

Anyway, this file exists in ....\documents\mikroc for PIC\packages\MikroBUS bdf api\uses
This folder is entered in the search paths.

Well......
The path was only added to the Sources Path. So, I added it to the Header Path, and it compiled!
OK, so far so good.
My next problem is I don't have any 87K22 chips. I have some 26K22, and I'm going to try and port the program across.
I feel less than confident.
OK, merely changing the PIC in Project Setting obviously didn't work, as the Include file names are wrong.
I will keep working at it, and may call on you again, if I may.
Regards.
Howard.
P.S. apologies if my frustrations were showing through.
Howard

User avatar
filip.grujcic
Posts: 822
Joined: 14 May 2018 08:34

Re: RTC5 Library and Examples

#7 Post by filip.grujcic » 28 Jul 2020 09:07

Hello,

If you wish to port the example to PIC18F26K22, I recommend you refer to this post:
https://www.mikroe.com/blog/mikrosdk-bo ... tion-files
Basically, since the example is written using mikroSDK you don't have to change the code at all, just write your own board def file for your MCU.
Alternative option would be to get the source code of the Click board's library and extract the functions from it, bypassing mikroSDK altogether. If you'd like me to send you the source code, please submit a support ticket on our helpdesk.

Regards,
Filip Grujcic

Post Reply

Return to “mikroC PRO for PIC General”