<div dir="ltr"><div>Ok thanks Paul,</div><div><br></div><div>I had never seen the use of &H to convert from ascii to hexadecimal. </div><div>that makes things pretty clear.</div><div><br></div><div>J<br><br>On Saturday, June 28, 2014 6:54:17 AM UTC-4, Paul Groot wrote:</div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir="ltr"><div><br></div><div>Jay,</div><div><br></div><div>You can use the WriteBytes function for this:</div><div><br></div><div><div>Dim arrData(4) As Integer</div><div>arrData(0) = 40</div><div>arrData(1) = 30</div>
<div>arrData(2) = 35</div><div>arrData(3) = 30</div><div>arrData(4) = &H2A</div><div><br></div><div>Serial.WriteBytes arrData</div></div><div><br></div><div>With some additional code you could make a nice function out of this that automatically calculates and adds the checksum value.</div>
<div><br></div><div>Best,</div><div>Paul</div><div><br></div></div><div><br><br><div class="gmail_quote">On 25 June 2014 22:20, Jay Hennessy <span dir="ltr"><<a onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;" href="javascript:" target="_blank" gdf-obfuscated-mailto="MV75OCguKX4J">tjay.h...@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir="ltr">Hi all,<div><br></div><div>Maybe someone can help me with this problem.</div><div><br></div><div>I want to send a string to a serial port to control a TMS machine during an EEG experiment. I already know how to send strings using Serial.Write</div>
<div><br></div><div>The problem is that the standards for the TMS machine require the last character of the string to be a check bit. You calculate it by first adding up the hexadecimal equivalents of the other characters then taking the inverse. This is now your check bit or check character added to the end of the string.</div>
<div><br></div><div>example: if i want to send @050</div><div><br></div><div>ascii      hex</div><div><br></div><div>@     =    40</div><div>0       =    30</div><div>5       =     35</div><div>0       =     30</div><div>
<br></div><div>40+30+35+30 = D5</div><div><br></div><div>so the inverse is = 2A</div><div><br></div><div>and 2A in hex is * in ascii</div><div>so I would send the string @050* and everything should work.</div><div><br></div>
<div>The problem is that if my check bit becomes a non-printable ascii character, how should I send it?</div><div><br></div><div>for example my check bit might be 1C in hex which is 'file seperator' in ascii. This isn't a character I can send using Serial.Write in Eprime (at least that I know of).</div>
<div>Can anyone think of a way around this problem?</div><div>I might be able to send bits instead of a string. Is sending bits something Serial.Write can do? can eprime convert things to bits?</div><div><br></div><div>Any help would be appreciated.</div>
<div><br></div><div>Thanks</div><span><font color="#888888"><div><br></div><div>jay</div></font></span></div><span><font color="#888888">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;" href="javascript:" target="_blank" gdf-obfuscated-mailto="MV75OCguKX4J">e-prime+u...@<wbr>googlegroups.com</a>.<br>
To post to this group, send email to <a onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;" href="javascript:" target="_blank" gdf-obfuscated-mailto="MV75OCguKX4J">e-p...@googlegroups.com</a>.<br>
To view this discussion on the web visit <a onmousedown="this.href='https://groups.google.com/d/msgid/e-prime/fb97098b-509e-403b-96a7-909c09c9ef67%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/e-prime/fb97098b-509e-403b-96a7-909c09c9ef67%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" href="https://groups.google.com/d/msgid/e-prime/fb97098b-509e-403b-96a7-909c09c9ef67%40googlegroups.com?utm_medium=email&utm_source=footer" target="_blank">https://groups.google.com/d/<wbr>msgid/e-prime/fb97098b-509e-<wbr>403b-96a7-909c09c9ef67%<wbr>40googlegroups.com</a>.<br>

For more options, visit <a onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;" href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/<wbr>optout</a>.<br>
</font></span></blockquote></div><br></div>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:e-prime+unsubscribe@googlegroups.com">e-prime+unsubscribe@googlegroups.com</a>.<br />
To post to this group, send email to <a href="mailto:e-prime@googlegroups.com">e-prime@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/e-prime/b4019093-1bd6-4702-95ee-700e93f40eab%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/e-prime/b4019093-1bd6-4702-95ee-700e93f40eab%40googlegroups.com</a>.<br />
For more options, visit <a href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.<br />