Hi everybody.
First of all, I have zero programing experince in any language.
So this may be a stupid question.
After reading and researching for a feew weeks I have decided to learn
c and starded with pic16f84a,
I found some code on the internet and tried to compile it but I get compiler errors-
This is the code
" #include <16F84A.h>
#use delay(clock=10000000)
#fuses NOWDT,HS, NOPUT, NOPROTECT
#use rs232(baud=1200,parity=N,xmit=PIN_A2,rcv=PIN_A3,bits=9)
void clockwait(void);
void main()
{
unsigned char byt; // Holds each byte received
setup_counters(RTCC_INTERNAL,RTCC_DIV_1);
while(1) // Loop forever...
{
byt=0; // Starting a new data frame
clockwait(); // Ignore start bit
for(t=0;t<8;t++) // Grab eight bits of data... LINE 21
{
clockwait();
byt|=input(PIN_A0)<<t;
}
clockwait(); // Ignore parity bit
clockwait(); // Ignore stop bit
putc(byt); // Send byte to the transmitter
} // ... rinse and repeat
}
clockwait()
{
// Waits for the next clock cycle...
while(!input(PIN_A1)); // Wait for clock to go HI
while(input(PIN_A1)); // Wait for clock to go LO
}
Thes are the errors I'm getting
"*** Error 12 "main.c" Line 21(11,12): Undefined identifier t
*** Error 12 "main.c" Line 21(16,17): Undefined identifier t
*** Error 12 "main.c" Line 21(21,22): Undefined identifier t
*** Error 12 "main.c" Line 24(33,34): Undefined identifier t
4 Errors, 1 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Wed Jul 09 22:50:02 2008"
After reading about this for a feew days I know that i need to declare
a variable "t" , but i can't get the exact hang of it .
any help wuld be highly appreciated.
P.S I'm using ccs pcm and Mplab IDE ver 8.10
cheers
First of all, I have zero programing experince in any language.
So this may be a stupid question.
After reading and researching for a feew weeks I have decided to learn
c and starded with pic16f84a,
I found some code on the internet and tried to compile it but I get compiler errors-
This is the code
" #include <16F84A.h>
#use delay(clock=10000000)
#fuses NOWDT,HS, NOPUT, NOPROTECT
#use rs232(baud=1200,parity=N,xmit=PIN_A2,rcv=PIN_A3,bits=9)
void clockwait(void);
void main()
{
unsigned char byt; // Holds each byte received
setup_counters(RTCC_INTERNAL,RTCC_DIV_1);
while(1) // Loop forever...
{
byt=0; // Starting a new data frame
clockwait(); // Ignore start bit
for(t=0;t<8;t++) // Grab eight bits of data... LINE 21
{
clockwait();
byt|=input(PIN_A0)<<t;
}
clockwait(); // Ignore parity bit
clockwait(); // Ignore stop bit
putc(byt); // Send byte to the transmitter
} // ... rinse and repeat
}
clockwait()
{
// Waits for the next clock cycle...
while(!input(PIN_A1)); // Wait for clock to go HI
while(input(PIN_A1)); // Wait for clock to go LO
}
Thes are the errors I'm getting
"*** Error 12 "main.c" Line 21(11,12): Undefined identifier t
*** Error 12 "main.c" Line 21(16,17): Undefined identifier t
*** Error 12 "main.c" Line 21(21,22): Undefined identifier t
*** Error 12 "main.c" Line 24(33,34): Undefined identifier t
4 Errors, 1 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Wed Jul 09 22:50:02 2008"
After reading about this for a feew days I know that i need to declare
a variable "t" , but i can't get the exact hang of it .
any help wuld be highly appreciated.
P.S I'm using ccs pcm and Mplab IDE ver 8.10
cheers