after opening a serial port I would like to send a single byte over the port and reclose the port.
WriteSerialPortData only allows the use of @buffers. How do I manage a single byte with a defined value ?
Happy New Year
Send a single Byte to Serial Port
Re: Send a single Byte to Serial Port
Poke the single byte to memory and send it:
Norm.
Code: Select all
If OpenSerialPort(0, "COM1", 300, #PB_SerialPort_NoParity, 8, 1, #PB_SerialPort_NoHandshake, 1024, 1024)
*buffer=AllocateMemory(1)
PokeB(*buffer,$20) ; copying hex 20 to buffer
WriteSerialPortData(0, *Buffer, 1)
CloseSerialPort(0)
FreeMemory(*buffer)
Debug "Success $20 to COM1"
Else
Debug "Failed"
EndIf
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Re: Send a single Byte to Serial Port
europa81 wrote:after opening a serial port I would like to send a single byte over the port and reclose the port.
WriteSerialPortData only allows the use of @buffers. How do I manage a single byte with a defined value ?
Happy New Year
Code: Select all
MyByte.a = $FF ;or what ever
WriteSerialPortData(MyPort, @MyByte, 1)
macOS Catalina 10.15.7