08-20-2019 08:10 AM
Hi Seabass,
apart from the valid comments on the datatype of your TermChar and message length:
08-20-2019 08:19 AM
@crossrulz wrote:
@Seabass666 wrote:
I changed the read Byte count into 20 and it worked.
But your message is at least 28 bytes. So you are not getting all of your data.
I think you have an issue with where you are setting the Termination Character. There is a coercion dot on the property node, telling me you are not casting your Line Feed constant into a U8 like is expected. You are likely casting to a I32, which will be coerced to 0 (would have to test to verify). Change that constant on the Type Cast to be a U8 representation.
This is exactly right - another question had exactly this problem. It's much easier to go ahead and just use the Configure Serial Port VI as GerdW suggested (at least, that's what I understood was the suggestion).
Your write commands may also be sending the end character twice (actually, I think you're trying to send this, but you need to set Message Based Settings > Send End Enable to true to have it pay attention to the ASLR End Out (and then you don't want to add \r or \n to your writes - they'll be "automatically" appended)).
The Configure Serial Port is much simpler and defaults to a Termination Char of LF on Reads (nothing for Writes), which then allows use easily with the code I suggested earlier (manually appending LF to your writes, large number of bytes for the Reads).
08-20-2019 08:41 AM - edited 08-20-2019 08:41 AM
@crossrulz wrote:I think you have an issue with where you are setting the Termination Character. There is a coercion dot on the property node, telling me you are not casting your Line Feed constant into a U8 like is expected. You are likely casting to a I32, which will be coerced to 0 (would have to test to verify). Change that constant on the Type Cast to be a U8 representation.
And here is the proof...
08-20-2019 09:00 AM
I tried your suggestions, and this is what it got.
Are these what you mean? Or do I misunderstand some?
08-20-2019 09:05 AM - edited 08-20-2019 09:08 AM
Hi Seabass,
I tried your suggestions, and this is what it got. Are these what you mean?
No!
You don't need this constant/TypeCast/PropertyNode at all!
Set any inputs (if needed, aka "different from default") at the SerialPortInit…
Or do I misunderstand some?
Still no display mode visible at all those string constants…
Still no autosizing for the cluster constant…
08-20-2019 09:22 AM - edited 08-20-2019 09:24 AM
If you double click on the Configure Serial Port VI, you'll see the values that are already set for you. You may need to right click on the property node and chose Name Format > Short Names (or similar) to get what you see on the main VI. Make sure not to save and overwrite your vi.lib version.
Regarding the typecast, firstly, you don't need it at all, but secondly, no - right click on the numeric constant and change representation to U8. The example crossrulz posted shows the difference, but if you place the two side by side you'll also see the change between typecast to U32 and then to U8 vs to U8 directly.
As a follow-up point, the display style visibility that GerdW has mentioned a couple of times is set by right clicking on a string constant (similar process for numerics) and then going to Visible Items > Display Style.
08-20-2019 10:12 AM
@Seabass666 wrote:
Are these what you mean? Or do I misunderstand some?
Just completely get rid of that VISA Instrument Property Node. The VISA Configure Serial Port has all of the default values you need, so you just need to call it as you have and then you are ready to write to and read from your instrument.
08-21-2019 07:56 AM
Thank you all!
I fixed it and the program worked.
08-21-2019 08:21 AM
11-06-2019 07:11 AM
Hi Seabass666,
If you need any more help with the Razorbill RP100, please feel free to to contact the company directly. We'd be interested in learning about your labview script too! https://razorbillinstruments.com/contact/