when using a Arduino Mega with the LabView toolkit, I figured that it is not possible to use all analog input pins on the Mega. Looking at the LIFA Firmware this seems to be no mistake as the code only supports 6 analog Inuts as can be seen in the following code:
// Reads all 6 analog input ports, builds 8 byte packet, send via RS232.
void analogReadPort()
{
// Read Each Analog Pin
int pin0 = analogRead(0);
int pin1 = analogRead(1);
int pin2 = analogRead(2);
int pin3 = analogRead(3);
int pin4 = analogRead(4);
int pin5 = analogRead(5);
//Build 8-Byte Packet From 60 Bits of Data Read
char output0 = (pin0 & 0xFF);
char output1 = ( ((pin1 << 2) & 0xFC) | ( (pin0 >> 8) & 0x03) );
char output2 = ( ((pin2 << 4) & 0xF0) | ( (pin1 >> 6) & 0x0F) );
char output3 = ( ((pin3 << 6) & 0xC0) | ( (pin2 >> 4) & 0x3F) );
char output4 = ( (pin3 >> 2) & 0xFF);
char output5 = (pin4 & 0xFF);
char output6 = ( ((pin5 << 2) & 0xFC) | ( (pin4 >> 8) & 0x03) );
char output7 = ( (pin5 >> 6) & 0x0F );
// Write Bytes To Serial Port
Serial.print(output0);
Serial.print(output1);
Serial.print(output2);
Serial.print(output3);
Serial.print(output4);
Serial.print(output5);
Serial.print(output6);
Serial.print(output7);
}
Does anyone know how to extend this piece of code to utilize all analog input Pins on a Arduino Mega?
Any help is appreciated.