thnx for the info, your right i tried so many different ways last night and no mater what i done i could not get it to work. the reason i wanted to use two of the 7107s is because i only got two of them at the moment and they are about £4 each.
i think the simpler way would be to us MCU, but i not any good at writing software and don't know how to read 5 channels of analogue signals with the MCU. i found a code that read two channel and displays it on lcd and that works fine. but the lcd i got is 16x2 and i can display 4 different readings on it. when i duplicate the code and use to read four channels the first two work and the other two just displays rubbish.
i am using pic 16f884 in a 44 QFN package.
here is the code:
// LCD module connections
sbit LCD_RS at RD0_bit;
sbit LCD_EN at RD1_bit;
sbit LCD_D4 at RD2_bit;
sbit LCD_D5 at RD3_bit;
sbit LCD_D6 at RD4_bit;
sbit LCD_D7 at RD5_bit;
sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISD2_bit;
sbit LCD_D5_Direction at TRISD3_bit;
sbit LCD_D6_Direction at TRISD4_bit;
sbit LCD_D7_Direction at TRISD5_bit;
// End LCD module connections
char Message1[] = "V:";
unsigned int ADC_Value1, DisplayVolt1;
char volt1[6] = "00.00";
char Message2[] = "A:";
unsigned int ADC_Value2, DisplayVolt2;
char volt2[6] = "00.00";
char Message3[] = "V:";
unsigned int ADC_Value3, DisplayVolt3;
char volt3[6] = "00.00";
char Message4[] = "A:";
unsigned int ADC_Value4, DisplayVolt4;
char volt4[6] = "00.00";
void main() {
AD1CON1 = 0b00001111; // Analog channel select
TRISD = 0b00000000; // PORTD All Outputs
TRISA = 0b00001111; // PORTA All Outputs, Except A0,A1,A2,A3
ADC1_Init();
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // CLEAR display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(2,1,Message1);
Lcd_Out(2,9,Message2);
Lcd_Out(1,1,Message3);
Lcd_Out(1,1,Message4);
do {
ADC_Value1 = ADC1_Read(0);
DisplayVolt1 = ADC_Value1 * 2;
volt1[0] = DisplayVolt1/1000 + 48;
volt1[1] = (DisplayVolt1/100)%10 + 48;
volt1[3] = (DisplayVolt1/10)%10 + 48;
volt1[4] = (DisplayVolt1/1)%10 + 48;
Lcd_Out(2,3,volt1);
delay_ms(120);
ADC_Value2 = ADC1_Read(1);
DisplayVolt2 = ADC_Value2 * 2;
volt2[0] = DisplayVolt2/1000 + 48;
volt2[1] = (DisplayVolt2/100)%10 + 48;
volt2[3] = (DisplayVolt2/10)%10 + 48;
volt2[4] = (DisplayVolt2/1)%10 + 48;
Lcd_Out(2,11,volt2);
delay_ms(120);
ADC_Value3 = ADC1_Read(2);
DisplayVolt3 = ADC_Value3 * 2;
volt1[0] = DisplayVolt3/1000 + 48;
volt1[1] = (DisplayVolt3/100)%10 + 48;
volt1[3] = (DisplayVolt3/10)%10 + 48;
volt1[4] = (DisplayVolt3/1)%10 + 48;
Lcd_Out(1,3,volt3);
delay_ms(120);
ADC_Value4 = ADC1_Read(3);
DisplayVolt4 = ADC_Value4 * 2;
volt1[0] = DisplayVolt4/1000 + 48;
volt1[1] = (DisplayVolt4/100)%10 + 48;
volt1[3] = (DisplayVolt4/10)%10 + 48;
volt1[4] = (DisplayVolt4/1)%10 + 48;
Lcd_Out(1,11,volt4);
delay_ms(120);
} while(1);
}