Compiling C to Hex

Status
Not open for further replies.

slique

New Member
Hello,
I have problem compiling this file to Hex. Can anyone here help me to compile this file..i really need to finish this project..
 

Attachments

  • lock.txt
    17.8 KB · Views: 612
i already try to compile it using sourceboost IDE, but theres a lot of "illegal directive" and i don't know how to solve it.. so can anybody help me.. i think there is nothing wrong with the coding..but i still can't compile it..
 
slique said:
i already try to compile it using sourceboost IDE, but theres a lot of "illegal directive" and i don't know how to solve it.. so can anybody help me.. i think there is nothing wrong with the coding..but i still can't compile it..
"illegal directive" sounds like an assembly language thing. You need a C compiler. Follow Bill's advice.
 
This is not strictly CCS C.

For example the header in the code is PIC16F84.h but CCS uses 16F84.h


This is CCS

Code:
#use delay ( clock = 4000000, restart_wdt )      /* sets appropriate compiler constants */
#use fast_io ( A )              /* don't set TRIS on each I/O statement */
#use fast_io ( B )

This is not CCS which uses the $fuse directive

Code:
/* Set configuration bits in the PIC processor */
#pragma XT, NOPROTECT, WDT, PUT
 
oh yes...i think it is my mistake.. i try to modified a little so it can work with sourceboost..

i already download the CCS C compiler at CCSinfo.com.. but when i try to compile the the code i found 5 error.. that is

***Error 18 'Lock.c" Line 1(9,18): File can not be opened
Not in "C:\Program Files\PICC\devices\16F84.h"
Not in "C:\Program Files\PICC\drivers\16F84.h"
Not in "C:\Program Files\PICC\devices\16F84.h"
Not in "C:\Program Files\PICC\drivers\16F84.h"
Not in local "C:\New Folder\16F84.h
***Error 111 'Lock.c" Line 4(7,31): unknown keyword in #FUSES "PUT"
***Error 99 'Lock.c" Line 35(5,75): Option invalid Not a valid port: A
etc..

i think the problem is, i don't know how to compile the file correctly..

why they can't find 16F84.h?
 
Last edited:
Copy file from C:\program files\PICC\devices\16F84.h to C:\New Folder.
Without the source code anything else would be guessing. Post it!

EDIT: I found the code on the authors site.
It was written for a 16F628A.h and you are trying to use a 16F84, why?

You may also need jonsinc.h from the same place you found the C source.

Do you want to learn how to use microprocessors or just build this one project?

 
Last edited:
thanks for the tips but i can't find 16f84.h in the folder you mention above.. maybe its because mine is demo version only.. can any body attach the 16f84.h file from ccs c here? because when download 16f84.h from the internet, the compiler detect a lots of error.
 

I do not think CCS made it that easy for you to defeat the limitations and I will not help you do so.

CCS said:
The demo is a limited PCWHD compiler for the Microchip PIC®mcu's: 14-bit PIC16F877, 14-bit PIC16C544, 16-bit PIC18F458, and all 24-bit dsPIC30/dsPIC33/PIC24 DSCs. The demo compiler is licensed for 30 days and has a 2k program size limit.
Also I would think the 16F84.h is copyrighted.

I could compile the authors original code and post a HEX file for you but it would only work on the PIC16F628A. Can you get/use a PIC16F628A.
 
Thank you. But I got PIC16F628.Is there any different? When i use this PIC, do i have to make any change to the circuit?
 
My Mistake.

I was looking at the wrong project on the authors site.

COMBO2.C does use the 16F84

But it has other problems that cause it not to compile.
It may build in the authors environment but it does not on mine.
Some stem from having to copy the code from a HTML file.

The show stopper is
*** Error 7 "C:\Documents and Settings\webmaster\Desktop\helpout\combo2.c" Line 481(39,92): Invalid Pre-Processor directive

The line in question is

#int_rtcc void TimerInterrupt ( void ) /* 65mS tic */

The CCS manual shows #int_rtcc to be valid and I doubt the author would have used it if it did not exist. This one has me stumped. Given time I could find out what is wrong. Do not have the time to do it just now.

If you are new to micro controllers and want to learn to use them or build projects with them I suggest you find a project that either uses a free/demo compiler or better yet provides the HEX code. Stay away from the 16F84 as it is a very old (and now expensive) chip.

Feel free to ask questions here when selecting a project.
 
Last edited:
So is there any solution to this..i already sent an email to the author 5days ago but still no reply...

Is there any free alternative for CCS compiler.. i really need to finish this project..
 
See my previous post. I Edited it since you read it.

You could port it to a free compiler or a compiler that you have.

To do that you need to understand the code. I do not think you are there yet.

Is this a school project ?
 
The solution is to search the net for a combo lock project that has the HEX file along with the schematic. Then you will not have to compile/build it.

Many people have built similar projects, I am sure you can find one with fewer problems.
 
its actually my home project.. i choose this combo lock project because it has multiple combination password compared to other that only have one.. so i really need this project..
 
ok, i manage to get the compiler.. but what is wrong with this

#int_rtcc void TimerInterrupt ( void ) /* 65mS tic */

*** Error 7 "C:\Documents and Settings\webmaster\Desktop\helpout\combo2.c" Line 481(39,92): Invalid Pre-Processor directive

how to correct this?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…