Arduino ignoring "0" bytes sent over serial

I am trying to send binary data from my PC to my Arduino but I am having an odd problem. When I try to send 0b00000000 from the pc the arduino seems to ignore the byte. It doesn't even increment Serial.available(). On windows I have tried using matlab with fwrite(s,0,'uint8'), processing with port.write(0x00) and on linux I have tried perl with $port->write(pack("C",0)). all give me the same result.

My ultimate goal is to send single precision numbers in binary format and this problem showed up when I tried to send the 4 bytes of (single)1 and Serial.availble() only incremented by 1.

Thanks

#include <LiquidCrystal.h>

#define LCD_WIDTH 16
#define LCD_HEIGHT 2

LiquidCrystal lcd(7, 6, 5, 4, A2, 2);

void setup() {
  Serial.begin(115200,'SERIAL_8N0');
  
  lcd.begin(LCD_WIDTH, LCD_HEIGHT);
}

void loop() {
  int i;
  int count;
  byte a;
  union {
    byte asBytes[4];
    double asDouble;
  } byte2double;

  
  count = Serial.available();
  lcd.setCursor(0,0);
  lcd.print(count, DEC);
}

The communication is SERIAL so only one byte arrives at a time. The count in the buffer only goes up one at a time.

You could wait for Serial.available() to get to 4 and then read the four bytes from the buffer.

You could read bytes from the buffer as they arrive (Serial.available() > 0) and put them in your own buffer, keeping track of how many you have received. If you have received all four, process the input.

In both cases you have the problem that if a byte is ever lost your input stream will not be in sync. Usually that is solved by adding headers and checksums to messages so you can re-synchronize.

The problem is that Serial.available() does not increment when the byte sent is 0. So for example if I did the following on the pc:
Serial.write(0)
Serial.write(0)
Serial.write(0)
Serial.write(0)

And then ran Serial.available() on the arduino it would return 0.

I can see the rx light on the FTDI usb to serial adapter blink so I know that data is being put on the line. I have tried this on both an arduino pro mini and an arduino uno.

  Serial.begin(115200,'SERIAL_8N0');

'This' 'is' 'wrong'. There are no single quotes required.

PaulS:

  Serial.begin(115200,'SERIAL_8N0');

'This' 'is' 'wrong'. There are no single quotes required.

Thanks, I will fix that but I don't think it is the problem. I just added it as I was troubleshooting this morning.