SerialPort.ReadByte
-------------------

Reads a single byte to the serial port.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SerialPort](component_SerialPort.md) | [3.0](newinversion30.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ❌ No |

MBS( "SerialPort.ReadByte"; PortReference ) 

**MBS**( **"SerialPort.ReadByte";** /\* Reads a single byte to the serial port. \*/  
**$PortReference**) /\* The reference number of the port. You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port.e.g. $port \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PortReference | The reference number of the port. You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port. | $port |

### Result

Returns the byte value or an error message.

### Description

Reads a single byte to the serial port.  
This is very useful for reading control characters which you can't easily put in a text in FileMaker.  
Like 13 for a LF (line feed) or 10 for CR (carriage return).  
See also [SerialPort.AvailableBytes](SerialPortAvailableBytes.md) function.  
  
The script trigger pauses after it triggered a script and waits for you to call a function to read. This function clears the flag and allows the script trigger to fire again.  
### Examples

Read one byte:

 $value = MBS ( "SerialPort.ReadByte"; $port )  
### See also

- [SerialPort.AvailableBytes](SerialPortAvailableBytes.md)
- [SerialPort.Open](SerialPortOpen.md)
- [SerialPort.Read](SerialPortRead.md)
- [SerialPort.ReadHex](SerialPortReadHex.md)
- [SerialPort.ReadLine](SerialPortReadLine.md)
- [SerialPort.Resume](SerialPortResume.md)
- [SerialPort.WriteByte](SerialPortWriteByte.md)

### Blog Entries

- [MBS Filemaker Plugin, version 3.3pr1](https://www.mbsplugins.de/archive/2013-05-24/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)
- [Serial Port functions for MBS Filemaker Plugin](https://www.mbsplugins.de/archive/2012-12-01/Serial_Port_functions_for_MBS_/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th August 2014 , last changed 30th January 2025

  
[SerialPort.Read](SerialPortRead.md) - [SerialPort.ReadHex](SerialPortReadHex.md)

[HTML Version](SerialPortReadByte.shtml)