Hi, I'm trying to read my smart meter, which should send a message every 10 seconds as a TTL signal. The signal is inverted, so i'm using a FET to invert the signal again. However when im reading in the software, i read zeros all the time, i cant get a single character in my buffer, also the event is pretty much fired continuously, I'm using the following code:
void comPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { if (e.EventType == SerialData.Chars) { int bytesToRead = comPort.BytesToRead; // if we received any bytes in the serial buffer if (bytesToRead > 0) { byte[] buffer = new byte[bytesToRead]; comPort.Read(buffer, 0, bytesToRead); comPort.Flush();
right now im just trying to read the non inverted signal to see if it works before I hook up the FET. Did I miss anything in the code? Best Regards, Martin