Hi all,
Could you help me find the errors for my code. When I use "Build all" in MPLAB v8.10, its showing me syntax errors. Here is my code:
#include <p18F4550.h>
#fuses HSPLL,USBDIV,PLL5,CPUDIV1,VREGEN,NOWDT,NOPROTECT,NOLVP,NODEBUG
#use delay(clock=48000000)
#use rs232(baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, bits=8) // Configuration RS232 port
void main() {
//int16 Dat;
int8 AN0_Value,AN1_Value,AN2_Value,AN3_Value;
set_tris_a(0B00001111);
set_tris_c(0B10111111);
setup_adc_ports(ALL_ANALOG); // Asign Analog pin
setup_adc(ADC_CLOCK_INTERNAL);
While (1)
{
set_adc_channel(0); // Select Channel AN0
//if(
delay_us(10);
AN0_Value = read_adc(); // Read adc channel 0
set_adc_channel(1); // Select Channel AN1
delay_us(10);
AN1_Value = read_adc(); // Read adc channel 1
set_adc_channel(2); // Select Channel AN2
delay_us(10);
AN2_Value = read_adc(); // Read adc channel 2
set_adc_channel(3); // Select Channel AN3
delay_us(10);
AN3_Value = read_adc(); // Read adc channel 3
// continue;
}
}
And the errors showed:
C:\Documents and Settings\Administrator\Desktop\tuanvoi\A2D.c:2:Error: syntax error
Thank you a lot.
Could you help me find the errors for my code. When I use "Build all" in MPLAB v8.10, its showing me syntax errors. Here is my code:
#include <p18F4550.h>
#fuses HSPLL,USBDIV,PLL5,CPUDIV1,VREGEN,NOWDT,NOPROTECT,NOLVP,NODEBUG
#use delay(clock=48000000)
#use rs232(baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, bits=8) // Configuration RS232 port
void main() {
//int16 Dat;
int8 AN0_Value,AN1_Value,AN2_Value,AN3_Value;
set_tris_a(0B00001111);
set_tris_c(0B10111111);
setup_adc_ports(ALL_ANALOG); // Asign Analog pin
setup_adc(ADC_CLOCK_INTERNAL);
While (1)
{
set_adc_channel(0); // Select Channel AN0
//if(
delay_us(10);
AN0_Value = read_adc(); // Read adc channel 0
set_adc_channel(1); // Select Channel AN1
delay_us(10);
AN1_Value = read_adc(); // Read adc channel 1
set_adc_channel(2); // Select Channel AN2
delay_us(10);
AN2_Value = read_adc(); // Read adc channel 2
set_adc_channel(3); // Select Channel AN3
delay_us(10);
AN3_Value = read_adc(); // Read adc channel 3
// continue;
}
}
And the errors showed:
C:\Documents and Settings\Administrator\Desktop\tuanvoi\A2D.c:2:Error: syntax error
Thank you a lot.