undefined identifier "GODONE"

Thread Starter

HITECHBOB

Joined Jan 23, 2011
1
I'm using the 16F690 and the pickit2 MPLAB IDE with HI-TECH C Lite 9.81 Compilier. When building the following code I get undefined identifier "GODONE"

Can anyone help me with this.


/* This is a simple demo project written for use with
* the HI-TECH Software PICC compiler. It may be compiled
* and run on the Microchip PICDEM 2 PLUS DEMO BOARD.
* Features demonstrated include driving the LCD display and
* the A2D converter.

Additional files required for this demo are included in the
PIC\SAMPLES directories:
DELAY\delay.c
DELAY\delay.h
lcd.c
lcd.h
*/
#include <pic.h>
#include <stdio.h>
#include "lcd.h"
/* this is the maximum value of an A2D conversion. */
#define MAXVOLTAGE 5
#define SENSITIVITYMASK 0xFC // Reduce precision of A2D result
void init(void){
lcd_init(FOURBIT_MODE);
ADON=1; /* enable A2D converter */
ADIE=0; /* not interrupt driven */
ADCON1=0x0E;
ADCON0=1;
TRISB=0x00; // Set PORTB in output mode
T1CON=0x31; // turn on timer 1
TMR1IE=1; // timer 1 is interrupt enabled
PEIE=1; // enable peripheral interrupts
GIE=1; // turn on interrupts
}
void interrupt isr(void){
if(TMR1IE && TMR1IF){
PORTB++;
TMR1IF=0;
}
}
void main(void){
unsigned char last_value;
unsigned char volts;
unsigned char decivolts;
unsigned char outString[20];
init();
lcd_puts("Adust the");
lcd_home2(); // select line 2
lcd_puts("potentiometer");
while(1){
GODONE=1;
while(GODONE)continue;
ADIF=0;
// Mask off the lower two bits as this level of precision
// is wasted as we're only showing 0.1 volt increments.
// This reduces unneccesary updates to the LCD.
if((ADRESH&SENSITIVITYMASK)!=(last_value&SENSITIVITYMASK))
{
volts=0;
for(decivolts=(ADRESH*10*MAXVOLTAGE/255);decivolts>=10;decivolts-=10)
volts++;
lcd_clear();
sprintf(outString,"A2D = %d.%d volts",volts,decivolts);
lcd_puts(outString);
}
last_value=ADRESH;
}
}
 

t06afre

Joined May 11, 2009
5,934
Then working with HI-Tech C for mid-range pics always include the htc.h file. Have you read the quickstart.pdf file in the ....\HI-TECH Software\PICC\9.81\docs\ folder. If you use MPLAB always create a project like shown in this document. And is the datasheet for 16f690 in reach. As this is an important document then programming. What is the source of your program. Is the original program for a 16f690? Microchip have a lot of MCUs and the code for one chip. Is not always directly portable to other MCUs. Oh and last how do you take care of your configuration bits.
Ps the correct header file for your chip pic16f690.h You will find the configuration bits setting at the start of this file
 
Last edited:

stahta01

Joined Jun 9, 2011
133
Defining _LEGACY_HEADERS before including the htc.h file results in the old names working. Version 9.81 of HiTech C renamed a bunch of names.

I posted in this thread because it was the first result search Google using "GODONE" and "9.81".

Tim S.
 

be80be

Joined Jul 5, 2008
2,072
The reason it not working it it's GO_DONE not GODONE

Change it to GO_DONE and see what happens

ADCON0 equ 001Fh
#define ADON ADCON0, 0
#define GO_nDONE ADCON0, 1
#define VCFG ADCON0, 6
#define ADFM ADCON0, 7
#define GO ADCON0, 1
#define CHS0 ADCON0, 2
#define CHS1 ADCON0, 3
#define CHS2 ADCON0, 4
#define CHS3 ADCON0, 5
#define nDONE ADCON0, 1
#define GO_DONE ADCON0, 1
#ifndef _LIB_BUILD
 
Top