EasyManuals Logo

Embedded Systems LM5p-GSMC User Manual

Default Icon
291 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #255 background imageLoading...
Page #255 background image
255
Examples
Write to port
port:write('test data')
Blocking read (script will block until 10 characters are read)
data=port:read(10)
Timeout read (script will wait for 10 characters for 20 seconds)
data=port:read(10, 20)
Close serial port
port:close()
Resident script, RS-485 echo test
-- open port on first call
if not port then
require('serial')
port = serial.open('/dev/RS485-1', { baudrate = 9600, parity = 'even', duplex = 'half' })
port:flush()
end
-- port ready
if port then
-- read one byte
char = port:read(1, 1)
-- send back if read succeeded
if char then
port:write(char)
end
end
HEX to RS-485 example
require('serial')
port = serial.open('/dev/RS485-1', {
baudrate = 4800,
parity = 'none',
duplex = 'half'
})
cmd = string.char(0xAB, 0xF1, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0xD1, 0x01, 0xFE, 0xFF, 0xFF,
0x0A, 0x24)
cmd = 'ABF1FFFFFFFFBED101FEFFFF0A24'
port:write(cmd)
Check which cmd works for you, as it can be either hex-encoded readable data or hex
representation of binary data. You might also need to change the parity config
http://openrb.com/docs/serial.htm

Table of Contents

Other manuals for Embedded Systems LM5p-GSMC

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Embedded Systems LM5p-GSMC and is the answer not in the manual?

Embedded Systems LM5p-GSMC Specifications

General IconGeneral
BrandEmbedded Systems
ModelLM5p-GSMC
CategoryDimmer
LanguageEnglish

Related product manuals