Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Hi Tech compiler error P1.exe stopped working

Status
Not open for further replies.

technocrate

Newbie level 4
Joined
Jan 17, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
USA
Activity points
1,366
Hello,

I am using the PICC lite ver 9.83 version compiler and when I compile it is giving me a compile error "P1.exe stopped working"
And another message shows that my P1 is out of date? what does this means?

Thanks in advance
 

Your code maybe utilizing legacy headers. You can determine if this is indeed the issue by adding the following #define macro:

Code:
[COLOR="#FF0000"]#define _LEGACY_HEADERS[/COLOR]
#include <htc.h>

Ensure the #define is inserted into your code before the "#include <htc.h>.

Or add the #define macro using the Compiler Define Macros Dialog and adding "_LEGACY_HEADERS":




After adding the #define macro, recompile your code.



It the issue persists, post your code using code or syntax tags so that one of us may examine it.



BigDog
 

Thanks BigDog but that did not work and I tried to recompile several times with no success.
Here is my code as you suggested to post it.

Program description: Basically the 12F683 is driving two 5V relays on GP0 and GP1 with the help of two 2n7000 Mosfets.
The program runs on of four conditions based upon the setting of the two DIP switches SW1(GP5) and SW0(GP4). And an output of the PIR(Infrared detector) will be applied to GP2 which will cause an interrupt and is serviced by the isr.



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// *********************************************************************************************************************************/
// FILE NAME:witness.c
// Version: 1.0
// Compiler HI-Tech PICC-Lite version 9.83
// Compiled using MPLAB IDE v8.80 of microchip
// Processor: PIC12F683 8 pins
// Date: June 22, 2012
// ********************************************************************************************************************************/
 
// Global includes
#define _LEGACY_HEADERS
#include <htc.h>
 
// Fuse configuration for the PIC12F683
__CONFIG(FCMEN_OFF & IESO_OFF & BOREN_OFF & CP_OFF & MCLRE_OFF &
    PWRTE_OFF & WDTE_OFF & FOSC_INTOSCIO);
 
// Define oscillator frequency
#define _XTAL_FREQ 4000000
 
// Hardware mapping definitions
#define SHOOT   GPIO.0   //GP0
#define POWER   GPIO.1   //GP1
#define SW0 GPIO.4       //GP4
#define SW1 GPIO.5      //GP5
 
// Globals for Seconds Counter
unsigned char uSecCounter = 0; // Micro Seconds Counter
unsigned char SecCounter = 0;  //Seconds Counter
unsigned char MinCounter = 0;  //Minutes Counter
unsigned char FiveMinCounter = 0; //5Min Counter
 
 
// Interrupt Service Request handler
void interrupt isr()
{
    // Is this timer1 interrupting? 
    if (TMR1IF) // If the Interrupt Flag = 1 then do...
    {
        // Update the uSeconds Counter
        uSecCounter++; //Increment uSecCounter by one until 20 pulses are counted then its 1 sec. 
        
        // Update Secounds Counter
        if (uSecCounter > 20) // If the uSecCounter has counted 20 then its One Sec. 
        {
        uSecCounter = 0; // Reset the uSec Counter to Zero
        SecCounter++;    // Increment Seconds Counter
        }
 
        // Update the Minutes Counter
        if (SecCounter > 60) 
        {
        SecCounter = 0; // If the SecCounter has reached 60, reset it first and increment Minutes Counter.
        MinCounter++;
        }
 
        // Update the 5Minutes Counter
        if (MinCounter > 5) 
        {
        MinCounter = 0; // If the MinCounter has reached 5, then reset it first and increment 5Minutes Counter.
        FiveMinCounter++;
        }
        
        // Check to see if 10 minutes have passed. 
        if (FiveMinCounter > 1) 
        {
        FiveMinCounter = 0; // If the 5MinCounter has reached 2 then its 10 minutes have passed, then reset it.
        }
 
        // Reset the timer1 counter bytes
        TMR1H = 0x3C;
        TMR1L = 0xB0;
 
        // Reset the timer1 interrupt flag
        TMR1IF = 0;
    }
}
 
 
// Main procedure
void main(void)
{
    OSCCON = 0b01100001;    // 4Mhz INT OSC
    
    // Set up the PIC12F683 IO pins
    GPIO   = 0b00110100;    // Set all GPIO pins to Output except GP2(PIR), GP4(SW0) and GP5(SW1) as Input 
    ANSEL  = 0b00000000;    // Disable analogue inputs
    TRISIO = 0b00000100;    // Set all IO pins to output except GP2 which is input
    OPTION_REG = 0b00000000;// Set the option register
    WPU    = 0b00000000;    // Set weak pull-up off on all pins
    CMCON0 = 7;             // Disable comparator 0
 
    // Set up the TIMER1 (16 bit timer, and a max count = 65,536)
    TMR1IF = 0; // Reset the timer1 interrupt flag
    nT1SYNC =  0; // nT1SYNC as I check it against PIC12F683 header file 
    T1CON = 0b00000001;
    TMR1IE = 1; // Turn on the timer1 interrupt
    TMR1H = 0x3C;
    TMR1L = 0xB0;
    
    // Enable the interrupts
    PEIE = 1;
    GIE = 1;
 
    // Main loop
    while(1)
    {
        
    //Read Input Switches
    //SW1 SW0
    // 00   = AUTO MODE with PIR
    // 01   = Fix Mode: Shot every 10 Sec
    // 10   = Fix Mode: Shot every 30 Sec
    // 11   = Fix Mode: Shot every 1 Minute
    
    // Read the DIP switch settings
    
    If(SW1==0 && SW0==0){  // I am having trouble with this line of code????? 
    // AUTO MODE
    // This would be external interrupt trigger driven code
    // Turn Power ON
    //  POWER = 1;
    // Delay 3 usec
    __delay_ms(3000);
    // Take a shot
    //  SHOOT = 1;
    // Wait for it to be saved on the SD Card
    __delay_ms(3000);
    }
    Else if(SW1==0 && SW0==1){
    //Fix Mode: Shot every 10 sec
    // Turn Power ON
    //POWER = 1;
    // Delay 3 usec
    //__delay_s(3);
    //If(SecCounter >0)
    //{
    // Take a shot
    //SHOOT = 1;
    // Wait for it to be saved on the SD Card
    //__delay_s(3);
    }
 
    Else if(SW1==1 && SW0==0){
    //Fix Mode: Shot every 30 sec
    //
    }
    Else(SW1==1 && SW0==1){
    //Fix Mode: Shot every 1 Minute
    //
    }
    }//While loop end
} // Main loop

 
Last edited by a moderator:

