theredkid
Newbie level 5
- Joined
- Apr 21, 2011
- Messages
- 10
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,353
Hello,
For the following code, I get some errors:
And error list is as follows:
What's wrong above???
For the following code, I get some errors:
Code:
#include <18F452.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
unsigned char FlagReg;
sbit ZC at FlagReg.B0;
void interrupt(){
if (INTCON.INTF){ //INTF flag raised, so external interrupt occured
ZC = 1;
INTCON.INTF = 0;
}
}
void main() {
PORTB = 0;
TRISB = 0x01; //RB0 input for interrupt
PORTA = 0;
ADCON1 = 7; //Disable ADC
TRISA = 0xFF; //Make all PORTA inputs
PORTD = 0;
TRISD = 0; //PORTD all output
OPTION_REG.INTEDG = 0; //interrupt on falling edge
INTCON.INTF = 0; //clear interrupt flag
INTCON.INTE = 1; //enable external interrupt
INTCON.GIE = 1; //enable global interrupt
while (1){
if (ZC){ //zero crossing occurred
delay_ms(2);
PORTD.B0 = 1; //Send a pulse
delay_us(250);
PORTD.B0 = 0;
ZC = 0;
}
}
}
And error list is as follows:
Clean: Deleting intermediary and output files.
Clean: Deleted file "p3.ESYM".
Clean Warning: File "D:\mehmet projeler\p1\p3.o" doesn't exist.
Clean: Deleted file "p3.ERR".
Clean: Deleted file "D:\mehmet projeler\p1\p3.mcs".
Clean: Done.
Executing: "C:\Program files\PICC\CCSC.exe" +FH "p3.c" +DF +LN +T +A +M +Z +Y=9 +EA
*** Error 48 "p3.c" Line 6(6,10): Expecting a (
*** Error 48 "p3.c" Line 6(12,14): Expecting a (
*** Error 43 "p3.c" Line 6(19,20): Expecting a declaration
*** Error 48 "p3.c" Line 6(20,22): Expecting a (
*** Error 12 "p3.c" Line 9(10,16): Undefined identifier INTCON
*** Error 12 "p3.c" Line 10(12,14): Undefined identifier ZC
*** Error 12 "p3.c" Line 11(9,15): Undefined identifier INTCON
*** Error 12 "p3.c" Line 16(12,17): Undefined identifier PORTB
*** Error 12 "p3.c" Line 17(12,17): Undefined identifier TRISB
*** Error 12 "p3.c" Line 18(12,17): Undefined identifier PORTA
*** Error 12 "p3.c" Line 19(13,19): Undefined identifier ADCON1
*** Error 12 "p3.c" Line 20(12,17): Undefined identifier TRISA
*** Error 12 "p3.c" Line 21(12,17): Undefined identifier PORTD
*** Error 12 "p3.c" Line 22(12,17): Undefined identifier TRISD
*** Error 12 "p3.c" Line 23(6,16): Undefined identifier OPTION_REG
*** Error 12 "p3.c" Line 24(6,12): Undefined identifier INTCON
*** Error 12 "p3.c" Line 25(6,12): Undefined identifier INTCON
*** Error 12 "p3.c" Line 26(6,12): Undefined identifier INTCON
*** Error 12 "p3.c" Line 29(16,18): Undefined identifier ZC
*** Error 12 "p3.c" Line 31(15,20): Undefined identifier PORTD
*** Error 12 "p3.c" Line 33(15,20): Undefined identifier PORTD
*** Error 12 "p3.c" Line 34(18,20): Undefined identifier ZC
22 Errors, 0 Warnings.
Build Failed.
Halting build on first failure as requested.
BUILD FAILED: Tue Sep 02 11:43:52 2014
What's wrong above???