Hello every one
I'm a beginner in CodeWarrior. I’m trying to work with Processor Expert to read a
Analog input . I used ADC bean but something here is wrong. I have got 15 errors from
below program. Is any body knows some resources or training stuffs to help me to understand processor expert in ADC or serial port programming or some sample example to understand better the problem.
Thanks.
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
void main(void)
{
/* Write your local variable definition here */
unsigned int t;
long tlong1;
Pot_Enable();
Pot_MeasureWait();
Pot_Measure();
Pot_GetValue16();
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
do {
Pot_Start();
// tlong1 = (long)t * 5000;
// tlong1 = tlong1 / 1024;
// if (tlong1 >= 2500 & tlong1 <=4450 ) {
if (t >= 50 ) {
Indicator_SetVal();
} else {
Indicator_ClrVal();
}
} while(1); /* endless loop */
ARBM66 wrote:I have got 15 errors from below program.
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
void main(void)
{
/* Write your local variable definition here */
unsigned int t;
long tlong1;
Pot_Enable();
Pot_MeasureWait();
Pot_Measure();
Pot_GetValue16();
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
do {
Pot_Start();
// tlong1 = (long)t * 5000;
// tlong1 = tlong1 / 1024;
//if (tlong1 >= 2500 & tlong1 <=4450 ) {
if (t >= 50 ) {
Indicator_SetVal();
} else {
Indicator_ClrVal();
}
} while(1); /* endless loop */
Is it that hard to find unpaired {}-brackets? You suppressed a line with // and made in not compileable
ARBM66,
Attached is a sample of code we use on one of our development kits.
It uses the ADC bean, so you should be able to find what you are looking for.
Thank you Witztronics,
I'm working with MCS9S12E128 a 16bit cpu. I was wondering why my CodeWarrior (Special edittion 5.9.0) has not the cpu number that you sent it in their list.
Is anybody else (CodeWarrier- Processor expert team) can help me for more resouses?
Thanks
ARBM66
Sorry about that. I didn't realize you were using one of the S12 parts. That firmware was for an S08 device.
The same concepts should work though. You set up the "bean" using processor expert, call the "start measurement" routine, then call one of the "get value" routines.
The routines are created by processor expert, so they are named according to how you name the bean and which routines you enable.
You need to delare a variable to store the result and something like "err" to avoid compile warnings about not using the returned value. Many of processor experts routines return a pass/fail result, so that you can catch errors.
ie; declarations
byte myValue[5]; // value read from ADC
byte err; // error result
ie; statement
err = AD1_GetValue8 ((byte *)myValue);
Hello,
some examples on how to use ADC component are located in "Typical usage" page in the help of ADC component. To open this page please use "Help" menu command from component´s pop-up menu. Consequently new window will be opened and here just click on "Typical usage" page.
best regards
Vojtech Filip
Processor Expert Support Team
Also, there are many help documents in the
C:\Program Files\Freescale\CodeWarrior for Microcontrollers V6.2\Help\PDF
directory.
(the location will be slightly different for the HCS12 codewarrior)