You have a few syntax errors and undefined macros:

Code:
// *********************************************************************************************************************************/
// FILE NAME:witness.c
// Version: 1.0
// Compiler HI-Tech PICC-Lite version 9.83
// Compiled using MPLAB IDE v8.80 of microchip
// Processor: PIC12F683 8 pins
// Date: June 22, 2012
// ********************************************************************************************************************************/
 
// Global includes
// #define _LEGACY_HEADERS   // Not Necessary, Syntax Errors
#include <htc.h>
 
// Fuse configuration for the PIC12F683
__CONFIG(FCMEN_OFF & IESO_OFF & BOREN_OFF & CP_OFF & MCLRE_OFF &
    PWRTE_OFF & WDTE_OFF & FOSC_INTOSCIO);
 
// Define oscillator frequency
#define _XTAL_FREQ 4000000
 
// Hardware mapping definitions
#define SHOOT   [COLOR="#FF0000"]GP0[/COLOR]   //GP0
#define POWER   [COLOR="#FF0000"]GP1[/COLOR]   //GP1
#define SW0   [COLOR="#FF0000"]GP4 [/COLOR]      //GP4
#define SW1   [COLOR="#FF0000"]GP5[/COLOR]      //GP5
 
// Globals for Seconds Counter
unsigned char uSecCounter = 0; // Micro Seconds Counter
unsigned char SecCounter = 0;  //Seconds Counter
unsigned char MinCounter = 0;  //Minutes Counter
unsigned char FiveMinCounter = 0; //5Min Counter
 
 
// Interrupt Service Request handler
void interrupt isr()
{
    // Is this timer1 interrupting? 
    if (TMR1IF) // If the Interrupt Flag = 1 then do...
    {
        // Update the uSeconds Counter
        uSecCounter++; //Increment uSecCounter by one until 20 pulses are counted then its 1 sec. 
        
        // Update Secounds Counter
        if (uSecCounter > 20) // If the uSecCounter has counted 20 then its One Sec. 
        {
        uSecCounter = 0; // Reset the uSec Counter to Zero
        SecCounter++;    // Increment Seconds Counter
        }
 
        // Update the Minutes Counter
        if (SecCounter > 60) 
        {
        SecCounter = 0; // If the SecCounter has reached 60, reset it first and increment Minutes Counter.
        MinCounter++;
        }
 
        // Update the 5Minutes Counter
        if (MinCounter > 5) 
        {
        MinCounter = 0; // If the MinCounter has reached 5, then reset it first and increment 5Minutes Counter.
        FiveMinCounter++;
        }
        
        // Check to see if 10 minutes have passed. 
        if (FiveMinCounter > 1) 
        {
        FiveMinCounter = 0; // If the 5MinCounter has reached 2 then its 10 minutes have passed, then reset it.
        }
 
        // Reset the timer1 counter bytes
        TMR1H = 0x3C;
        TMR1L = 0xB0;
 
        // Reset the timer1 interrupt flag
        TMR1IF = 0;
    }
}
 
 
// Main procedure
void main(void)
{
    OSCCON = 0b01100001;    // 4Mhz INT OSC
    
    // Set up the PIC12F683 IO pins
    GPIO   = 0b00110100;    // Set all GPIO pins to Output except GP2(PIR), GP4(SW0) and GP5(SW1) as Input 
    ANSEL  = 0b00000000;    // Disable analogue inputs
    TRISIO = 0b00000100;    // Set all IO pins to output except GP2 which is input
    OPTION_REG = 0b00000000;// Set the option register
    WPU    = 0b00000000;    // Set weak pull-up off on all pins
    CMCON0 = 7;             // Disable comparator 0
 
    // Set up the TIMER1 (16 bit timer, and a max count = 65,536)
    TMR1IF = 0; // Reset the timer1 interrupt flag
    nT1SYNC =  0; // nT1SYNC as I check it against PIC12F683 header file 
    T1CON = 0b00000001;
    TMR1IE = 1; // Turn on the timer1 interrupt
    TMR1H = 0x3C;
    TMR1L = 0xB0;
    
    // Enable the interrupts
    PEIE = 1;
    GIE = 1;
 
    // Main loop
    while(1)
    {
        
    //Read Input Switches
    //SW1 SW0
    // 00   = AUTO MODE with PIR
    // 01   = Fix Mode: Shot every 10 Sec
    // 10   = Fix Mode: Shot every 30 Sec
    // 11   = Fix Mode: Shot every 1 Minute
    
    // Read the DIP switch settings
    
   [COLOR="#FF0000"] i[/COLOR]f(SW1==0 && SW0==0){  // I am having trouble with this line of code????? 
    // AUTO MODE
    // This would be external interrupt trigger driven code
    // Turn Power ON
    //  POWER = 1;
    // Delay 3 usec
    __delay_ms(3000);
    // Take a shot
    //  SHOOT = 1;
    // Wait for it to be saved on the SD Card
    __delay_ms(3000);
    }
    [COLOR="#FF0000"]e[/COLOR]lse if(SW1==0 && SW0==1){
    //Fix Mode: Shot every 10 sec
    // Turn Power ON
    //POWER = 1;
    // Delay 3 usec
    //__delay_s(3);
    //If(SecCounter >0)
    //{
    // Take a shot
    //SHOOT = 1;
    // Wait for it to be saved on the SD Card
    //__delay_s(3);
    }
 
    [COLOR="#FF0000"]e[/COLOR]lse if(SW1==1 && SW0==0){
    //Fix Mode: Shot every 30 sec
    //
    }
    [COLOR="#FF0000"]e[/COLOR]lse [COLOR="#FF0000"]if[/COLOR](SW1==1 && SW0==1){       
    // Either "else" without conditional test or "else if" with conditional test
    //Fix Mode: Shot every 1 Minute
    //
    }
    }//While loop end
} // Main loop

