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 trasmission
#1
good morning,

I have a problem on serial transmission, I simulated with a PC and transmitting in ascii format this patch HEX it works, the slave answer with ok. So the patch is correct. If I transmit using this code on the LM I have no answer from the slave. Any suggest?

thanks to everybody will help me.
Best regards

--port check
if not port then
require('serial')
  log('porta non aperta')
  comm_on, err = serial.open('/dev/RS232', { baudrate = 57600, parity = 'even', duplex = 'half', databits = 8 , stopbits = 1 })
  if comm_on then
    log('Porta aperta')
  else
    log('errore apertura porta in: ', err)
  end
end


-- loop while condition is met
while (1) do
  if comm_on then
    hexvalue = ('00,00,00,20,01,00,1A,3B')
    log('value: ',hexvalue)
    comm_on:write(hexvalue)
    data, err = comm_on:read(2,1)
    log('Valore letto = ', data)
    log('errore letto = ', err)
end
end
Reply


Messages In This Thread
RS232 trasmission - by CristianAgata - 17.04.2020, 08:22
RE: RS232 trasmission - by admin - 17.04.2020, 08:25
RE: RS232 trasmission - by CristianAgata - 17.04.2020, 08:37
RE: RS232 trasmission - by admin - 17.04.2020, 08:40
RE: RS232 trasmission - by CristianAgata - 17.04.2020, 08:46
RE: RS232 trasmission - by admin - 17.04.2020, 08:49
RE: RS232 trasmission - by CristianAgata - 17.04.2020, 08:51
RE: RS232 trasmission - by CristianAgata - 17.04.2020, 11:51
RE: RS232 trasmission - by admin - 17.04.2020, 12:08
RE: RS232 trasmission - by CristianAgata - 17.04.2020, 13:31
RE: RS232 trasmission - by admin - 17.04.2020, 13:44
RE: RS232 trasmission - by CristianAgata - 17.04.2020, 13:51
RE: RS232 trasmission - by CristianAgata - 17.04.2020, 14:52

Forum Jump: