Re: 41CL Serial Port Transfer Message #2 Posted by Geir Isene on 4 June 2012, 2:36 p.m., in response to message #1 by John Abbott (S. Africa)
I am creating a solution with Ruby to facilitate serial transfer (both ways), but currently I have run into a challenge. I wrote to Antti Louko - but I guess he's rather busy, so I will see if anyone here have any light to shed on this:
Ok, so I came up with a Ruby solution (see the forum).
Then I thought I would go on and create a similar solution to your Python programs for the CL, but in Ruby so that I can better extend it.
But the problem is that, although I get the serial connection running, with YEXP (pointing at a plausible address, like 800000-0030), I only get zeros transmitted. I do get the right amount of zeros depending on the size of the last part (the 0030 in the above example)... but only zeros.
Maybe something about the stop bits? The parity?
The code is dead simple, as you can see:
-----------------Begin code---------------------
#!/usr/bin/ruby
require "serialport"
#params for serial port
port_str = "/dev/ttyUSB0"
port_str = ARGV[0] if ARGV.length > 0
baud_rate = 4800
data_bits = 8
stop_bits = 1
parity = SerialPort::NONE
sp = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity)
loop do
print sp.getc
end
sp.close
------------------End code----------------------
|