Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > Electronic Projects Design/Ideas/Reviews


Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution.

Reply
 
LinkBack Thread Tools Display Modes
Old 12th February 2008, 07:36 PM   (permalink)
Default Compiling C to Hex

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..
Attached Files
File Type: txt lock.txt (17.8 KB, 20 views)
slique is offline  
Old 12th February 2008, 08:04 PM   (permalink)
Default

Do you have a compiler that will assemble code for a PIC16F84?
__________________
We never have time to do it right; but we always have time to do it over.
Papabravo is offline  
Old 12th February 2008, 08:09 PM   (permalink)
Default

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 is offline  
Old 12th February 2008, 08:10 PM   (permalink)
Default

Try CCS C, where did you get the file from?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline  
Old 12th February 2008, 08:17 PM   (permalink)
Default

Quote:
Originally Posted by slique
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.
__________________
We never have time to do it right; but we always have time to do it over.
Papabravo is offline  
Old 12th February 2008, 08:19 PM   (permalink)
Default

i got it from vermont ficks website.. ok i'll try to compile it using CCS C..
slique is offline  
Old 12th February 2008, 08:23 PM   (permalink)
Default

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
3v0 is online now  
Old 12th February 2008, 08:34 PM   (permalink)
Default

Hmm well CCS C is on the site where the code came from. You could try contacting the site owner.
http://www.vermontficks.org/pic.htm
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline  
Old 12th February 2008, 10:17 PM   (permalink)
Default

Quote:
Originally Posted by blueroomelectronics
Hmm well CCS C is on the site where the code came from. You could try contacting the site owner.
http://www.vermontficks.org/pic.htm
It looks like some one tried to get CCS code to work with another compiler. It no longer works with CCS. Doubt it works with either.
3v0 is online now  
Old 13th February 2008, 04:36 AM   (permalink)
Default

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 by slique; 13th February 2008 at 04:55 AM.
slique is offline  
Old 13th February 2008, 11:00 AM   (permalink)
Default

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?

Quote:
Originally Posted by slique
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 by 3v0; 13th February 2008 at 11:30 AM.
3v0 is online now  
Old 13th February 2008, 11:28 AM   (permalink)
Default

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.
slique is offline  
Old 13th February 2008, 11:39 AM   (permalink)
Default

Quote:
Originally Posted by slique
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.

Quote:
Originally Posted by CCS
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.
3v0 is online now  
Old 13th February 2008, 12:01 PM   (permalink)
Default

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?
slique is offline  
Old 13th February 2008, 12:26 PM   (permalink)
Default

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

Quote:
#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 by 3v0; 13th February 2008 at 12:43 PM.
3v0 is online now  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Intel Hex to ASM converter please devura Micro Controllers 3 8th February 2008 01:04 PM
Help needed ASM to HEX with MPLAB Virus Micro Controllers 39 26th December 2007 04:30 PM
How a Hex code is operated in u-controller? ibrar0 Micro Controllers 11 30th November 2007 09:15 PM
HEX switch OY2L Micro Controllers 2 9th November 2007 12:49 AM
SimuLink and RTW compiling custom S-function Styx General Electronics Chat 0 25th February 2004 03:51 PM



All times are GMT. The time now is 07:17 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

eXTReMe Tracker