Hahahaha! These things are all SOOO urgent. Hehehe! What happened? Did you leave your class assignment till the last couple days before it's due? Good luck with learning C in a couple days.
Anyway, what you're looking for is a C compiler. I recommend SourceBoost BoostC. The demo is only code size/RAM limited - works for all supported PICs. And when you hit the limits of the demo, a full license for the compiler is only about $75! Compare with C18's price of ~$500 and PICC's price of ~$1000. It's a no brainer! Better yet, BoostC comes with both 16F (supports some 12F also) and 18F compilers.
can u explain to me more about this "SourceBoost BoostC."... does it writes C codes straight to PIC? By da way, i've done with writing on C.... i just don't know how to "burn-to-project" part.... kinda sucks at these thing..
Really! I think you're the first to actually admit it here though.
can u explain to me more about this "SourceBoost BoostC."... does it writes C codes straight to PIC? By da way, i've done with writing on C.... i just don't know how to "burn-to-project" part.... kinda sucks at these thing..
Who wrote your source code? What compiler did they write it for? You may be better off to get that compiler to save you having to port the source code to suit a different compiler's syntax. They all have their own ways of doing things. It's still C, but there are compiler-specific syntax differences (include file equates, etc.). If it's a small program it's not a big deal, but if it's large it can be quite a chore.
Anyway, to program a chip you install the compiler, being sure that it gets integrated into MPLAB properly. Then start MPLAB and run the Project Wizard. Make a new project for your chip and select the compiler you just installed as the toolsuite. Add the necessary files to the project to suit your compiler (BoostC wants the appropriate lib file added) and also add the source file (put both the source and any associated header files in the project dir first).
Select your programmer (assuming it's MPLAB compatible) and compile. Then program the chip. If your programmer is not MPLAB compatible you may have to run a different program to program the chip. The hex file will be in the project directory you created before compiling.
when i tried compile this program using Sourceboost, it will show this error..
""C:\Program Files\SourceBoost\boostc.pic16.exe" -t PIC16F876A test.c
BoostC Optimizing C Compiler Version 6.89 (for PIC16 architecture) SourceBoost Technologies - Home of BoostC Free PIC C Compiler and BoostBasic Free Pic Basic Compiler
Copyright(C) 2004-2008 Pavel Baranov
Copyright(C) 2004-2008 David Hobday
Single user Lite License (Unregistered) for 0 node(s)
Limitations: PIC12,PIC16 max code size:2048 words, max RAM banks:2, Non commercial use only
test.c
C:\Documents and Settings\FysL\Desktop\Source Code\test\test.c(10): Unable to open include file: pic.h
1 errors detected
failure
Error: preprocessing error
Failed to locate output file 'test.obj'
Done
Failed"
it means it can't find the file pic.h. If you look at the top of your c or h files there will be a line that states #include <pic.h>. The pic.h file is included with the compiler, though different compilers will call it by a slightly different name. Your source code is apparantly not written for sourceboost. You could either rewrite it or change compilers. Given the questions you're asking, I think you should figure out what compiler this code was written for, most likely microchip's c18 compiler. Download it from microchip.com
Or you could do it the old fashioned way: compile by hand ( convert C to assembly ), assemble by hand ( look up all the hex codes in an instruction code table ), and then enter them all into a .hex text file.
Of course when I learned it I had to enter them manually into a hex keypad.
Given the questions you're asking, I think you should figure out what compiler this code was written for, most likely microchip's c18 compiler. Download it from microchip.com
Or you could do it the old fashioned way: compile by hand ( convert C to assembly ), assemble by hand ( look up all the hex codes in an instruction code table ), and then enter them all into a .hex text file.
Of course when I learned it I had to enter them manually into a hex keypad.
can someone convert these code to asm and hex...
i dont think i'm capable to do this anymore...
i've trying for a month and using many compilers...
and i have to send this thing on 8/11..
please help me on these one...
if someone want to help me...
i will post the code here..
thank you..
Your code is almost certainly written for Hi-Tech's PICC compiler, which uses the pic.h header.
To change that for BoostC you would use system.h. All this stuff is in the manual.
Here's the first lines of a typical BoostC program for an 18F448. The CLOCK_FREQ will have to be adjusted to suit your setup. The configs will be different for 16F's. A 16F will usually have only one line.
Code:
#include <system.h>
#pragma CLOCK_FREQ 20000000
#pragma DATA _CONFIG1H, _HS_OSC_1H
#pragma DATA _CONFIG2H, _WDT_OFF_2H
#pragma DATA _CONFIG4L, _LVP_OFF_4L
void main(void)
{
int i;
trisc=0;
while(1){
for(i=0;i<256;i++){
latc.3=1;
delay_10us(i);
latc.3=0;
delay_ms(5);
}
delay_ms(50);
Here's the first lines of a typical BoostC program for an 18F448. The CLOCK_FREQ will have to be adjusted to suit your setup. The configs will be different for 16F's. A 16F will usually have only one line.
Code:
#include <system.h>
#pragma CLOCK_FREQ 20000000
#pragma DATA _CONFIG1H, _HS_OSC_1H
#pragma DATA _CONFIG2H, _WDT_OFF_2H
#pragma DATA _CONFIG4L, _LVP_OFF_4L
void main(void)
{
int i;
trisc=0;
while(1){
for(i=0;i<256;i++){
latc.3=1;
delay_10us(i);
latc.3=0;
delay_ms(5);
}
delay_ms(50);
Replace the pic.h header line in your program with the system.h one. Then you'll have to make some other changes to suit differences in how the two compilers name things like registers, and how they access bits in registers.
Then you'll have to make some other changes to suit differences in how the two compilers name things like registers, and how they access bits in registers.
can someone convert these code to asm and hex...
i dont think i'm capable to do this anymore...
i've trying for a month and using many compilers...
and i have to send this thing on 8/11..
You'll find quite a bit of simple "example" BoostC code at my web-site. With that and the BoostC manual you should be able to figure out the changes to make.