Compiling source code question.

Hello Fella's

I have built this clock project and it is now operational. In fact it works great. The author passed along the hex files to me to program it. And I was successful with it as well. But, I would like to change it to a 24 hour display and that will require just one small update in this code,

formatting link

I would like to try this myself but I'm not exactly sure how to get this code into an acceptable format that a compiler would understand and process.

Can I just copy it to notepad, and then save it as is? Should it have the .c suffix ? With a name for example like clockmaster24.c? directly converted from a .txt file. I dunno. I guess I would just like to see it work.

Also, The Microchip PICkit2 that you guys recommended was perfect for my first programming job! All of it was had for just under $60.00.

Thank you in advance

Mike Burch

Apache Junction, AZ

Reply to
Mike Burch
Loading thread data ...

Hello Mike,

As per the web site you quoted:

formatting link

It states that the author is using: " It was written to compile using the CCS PIC C compiler. "

Do you have this compiler ??

Without that compiler, your code changes will not mean anything.

donald

Reply to
donald

Hi Donald,

THank you for the reply. I am very grateful.

This was also posted there;

It is written to compile using the CCS PIC C compiler. However, the code is written to conform to ANSI C standards and will recompile on most platforms (with the exception of hardware dependent compiler directives).

I don't know exacly what this means but I thought it would work most of the time on different compilers. I am probably wrong however.

I do not have the compiler myself but I sure would like to get this update in hex form. Am I wrong about the source code being readable on different compilers?

Thanks again for your reply.

Mike Burch

Apache Junction, AZ

Reply to
Mike Burch

First check if they got a free version (it might have time or code size limits but I don't think clock code takes much space). Most compilers have a free/trial version. "HI-TECH now produces a FREE C compiler that supports all PIC10/12/16 devices with NO memory or time restrictions" - that's quoted straight from Microchip website.

Tom

Reply to
Tom

Thank you for the reply Tom, My first problem is that I am unsure if I am creating a file that is compilable in the first place. Is it really a source file or is it a mis-named text file. For example, if you had a known good working complier what would you do with the posted source code in order to make it run? This is where I am missing it.

Thanks a lot

Mike Burch

Reply to
Mike Burch

... snip ...

A C (or any other language) source file is simply a text file. Basically you run the compiler, telling it where to find the source, and it converts it. The compiler documentation should tell you anything peculiar about your system.

For example, it I am compiling something here, I will have the source in source.c (a text file), and run gcc with:

$ gcc source.c

if successful there will be no extra messages, and the result will appear in the file a. If I don't like this I can rename the output, or tell gcc where to put it in the first place by using:

$ gcc -o results source.c

and the output will be in 'results'.

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.
Reply to
CBFalconer

This project uses a PIC18F252. Microchip have free tools for this.

A PDF getting started guide can be had here:

formatting link

and the Microchip page is here:

formatting link

I have not used either of these but the information you will need seems largely to be there, including how to set up the development environment, create a project and compile it.

Pete

Reply to
Peter Harrison

There's really no difference. C source files are text files that instead of the filename ending with .txt, the filename traditionally ends in .c instead. You can load it into and edit it with any text editor.

Reply to
Ben Bradley

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.