|
|
View previous topic :: View next topic |
Author |
Message |
Negentropy Guest
|
12f675.h error problem |
Posted: Sat Aug 08, 2009 6:08 am |
|
|
Hi there my name is Ivan. I am not so good of ccs programing but I give my best
I read alot this forum and I learned much thanks to all of you.
And eventually I want to make simple wireless transmitter-receiver. So I made a code and I have elements to create a board but I have error in code.
Can u guys help me ?
my vertion of ccs is : 4.065
and here is my RX code:
Code: | // simple Transimiter
#include <12F675.h>
#FUSES NOWDT // No Watch Dog Timer
#FUSES INTRC_IO // Internal RC Osc, no CLKOUT
#FUSES NOCPD // No EE protection
#FUSES NoPROTECT // No Code protected from reading
#FUSES NOMCLR // Master Clear pin enabled
#FUSES PUT // Power Up Timer
#FUSES NOBROWNOUT // No Reset when brownout detected
#use delay(clock=4000000)
#define reset 0 //global constants
#define start 1
//----------------------------------------------------------
int data_tx; // global variable
//-----------------------------------------------------------
#int_timer0
void timer0_isr(void)
{
disable_interrupts(int_timer0);
if(!input(PIN_A1) || !input(PIN_A2))
{
delay_ms(10);
if(!input(PIN_A1) || !input(PIN_A2)) // butons
{
if(!input(PIN_A1))
data_tx = reset;
if(!input(PIN_A2))
data_tx = start;
}
}
enable_interrupts(int_timer0);
}
//--------------------------------------------------------------------
void main (void)
{
data_tx = reset;
set_tris_a(0x06); //pin_a1 and pin_a2 are inputs...all other are outputs
setup_adc_ports (NO_ANALOGS);
setup_timer_0(rtcc_internal|rtcc_div_32);
set_timer0(96);
while(1)
{
if (data_tx == start)
{
output_high(PIN_A0);
delay_ms (1000)
output_low(PIN_A0); //create simple pulse sequence for starting
delay_ms (200)
output_high(PIN_A0);
delay_ms (200)
output_low(PIN_A0);
}
if (data_tx == reset)
{
output_high(PIN_A0);
delay_ms (2200) // create 1 longer inpulse for reset
output_low(PIN_A0);
}
}
} |
And this is my RX code:
Code: | // simple Receiver
#include <12F675.h>
#FUSES NOWDT // No Watch Dog Timer
#FUSES INTRC_IO // Internal RC Osc, no CLKOUT
#FUSES NOCPD // No EE protection
#FUSES NoPROTECT // No Code protected from reading
#FUSES NOMCLR // Master Clear pin enabled
#FUSES PUT // Power Up Timer
#FUSES NOBROWNOUT // No Reset when brownout detected
#use delay(clock=4000000)
#define reset 0 //global constants
#define start 1
//----------------------------------------------------------
int enable;
//--------------------------------------
void main (void)
{
set_tris_a(0x01); // pin_a0 is input other are ouputs
enable = reset;
while (1)
{
output_low(PIN_A1);
if(PIN_A0)
delay_ms (1100)
if(!PIN_A0) // check start pulse sequence
delay_ms(200)
if(PIN_A0)
enable = start;
if (PIN_A0)
delay_ms (2000) // check reset logic
if (PIN_A0)
enable = reset;
output_bit( PIN_A0, enable);
}
} |
Next is exactly the error that I have:
**error 18 "RX.c" line 0(0,1) file can not be opened
I've searched for 12f675.h in C:\Program Files\PICC\Devices and I have it so what is the problem. Is it my code or something else ?
Thank you
Ivan |
|
|
Ttelmah Guest
|
|
Posted: Sat Aug 08, 2009 8:44 am |
|
|
There are several faults in the posted code.
No ';' at the end of the delay lines.
You can't just 'test' pins, with 'if(PIN_A0)' for example. You need to read the pin (input.....).
Now, with those fixed, the code compiles as posted, with your compiler version.
If you look, the error, is on the first character of line 0. Reading 12f675.h, is being done on the next line, so the problem is not here. How are you trying to compile this? In the PCW enviromnent?. From the command line?. From the Microchip IDE?. It actually looks as if the file 'RC.c', doesn't exist, or is not marked as readable, or as if lyou are perhaps loading some other file without realising (common problem in the MicroChip IDE, if not setup correctly).
Best Wishes |
|
|
Negentropy Guest
|
|
Posted: Mon Aug 10, 2009 2:55 pm |
|
|
Thanks man
Just now I have time to see comment, and to fix my newbie mistakes :D
When I saw your post I've checked your version but everything was fine.. next I asked myself how I start that code: just create new text document and rename it in RX.c next I typed the code.
I figure that: it will be great to create project :D ... so when I create one, all problems just gone. I feel very stupid
Thanks for the help !
best regards Ivan Angelov |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|