PDA

View Full Version : serial send action



yonu
May 15th, 2013, 08:31 PM
hey I have a stupid question how do you do a CR or a LF in the serial send action.

Thanks,
Yonu

yonu
May 15th, 2013, 08:50 PM
Ok i figured out to line feed and carriage returns however I am getting a couple of lua errors I don't know what to do with I have no idea what the Incomplete response to last command means

Serial: Icatcher : Simple Send: 4F 6E 3C 43 52 3E On<CR>
Serial: Icatcher : Simple Receive: Data Code: 16384
Serial: Icatcher : ERROR: No response to last command
Serial: Icatcher : Simple Receive: Data 73 65 6E 73 6F 72 0D sensor. Code: 8192
Serial: Icatcher : ERROR: Incomplete response to last command

Thanks,
Yonu

Ron
May 15th, 2013, 08:54 PM
Incomplete response means that the serial class timed out before. Looks like incorrect termination. Probably it's expecting 0D 0A but only getting 0D from the device. Check that.

yonu
May 15th, 2013, 09:07 PM
how is the best way to check it as the device seems to be outputting the proper data to the comport at leat it appears to be in a termina

Ron
May 16th, 2013, 06:22 AM
Attach the config for your Icatcher device. Maybe we can see it in there.

yonu
May 21st, 2013, 08:35 PM
sorry for the delay here is the contents of the config

local Super = serial.Classes.Simple
local device = Super:New({
Name = "Icatcher",
GlobalName = "Icatcher",
Description = "Icatcher Sensors and Controls",

LogLevel = 0,-- change this to a higher number or false when the device is working

BaudRate = 9600,
Parity = 0,
DataBits = 8,
StopBits = 0,
FlowControl = 'N',

CallbackType = serial.CB_TERMINATED,
ReceiveTerminator = '<CR>',

SendStartByte = '',
SendTerminator = '<CR>',
IncompleteResponseTimeout = 100,
NoResponseTimeout = 1000,

Initialize = function(self)
if Super.Initialize(self) then
-- add your own initializations here
self.Status = 'Initialized'
return true
end
end,

ReceiveResponse = function(self, data, code)
if math.band(code, serial.RXCHAR) > 0 then
-- add code here to process the data parameter
end
Super.ReceiveResponse(self, data, code) -- must call the parent's ReceiveResponse
end,

})

serial.AddDevice(device)