aci.SendComPort

SUMMARY

Comport sends data.

SYNTAX

aci.SendComPort(<portnr>, <strvalue>)

ARGUMENTS

nportnr (type:integer)
The number of comport. The number of the first port is one.
strvalue (type:string)
The sent data.

EXAMPLES

function Init_ComPort()
  comportA = 3 --please adjust this value 
  comportB = 4 --please adjust this value
  comport_buf = ""
  comport_pattern = "(%d%d%d%d)-(%d%d)-(%d%d) (%d%d):(%d%d):(%d%d)*"
  if not aci.OpenComPort(comportA, 9600,8 ,string.byte("N") ,1) then
    print("cannot open comport "..comportA )
  end
  if not aci.OpenComPort(comportB, 9600,8 ,string.byte("N") ,1) then
    print("cannot open comport "..comportB)
  end
end
function Cycle_ComPort()	
  local recvComPort = aci.RecvComPort(comportB)
  comport_buf = comport_buf..recvComPort  
  while true do
    local year, month, day, hours, minutes, sec = string.match(comport_buf, comport_pattern)
    if (year ~= nil and month ~= nil and day ~= nil and hours ~= nil and minutes ~= nil and sec ~= nil) then
      print("recv: "..year.."-"..month.."-"..day.." "..hours..":"..minutes..":"..sec)
      local i, j = string.find(comport_buf, comport_pattern)
      comport_buf = string.sub(comport_buf, j, -1)
    else 
      break
    end 
  end
  comport_date = os.date("%Y-%m-%d %X*")
  aci.SendComPort(comportA, comport_date)
  print("send: "..comport_date)
end


Syntax Notation
[aaa]
aaa is optional (zero or one occurences)
(aaa|bbb)
aaa exclusive or bbb
(aaa)*
aaa may occur indefinitely often or may be omitted
(aaa)+
aaa may occur indefinitely often but at least once
(aaa)m..n
aaa may occur from m to n times