You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old September 9th, 2019, 10:51 AM   #1
andepand
Member
Netherlands

andepand is offline
 
Join Date: Jan 2017
Location: Amsterdam
Posts: 67
Omron CJ2M string data from vision system

Hi Guys,

Question:

I'm using an Omron CJ2M to recieve a 40 character tekst string from a Keyence CV-X 420 vision camera.
The keyence uses two words for one ASCII character which I can not change.
So the first character is stored in D24, the second in D26, third in D28 etc.

When I send the character '1' to D24, which is set to STRING, it is stored in the lowest 8 bits, so the HEX value is 0031.

For some reason it is not regonised as an ASCII character. When I shift 8 bits to the left making the HEX value 3100, it's regonised as a '1'.

I'm pretty lost here, offcourse I can move the lowest 8 bits to the highest 8 bits and loop it for all adresses but I have a feeling I'm missing something here.

Any ideas? Thanks in advance!
  Reply With Quote
Old September 9th, 2019, 11:18 AM   #2
gtsuport
Member
United States

gtsuport is offline
 
Join Date: Feb 2005
Location: Grand Rapids, MI
Posts: 1,288
Omron stores ASCII as hex in D memory.
Hex 31 is an ASCII 1.


You can use instructions to change the Hex to ASCII and / or
change the display radix in CX-Programmer.
  Reply With Quote
Old September 9th, 2019, 12:22 PM   #3
andepand
Member
Netherlands

andepand is offline
 
Join Date: Jan 2017
Location: Amsterdam
Posts: 67
Yes, that I know.

I work in ST and D24 is set as STRING. When I view D24 in my program or in watch window, it shows a quotation mark, meaning there’s no string data.

When I view the adress in memory I can see the Hex value 0031 is stored there.

Changing the bits manually so that it makes a value of 3100 gives me a 1 string in watch window and my program monitor view.

Last edited by andepand; September 9th, 2019 at 12:36 PM.
  Reply With Quote
Old September 9th, 2019, 12:31 PM   #4
andepand
Member
Netherlands

andepand is offline
 
Join Date: Jan 2017
Location: Amsterdam
Posts: 67
0000000000110001 = Hex 0031 = No string

0011000100000000 = Hex 3100 = String “1”

The data send by the Keyence gives me the upper result.

Last edited by andepand; September 9th, 2019 at 12:45 PM.
  Reply With Quote
Old September 9th, 2019, 01:11 PM   #5
gtsuport
Member
United States

gtsuport is offline
 
Join Date: Feb 2005
Location: Grand Rapids, MI
Posts: 1,288
You can use the MOVD instruction to move the information to the desired location.
  Reply With Quote
Old September 9th, 2019, 01:22 PM   #6
andepand
Member
Netherlands

andepand is offline
 
Join Date: Jan 2017
Location: Amsterdam
Posts: 67
That was my last resort. I just cannot inmagine there not being any other solution.
The Keyence is pretty restricted in itís adressing and data settings but the Keyence manual shows it should be possible. In the example shown, the adress is not set to STRING but to ASCII, which is not a data type I can select.

I asssume itís an old CX programmer version or whatever
  Reply With Quote
Old September 9th, 2019, 01:25 PM   #7
gtsuport
Member
United States

gtsuport is offline
 
Join Date: Feb 2005
Location: Grand Rapids, MI
Posts: 1,288
Current version of CX-Programmer is 9.7 (I think).
  Reply With Quote
Old September 9th, 2019, 01:26 PM   #8
andepand
Member
Netherlands

andepand is offline
 
Join Date: Jan 2017
Location: Amsterdam
Posts: 67
I mean the one they used for the keyence manual, mine is up to date.
  Reply With Quote
Old September 9th, 2019, 01:29 PM   #9
gtsuport
Member
United States

gtsuport is offline
 
Join Date: Feb 2005
Location: Grand Rapids, MI
Posts: 1,288
What is your communication type?
Serial, Ethernet/IP, etc?
  Reply With Quote
Old September 9th, 2019, 01:35 PM   #10
andepand
Member
Netherlands

andepand is offline
 
Join Date: Jan 2017
Location: Amsterdam
Posts: 67
I’m using Ethernet/IP, the data is recieved by the plc only put in the lowest 8 bits.
Which makes sense I would say, but 0031 is not accepted as an ASCII character
  Reply With Quote
Old September 9th, 2019, 01:46 PM   #11
gtsuport
Member
United States

gtsuport is offline
 
Join Date: Feb 2005
Location: Grand Rapids, MI
Posts: 1,288
Problem is the "00" before the "31"
00 is a null character and often end of line.
I agree this really makes no sense on the Keyence end.
MOVD can be used to fix the issue, just more work for you.
  Reply With Quote
Old September 9th, 2019, 02:24 PM   #12
andepand
Member
Netherlands

andepand is offline
 
Join Date: Jan 2017
Location: Amsterdam
Posts: 67
Mostly it will mess up the sleekness of my program
  Reply With Quote
Old September 9th, 2019, 02:40 PM   #13
andepand
Member
Netherlands

andepand is offline
 
Join Date: Jan 2017
Location: Amsterdam
Posts: 67
Thanks for your time and advice anyway!
For now Iíll work arround it by moving the data.

If anyone else is familiar with this problem, let me know.
  Reply With Quote
Old September 21st, 2022, 01:55 AM   #14
gedds1993
Member
United States

gedds1993 is offline
 
Join Date: Jul 2012
Location: South East USA
Posts: 21
Not super familiar with Omron, but with Ethernet/IP are you using explicit messaging? The way AB does it at least with CCW returns bytes with stored data, which is either Boolean or DINT data. So rather easy to just pull from the registry and do what you want with the data.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
ControlLogix 3rd Party eds files AutomationPrimer LIVE PLC Questions And Answers 8 March 19th, 2015 09:18 AM
Crimson C-language program examples ceilingwalker LIVE PLC Questions And Answers 17 February 3rd, 2015 08:16 AM
SLC5/05 ASCII to String Data Conversion tspisak LIVE PLC Questions And Answers 1 September 11th, 2007 07:39 AM
Help with Profibus CPU315-2 DP Rafael Guedes LIVE PLC Questions And Answers 5 September 3rd, 2007 07:44 AM
Omron Vision Sensor Tim LIVE PLC Questions And Answers 9 October 25th, 2003 12:34 AM


All times are GMT -4. The time now is 03:51 PM.


.