man31

NX1P2 Hex to ASCII coversion

5 posts in this topic

Hello people!

I'm using a NX1P2 controller combined with a CIF105 serial card installed on it. For my project, I get some data that are in ASCII form and I want to keep that form when are extracted in a .csv file.

I have established the communication for getting the data but, the problem is that I cannot extract the data in the ASCII form. Data extraction comes in Hex form. I use the NX_SerialRcv instruction for the communication and the AryToString conversion for the data. When using the Watch Tab Page I can display the data in ASCII form but, as far as I understand, this is only for online monitoring.

I went through topics here and OMRON manuals for finding any Hex to ASCII conversion instruction but the only info I came across was for CX controllers which cannot be implemented to NX controller.

Is there any similar instruction for NX controller or I should create a new Library for the conversion?

Any tips and/or a sample would be highly appreciated!

Thanks! Man31    

Share this post


Link to post
Share on other sites

Have you considered that excel can convert Hex to Ascii with a macro.

I realize this puts the data in a spreadsheet but not a csv file, perse/

Share this post


Link to post
Share on other sites

Are you sure you need conversion?  ASCII is simply byte data.  What technology are you using to read the bytes to then produce the CSV?

Share this post


Link to post
Share on other sites

As pturmel pointed out, it's not really a conversion. You'll need to move it to a STRING[] data type.

Mr_PLC_ByteToASCII.JPG.7258860c26fe66ce3

Share this post


Link to post
Share on other sites

Hello everyone!

On 14/9/2021 at 4:40 PM, BobLfoot said:

Have you considered that excel can convert Hex to Ascii with a macro.

I realize this puts the data in a spreadsheet but not a csv file, perse/

I know this macro but for the project, the data stored in the SD card of the controller, I want to be sent via email and to avoid any further conversion by myself.

On 14/9/2021 at 5:01 PM, IO_Rack said:

As pturmel pointed out, it's not really a conversion. You'll need to move it to a STRING[] data type.

You are both right! As I stated, I use the AryToString function to get the form that I want but apparently I set the wrong variable for saving data in the FilePut instruction..!

Works great!

Thanks all of you! I'm sure that I'm going to post again for future questions on my project :-D

Cheers! Man31

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now