<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>I'm not near a Winbox, so I can't try it. Normally, though, I loop the tx to the rx to ensure that the port can read what it writes. &nbsp;Looping back normally involves little more than&nbsp;connecting pins 2 &amp; 3 on the D-connector, if that is what you are using.&nbsp;</div><div><br></div><div>I would also be wary of the terminator character being sent by displayln; the meter might care about the difference between newline, linefeed, and carriage return.</div><div><br></div><div>Unicode may be an issue here, too. You might need to use&nbsp;(string-&gt;bytes/utf-8 &nbsp;"V00"). You can look at the signal on an oscilloscope to see if only four characters are being sent at the rate required by the meter.</div><div><br></div><div>rac&nbsp;</div><div><br></div><div>On Dec 30, 2011, at 2:59 PM, Gilbert Martinez wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I've been experimenting with Racket v5.2 and a GW Instek 8212 meter connected to my PC via COM1 (running WinXP SP3).<div><br></div><div>The meter responds to simple commands (e.g., "V00" &nbsp;terminated with a line feed is read voltage) and I've written simple programs in Python, VB, and even QuickBasic &nbsp;to query the device.</div>
<div><br></div><div>However, I've had no success in getting the device to respond from inside the Racket REPL.</div><div><br></div><div>I've pasted the code I'm using below:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><div>#lang racket</div></div><div><div><br></div></div><div><div><div>(let*-values&nbsp;</div><div>&nbsp; &nbsp; (((in out) (open-input-output-file "COM1" &nbsp;#:mode 'binary)))</div></div></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><div><div>&nbsp; (displayln "V00" out)</div></div></div><div><div><div>&nbsp; (printf "~C~a~n" #\tab (read-bytes 1 in))</div></div></div><div><div><div>&nbsp; (close-input-port in)</div></div></div><div><div><div>
&nbsp; (close-output-port out))&nbsp;</div></div></div></blockquote><div><br></div><div><br></div><div>Running from the interpreter just gives me the output below:</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div>#&lt;eof&gt;</div><div><div>&gt;&nbsp;</div></div></blockquote><div><br></div><div>A tester in-line with the serial cable shows I am actually writing to the port (I see a square-wave signal), so I know that I am at least writing to the port.&nbsp;</div>
<br><div>Any hints or pointers would be appreciated.</div><br></blockquote></div><br></body></html>