The following code compiles without warnings or errors using compiler v9.83:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// *********************************************************************************************************************************/
// FILE NAME:witness.c
// Version: 1.0
// Compiler HI-Tech PICC-Lite version 9.83
// Compiled using MPLAB IDE v8.80 of microchip
// Processor: PIC12F683 8 pins
// Date: June 22, 2012
// ********************************************************************************************************************************/
 
// Global includes
//#define _LEGACY_HEADERS  // Not Necessary, Mainly Syntax Errors
#include <htc.h>
 
// Fuse configuration for the PIC12F683
__CONFIG(FCMEN_OFF & IESO_OFF & BOREN_OFF & CP_OFF & MCLRE_OFF &
    PWRTE_OFF & WDTE_OFF & FOSC_INTOSCIO);
 
// Define oscillator frequency
#define _XTAL_FREQ 4000000
 
// Hardware mapping definitions
#define SHOOT   GP0   //GP0
#define POWER   GP1   //GP1
#define SW0 GP4       //GP4
#define SW1 GP5      //GP5
 
// Globals for Seconds Counter
unsigned char uSecCounter = 0; // Micro Seconds Counter
unsigned char SecCounter = 0;  //Seconds Counter
unsigned char MinCounter = 0;  //Minutes Counter
unsigned char FiveMinCounter = 0; //5Min Counter
 
 
// Interrupt Service Request handler
void interrupt isr()
{
    // Is this timer1 interrupting? 
    if (TMR1IF) // If the Interrupt Flag = 1 then do...
    {
        // Update the uSeconds Counter
        uSecCounter++; //Increment uSecCounter by one until 20 pulses are counted then its 1 sec. 
        
        // Update Secounds Counter
        if (uSecCounter > 20) // If the uSecCounter has counted 20 then its One Sec. 
        {
        uSecCounter = 0; // Reset the uSec Counter to Zero
        SecCounter++;    // Increment Seconds Counter
        }
 
        // Update the Minutes Counter
        if (SecCounter > 60) 
        {
        SecCounter = 0; // If the SecCounter has reached 60, reset it first and increment Minutes Counter.
        MinCounter++;
        }
 
        // Update the 5Minutes Counter
        if (MinCounter > 5) 
        {
        MinCounter = 0; // If the MinCounter has reached 5, then reset it first and increment 5Minutes Counter.
        FiveMinCounter++;
        }
        
        // Check to see if 10 minutes have passed. 
        if (FiveMinCounter > 1) 
        {
        FiveMinCounter = 0; // If the 5MinCounter has reached 2 then its 10 minutes have passed, then reset it.
        }
 
        // Reset the timer1 counter bytes
        TMR1H = 0x3C;
        TMR1L = 0xB0;
 
        // Reset the timer1 interrupt flag
        TMR1IF = 0;
    }
}
 
 
// Main procedure
void main(void)
{
    OSCCON = 0b01100001;    // 4Mhz INT OSC
    
    // Set up the PIC12F683 IO pins
    GPIO   = 0b00110100;    // Set all GPIO pins to Output except GP2(PIR), GP4(SW0) and GP5(SW1) as Input 
    ANSEL  = 0b00000000;    // Disable analogue inputs
    TRISIO = 0b00000100;    // Set all IO pins to output except GP2 which is input
    OPTION_REG = 0b00000000;// Set the option register
    WPU    = 0b00000000;    // Set weak pull-up off on all pins
    CMCON0 = 7;             // Disable comparator 0
 
    // Set up the TIMER1 (16 bit timer, and a max count = 65,536)
    TMR1IF = 0; // Reset the timer1 interrupt flag
    nT1SYNC =  0; // nT1SYNC as I check it against PIC12F683 header file 
    T1CON = 0b00000001;
    TMR1IE = 1; // Turn on the timer1 interrupt
    TMR1H = 0x3C;
    TMR1L = 0xB0;
    
    // Enable the interrupts
    PEIE = 1;
    GIE = 1;
 
    // Main loop
    while(1)
    {
        
    //Read Input Switches
    //SW1 SW0
    // 00   = AUTO MODE with PIR
    // 01   = Fix Mode: Shot every 10 Sec
    // 10   = Fix Mode: Shot every 30 Sec
    // 11   = Fix Mode: Shot every 1 Minute
    
    // Read the DIP switch settings
    
    if(SW1==0 && SW0==0){  // I am having trouble with this line of code????? 
    // AUTO MODE
    // This would be external interrupt trigger driven code
    // Turn Power ON
    //  POWER = 1;
    // Delay 3 usec
    __delay_ms(3000);
    // Take a shot
    //  SHOOT = 1;
    // Wait for it to be saved on the SD Card
    __delay_ms(3000);
    }
    else if(SW1==0 && SW0==1){
    //Fix Mode: Shot every 10 sec
    // Turn Power ON
    //POWER = 1;
    // Delay 3 usec
    //__delay_s(3);
    //If(SecCounter >0)
    //{
    // Take a shot
    //SHOOT = 1;
    // Wait for it to be saved on the SD Card
    //__delay_s(3);
    }
 
    else if(SW1==1 && SW0==0){
    //Fix Mode: Shot every 30 sec
    //
    }
    else if(SW1==1 && SW0==1){
    //Fix Mode: Shot every 1 Minute
    //
    }
    }//While loop end
} // Main loop



Remember C language is case sensitive as defined by the C Standards, also I would recommend adding the device specific header file, pic12f683.h in this case, to the project so that it may be reference for the correct #define macros, such as GP0 or GPIObits.GP0, not GPIO.0.

BigDog
 

It worked..I am adding device specific header file just as you have recommended.
Thank you very much for these helpful suggestions...very much appreciated.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top