| |
SPL SerialPort programming - Read data from the SerialPort
This tutorial is continued from the previous tutorial.
5. Read data from serial port
- You can read data from serial port by using below method.
int read_count = portname.Read(byte[] buff, int offset, int count)
- Add script to read data from serial port on the MF Application's editor panel.
| |
buff = Util.CreateArrayByte(2)
COM3.Read(buff, 0, 2)
print "Received Data -> " + Util.BytesToHex(buff)
| |
|
- Click "Send Script" button to send SPL script to emulator.
- Application will wait until defined length of data is arrived through serial port.
6. Send data from emulator to application
- Add below command on the MF Emulator's editor panel.
| |
buff = Util.CreateArrayByte(2)
buff[0] = 0xF0
buff[1] = 0xF1
COM3.Write(buff)
| |
|
- Click "Send Script" button to send SPL script to emulator.
7. Executed result
- Executed result will be shown as follows.
|