Tani,
Here is a simple program I wrote to demo the 9S08QG8 eval bd using an ADC in processor expert. It turns an LED off if ADC <1/3 of max (255), blinks if 1/3 to 2/3 and on if >2/3.
// <<<<<<<< This section is generated by PE
/* Including used modules for compiling procedure */
#include "Cpu.h"
#include "Bit1.h"
#include "AD1.h"
/* Include shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
// <<<<<< end of PE generated code
byte myValue; /* Number of channels */
byte min = 255/3;
byte max = (255*2)/3;
byte err;
bool s;
int i;
#define LED_ON 0;
#define LED_OFF 1;
void main(void)
{
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
while(1) {
/* run measurement with set wait for result */
err = AD1_Measure(TRUE);
/* Get results */
err = AD1_GetValue8 (&myValue);
/* Compare value and update LED */
if (myValue > max) {
s = LED_ON; /* set LED ON */
} else {
if (myValue < min) {
s = LED_OFF; /* set LED OFF */
} else {
s = s^1; /* invert LED ON <-> OFF */
}
}
/* delay */
for (i = 0; i < 10000; i++);
Bit1_PutVal(s);
}
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;

{}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
BadDad