include //include the library code: LiquidCrystal lcd(P2_0, P2_1, P2_2, P2_3, P2_4, P2_5); //initialize the library with interface pins //--------------------------------------- int sensorValueA0,sensorValueA4,sensorValueA5,sensorValueA6,sensorValueA7; //value read from P1.x port float voltageA0,voltageA4,voltageA5,voltageA6,voltageA7; //value converted to real Volts long time_seconds = 0; //--------------------------------------- void setup() { pinMode(PUSH2, INPUT_PULLUP); lcd.begin(20, 2); //set up the LCD's (VFD display) number of columns and rows: lcd.print("Msp430g2553 & Linux"); //Print a message to LCD lcd.setCursor(0, 1); lcd.print("DataLogger SK_2015"); delay(1000); for (int positionCounter = 0; positionCounter < 20; positionCounter++) { lcd.scrollDisplayLeft(); //scroll one position left delay(10);}//wait a bit delay(500); lcd.setCursor(0, 0); lcd.print("USB is not ready yet"); lcd.setCursor(0, 1); lcd.print("Wait 10 second. "); for (int positionCounter = 0; positionCounter < 20; positionCounter++) { lcd.scrollDisplayLeft(); //scroll one position left delay(10);} //wait a bit lcd.setCursor(20, 0); lcd.print(" "); lcd.setCursor(20, 1); lcd.print(" "); int i; //temporary variable, int for (i=10;i>0;i--){ //10 second delay lcd.setCursor(5, 1); lcd.print(" "); lcd.setCursor(6, 1); lcd.print(i-1); //print seconds, back counter delay(1000);} for (int positionCounter = 0; positionCounter < 20; positionCounter++) { lcd.scrollDisplayLeft(); //scroll one position left delay(10);}//wait a bit delay(500); lcd.setCursor(0, 0); lcd.print("Setup Linux computer"); lcd.setCursor(0, 1); lcd.print("Run \" dmesg \" first "); for (int positionCounter = 0; positionCounter < 20; positionCounter++) { lcd.scrollDisplayLeft(); //scroll one position left delay(10);} //wait a bit delay(3000); lcd.setCursor(20, 0); lcd.print("#cat /dev/ttyACM0 >> "); lcd.setCursor(20, 1); lcd.print("& press S2 to START!"); for (int positionCounter = 0; positionCounter < 20; positionCounter++) { lcd.scrollDisplayLeft(); //scroll one position left delay(10);} //wait a bit while(analogRead(5) > 500) delay(100); //wait to press button S2 lcd.setCursor(20, 0); lcd.print("We began to transmit"); lcd.setCursor(20, 1); lcd.print("data via serial port"); Serial.begin(9600); //initialize serial communications at 9600 bps: Serial.print("\n"); //new blank line Serial.print("5 ch. voltmeter, 0-3.6V, SN.0017, ChemLab_18, Room 402, SK\n"); Serial.print("\n"); Serial.print("MSP430G2553 measures voltages at P1.0, P1.4, P1.5, P1.6 and P1.7\n"); Serial.print("and outputs (Volts) via the serial port each 1 sec.\n"); Serial.print("\n"); Serial.print("Time(s)\tP1.0(V)\tP1.4(V)\tP1.5(V)\tP1.6(V)\tP1.7(V)\n"); } //--------------------------------------- void loop() { while (((millis())%992) != 0) //992 - corrected timing cont. for 1 sec. delay (was 1000) sensorValueA0 = analogRead(A0); //read analog voltage, range 1-1023, int sensorValueA4 = analogRead(A4); sensorValueA5 = analogRead(A5); sensorValueA6 = analogRead(A6); sensorValueA7 = analogRead(A7); voltageA0 = sensorValueA0*3.562/1024; //convert to Volts, 3.562V = 1024 counts voltageA4 = sensorValueA4*3.562/1024; voltageA5 = sensorValueA5*3.562/1024; voltageA6 = sensorValueA6*3.562/1024; voltageA7 = sensorValueA7*3.562/1024; Serial.print(time_seconds);Serial.print("\t" ); //print to serial, TAB delimiter Serial.print(voltageA0); Serial.print("\t" ); Serial.print(voltageA4); Serial.print("\t" ); Serial.print(voltageA5); Serial.print("\t" ); Serial.print(voltageA6); Serial.print("\t" ); Serial.print(voltageA7); Serial.print("\n"); //new line lcd.setCursor(20, 0); //display was shifted by 20 characters lcd.print(voltageA0);lcd.print("V ");//print to LCD (to VFD display) lcd.print(voltageA4);lcd.print("V "); lcd.print(voltageA5);lcd.print("V "); lcd.setCursor(20, 1); lcd.print(voltageA6);lcd.print("V "); lcd.print(voltageA7);lcd.print("V "); lcd.print(time_seconds);lcd.print(" sec. "); //print seconds time_seconds++; } //---------------------------------------