This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

RS232 serial read
#6
(20.04.2017, 12:10)admin Wrote:
Code:
if not port then  require('serial')  port = serial.open('/dev/RS232', { baudrate = 9600 })  port:flush()  line = '' end char = port:read(1, 1) if char then  if char == '\r' then    line = line:trim()    alert(line)    line = ''  else    line = line .. char  end end
Hi Admin,
I have a question about RS232 i have try this profil with RS485 but i want (because i have many devices on RS485 and only this on Rs232) to put this device on RS232 with script but i don't now how make that : 

{
 "manufacturer": "TEST",
 "description": "TEST",
"mapping": [
{ "name": "1", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 0, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "2", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 0, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "3", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 1, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "4", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 1, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "5", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 2, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "6", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 2, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "7", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 3, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "8", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 3, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "9", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 4, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "10", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 4, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "11", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 5, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "12", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 5, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "13", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 6, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "14", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 6, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "15", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 7, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "16", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 7, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "17", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 8, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "18", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 8, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "19", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 9, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "20", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 9, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "21", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 10, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "22" "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 10, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "23", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 11, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "24", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 11, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "25", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 12, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "26", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 12, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "27", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 13, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "28", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 660, "value_bitmask": 0x00FF, "writable": 0},
{ "name": "29", "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 660, "value_bitmask": 0xFF00, "writable": 0},
{ "name": "30" "bus_datatype": "07", "type": "register", "datatype":"uint16", "address": 668, "value_bitmask": 0x00FF, "writable": 0}
 ]
}

Thanks a lot.
Reply


Messages In This Thread
RS232 serial read - by leonidas - 20.04.2017, 10:45
RE: RS232 serial read - by admin - 20.04.2017, 10:52
RE: RS232 serial read - by leonidas - 20.04.2017, 11:08
RE: RS232 serial read - by admin - 20.04.2017, 12:10
RE: RS232 serial read - by Gadjoken - 16.03.2018, 17:08
RE: RS232 serial read - by leonidas - 20.04.2017, 12:21
RE: RS232 serial read - by admin - 16.03.2018, 17:17
RE: RS232 serial read - by Gadjoken - 19.03.2018, 07:27
RE: RS232 serial read - by admin - 19.03.2018, 07:36
RE: RS232 serial read - by Gadjoken - 19.03.2018, 13:39
RE: RS232 serial read - by admin - 20.03.2018, 09:12
RE: RS232 serial read - by Gadjoken - 20.03.2018, 10:35

Forum Jump: