من لا میکرو 16F877A دارم ولتمتر مینویسم ، اما کار نمیکنه 
اصلا وقتی A/D رو میارم تو کامپایل ارور میده !
تازه کار با MICROC رو شروع کردم ، با A/D اون مشکل دارم
مثال خودشم توش کپی می کنم ، کار نمیکنه و ارور میدهد !
// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
char txt1[] = "10 V";
char txt2[] = "0.123mA";
char txt3[] = "25 V";
char txt4[] = "0.123mA";
char txt5[] = "WWW.GOOGLE.IR";
unsigned int temp_res ;
char i; // Loop variable
void Move_Delay() { // Function used for text moving
Delay_ms(500); // You can change the moving speed here
}
void main(){
ADCON1 |= 0x0C; // Configure AN pins as digital
TRISB = 0; // PORTB is output // PORTA is input
temp_res = ADC_Read(2); // Get results of AD conversion
TRISA = 0xFF; // PORTA is input
temp_res=10;
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,txt1); // Write text in first row
Lcd_Out(2,1,txt2); // Write text in second row
Lcd_Out(1,10,txt3); // Write text in first row
Lcd_Out(2,10,txt4); // Write text in second row
Lcd_Out(3,5,txt5); // Write text in second row
Lcd_Out(4,4,temp_res);
Delay_ms(2000);
}

اصلا وقتی A/D رو میارم تو کامپایل ارور میده !
تازه کار با MICROC رو شروع کردم ، با A/D اون مشکل دارم
مثال خودشم توش کپی می کنم ، کار نمیکنه و ارور میدهد !
// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
char txt1[] = "10 V";
char txt2[] = "0.123mA";
char txt3[] = "25 V";
char txt4[] = "0.123mA";
char txt5[] = "WWW.GOOGLE.IR";
unsigned int temp_res ;
char i; // Loop variable
void Move_Delay() { // Function used for text moving
Delay_ms(500); // You can change the moving speed here
}
void main(){
ADCON1 |= 0x0C; // Configure AN pins as digital
TRISB = 0; // PORTB is output // PORTA is input
temp_res = ADC_Read(2); // Get results of AD conversion
TRISA = 0xFF; // PORTA is input
temp_res=10;
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,txt1); // Write text in first row
Lcd_Out(2,1,txt2); // Write text in second row
Lcd_Out(1,10,txt3); // Write text in first row
Lcd_Out(2,10,txt4); // Write text in second row
Lcd_Out(3,5,txt5); // Write text in second row
Lcd_Out(4,4,temp_res);
Delay_ms(2000);
}
دیدگاه