Thank you for the continued help J-M-L !! Really appreciate you taking the time to work with me on this.
here is my attempt at integrating what you have suggested.
Not sure if this was what was intended..
I also got a warning that the Serial.readBytes was expecting a Char or Byte for the buffer type so I changed it to a Byte rather then an Int.
#include <LiquidCrystal.h>
LiquidCrystal lcd(10, 9, 8, 7, 6, 5); // put your pin numbers here
byte index = 0;
byte DMM_ARRAY[6]; // Where to store the Bytes read
byte c;
//char SETUP = 0x65;
int n = 0;
float previousValue = 0;
float currentValue = 0;
uint32_t t = 0; // Time record was received '2', '3', '4', '5', '6', '7', '8', '9', ' ', 'L'};
void setup() {
pinMode(11, OUTPUT); // LCD CONTRAST PIN
pinMode(2, OUTPUT); // Clear To Send PIN
pinMode(3, OUTPUT); // Request Sample PIN
analogWrite(11, 50); //LCD CONTRAST AMOUNT
Serial.begin(1000000);
lcd.begin(16, 2);
lcd.print("GG1320AN21 TEST");
lcd.clear();
}
bool Get_data() {
bool success = (Serial.available() >= 6);
if (success) Serial.readBytes(DMM_ARRAY, 6);
return success;
}
void loop() {
float deltaTheta;
static unsigned long previousMicros=0;
unsigned long currentMicros = micros(); // you could do this with millis() too, depends on the precision you want
if (currentMicros - previousMicros >= 1000000ul) { // 1s in µs
unsigned long deltaT = currentMicros - previousMicros; // that will be give or take 1s
digitalWrite(2, HIGH); // CTS Open
digitalWrite(3, HIGH); // RS
delayMicroseconds( 50 );
digitalWrite(3, LOW); //RS
if (Get_data()) { //Read the Serial bytes coming in
currentValue = DMM_ARRAY[2];
delayMicroseconds( 200 );
digitalWrite(2, LOW); // CTS Close
deltaTheta =((previousValue - currentValue)* 1.113065); // count * 1.113065 ARC SEC / SEC
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(deltaTheta / (deltaT / 1000000)); //3 decimal place values
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print( DMM_ARRAY[2]);// Print btye 3 (LSB)
lcd.print(" ");
}
previousMicros = currentMicros;
previousValue = currentValue;
}
}
/*
void Get_data() {
if (Serial.available() >= 6) {
for (int i = 0; i < 6; i++) {
DMM_ARRAY[i] = Serial.read();
}
}
}
*/