Help - Search - Members - Calendar
Full Version: Help with indirect addressing bits
Forums.MrPLC.com > PLCs and Supporting Devices > Omron > CX-Programmer
stl
Hi,
I'm having a problem understanding what i'm doing wrong with some code i wrote,

Purpose:
W30 contains message bits used in the PLC Program
W30.0 = Default Message
W30.1 = Message 1
W30.2 = Message 2
etc

What i need to do is convert the bits to a message Number - e.g
W30.1 is on so W40 = 1
W30.7 is on so W40 = 7
etc

I've attached the code i wrote but it appears to do nothing when bits are high

I would appreciate it if someone could give me some pointers??

I've also read the Indirect addressing downloads - but i'm still puzzled

Thanks


scottmurphy
QUOTE(stl @ Apr 16 2009, 02:15 AM) [snapback]81112[/snapback]


What i need to do is convert the bits to a message Number - e.g
W30.1 is on so W40 = 1
W30.7 is on so W40 = 7
etc


Thanks


If that is all you after, then try the DMPX instruction. This does exactly that, can also be used in the reverse for setting a bit based on a value. Is limited to the 16 bits however.





stl
QUOTE(scottmurphy @ Apr 16 2009, 09:10 AM) [snapback]81113[/snapback]

QUOTE(stl @ Apr 16 2009, 02:15 AM) [snapback]81112[/snapback]


What i need to do is convert the bits to a message Number - e.g
W30.1 is on so W40 = 1
W30.7 is on so W40 = 7
etc


Thanks


If that is all you after, then try the DMPX instruction. This does exactly that, can also be used in the reverse for setting a bit based on a value. Is limited to the 16 bits however.

Thanks Scott - unfortunately ill definately need to go over 16 bits
scottmurphy
QUOTE(stl @ Apr 16 2009, 03:22 AM) [snapback]81114[/snapback]


Thanks Scott - unfortunately ill definately need to go over 16 bits


You could always get a bit creative then... blush.gif

What PLC model are you using?
stl
QUOTE(scottmurphy @ Apr 16 2009, 09:48 AM) [snapback]81115[/snapback]

QUOTE(stl @ Apr 16 2009, 03:22 AM) [snapback]81114[/snapback]


Thanks Scott - unfortunately ill definately need to go over 16 bits


You could always get a bit creative then... blush.gif

What PLC model are you using?


Hi Scott,
SYSMAC CS1G CPU 44-V1
Thanks
scottmurphy
QUOTE(stl @ Apr 16 2009, 03:57 AM) [snapback]81116[/snapback]


Hi Scott,
SYSMAC CS1G CPU 44-V1
Thanks


Is this a new CPU, or an existing. Does it support Function Blocks? From memory, the version no's that supported FB's were V3 and later. If so, then you could do something is Structured Text. Am I correct by your username that you are familiar with ST/STL?

Also, I have just checked the manual on the DMPX, it can do up to 32 words as the source, let me know if you need some more help setting the control word.

It must be pretty intense if there is more bits than that? May be worth breaking it up a bit more so it is more manageable and readable?

To do this properly, the bits must be consecutive, how many consecutive bits are you using? Im assuming that these are alarm or step bits of some description?

What is your end goal/result?
stl
QUOTE(scottmurphy @ Apr 16 2009, 10:09 AM) [snapback]81117[/snapback]

QUOTE(stl @ Apr 16 2009, 03:57 AM) [snapback]81116[/snapback]


Hi Scott,
SYSMAC CS1G CPU 44-V1
Thanks


Is this a new CPU, or an existing. Does it support Function Blocks? From memory, the version no's that supported FB's were V3 and later. If so, then you could do something is Structured Text. Am I correct by your username that you are familiar with ST/STL?

Also, I have just checked the manual on the DMPX, it can do up to 32 words as the source, let me know if you need some more help setting the control word.

It must be pretty intense if there is more bits than that? May be worth breaking it up a bit more so it is more manageable and readable?

To do this properly, the bits must be consecutive, how many consecutive bits are you using? Im assuming that these are alarm or step bits of some description?

What is your end goal/result?


Hi Scott

I believe it is an old CPU, It doesnt support FB, and the options for ST or SFC Programs are greyed out.

If the DMPX instruction supports 32 words it should easily be enough and Yes all the Message bits are consecutive.

My background is Siemens Step7 - so im familar with most languages and FB's etc

The program currently has a message bit for each Input state - all conditions including priority are coded into the particular message rung - this is already coded.

Currently there are 52 message bits.

I need to send a message number to a Robot which will display the Text for dignostic purposes
e.g
Message 1: Waiting for Sensor XXX On (Clamp 5 Off)

I only have a single Byte to play with on the Robot side which is good for 255 messages.

Thanks for your help - I'd never seen any Omron gear prior to this week!

james_applied
You could allways use registers, eg IR0,DR0

Use MOVR command eg

MOV D29203 DR3 (value in D29203 is word offset)
MOV DR3,IR12 W100 to move word

MOVR W100.00 IR11 to move bits
MOV D29202 DR2 (value in D29202 is bit offset)
KEEP DR2,IR11

MOV W100 DR3,IR12 to move word back


Extracted from some working code you may have play a bit to get it working as i have removed the stuff you dont need.



scottmurphy
QUOTE(stl @ Apr 16 2009, 04:31 AM) [snapback]81119[/snapback]


Hi Scott

I believe it is an old CPU, It doesnt support FB, and the options for ST or SFC Programs are greyed out.


No problem, going down this path would take a little bit of learning, moreso for the way Omron works and does things compared to others.

QUOTE

If the DMPX instruction supports 32 words it should easily be enough and Yes all the Message bits are consecutive.


I have just tried this with 64 bits, and seems to work as intended. You may want to do some testing 1st, as from what I have just tested it takes priority on the highest bit value in the array. This may/may not be a problem for you? You could add a bit of 'priority checking' code to overcome this if needed.

QUOTE

The program currently has a message bit for each Input state - all conditions including priority are coded into the particular message rung - this is already coded.

Currently there are 52 message bits.

I need to send a message number to a Robot which will display the Text for dignostic purposes
e.g
Message 1: Waiting for Sensor XXX On (Clamp 5 Off)

I only have a single Byte to play with on the Robot side which is good for 255 messages.


Then this should work, if it is only for diagnostics, once one of the conditions clears, then the next one takes over...

QUOTE

Thanks for your help - I'd never seen any Omron gear prior to this week!


Providing you can interpret the manuals, you will start to understand things. They do things differently than others, but that is the norm with different manufactures....





stl
QUOTE(scottmurphy @ Apr 16 2009, 10:49 AM) [snapback]81121[/snapback]

QUOTE(stl @ Apr 16 2009, 04:31 AM) [snapback]81119[/snapback]


Hi Scott

I believe it is an old CPU, It doesnt support FB, and the options for ST or SFC Programs are greyed out.


No problem, going down this path would take a little bit of learning, moreso for the way Omron works and does things compared to others.

QUOTE

If the DMPX instruction supports 32 words it should easily be enough and Yes all the Message bits are consecutive.


I have just tried this with 64 bits, and seems to work as intended. You may want to do some testing 1st, as from what I have just tested it takes priority on the highest bit value in the array. This may/may not be a problem for you? You could add a bit of 'priority checking' code to overcome this if needed.

QUOTE

The program currently has a message bit for each Input state - all conditions including priority are coded into the particular message rung - this is already coded.

Currently there are 52 message bits.

I need to send a message number to a Robot which will display the Text for dignostic purposes
e.g
Message 1: Waiting for Sensor XXX On (Clamp 5 Off)

I only have a single Byte to play with on the Robot side which is good for 255 messages.


Then this should work, if it is only for diagnostics, once one of the conditions clears, then the next one takes over...

QUOTE

Thanks for your help - I'd never seen any Omron gear prior to this week!


Providing you can interpret the manuals, you will start to understand things. They do things differently than others, but that is the norm with different manufactures....

Hi Scott - What value did you use in the control word - i tried 0100 but the result stays at zero?
I'm using settings from manual W340-E1-15+CS CJ Series+InstrRefManual.pdf

James
Thanks - i needed an example using IR,DR to learn from

Thanks again

QUOTE(stl @ Apr 16 2009, 11:02 AM) [snapback]81123[/snapback]

QUOTE(scottmurphy @ Apr 16 2009, 10:49 AM) [snapback]81121[/snapback]

QUOTE(stl @ Apr 16 2009, 04:31 AM) [snapback]81119[/snapback]


Hi Scott

I believe it is an old CPU, It doesnt support FB, and the options for ST or SFC Programs are greyed out.


No problem, going down this path would take a little bit of learning, moreso for the way Omron works and does things compared to others.

QUOTE

If the DMPX instruction supports 32 words it should easily be enough and Yes all the Message bits are consecutive.


I have just tried this with 64 bits, and seems to work as intended. You may want to do some testing 1st, as from what I have just tested it takes priority on the highest bit value in the array. This may/may not be a problem for you? You could add a bit of 'priority checking' code to overcome this if needed.

QUOTE

The program currently has a message bit for each Input state - all conditions including priority are coded into the particular message rung - this is already coded.

Currently there are 52 message bits.

I need to send a message number to a Robot which will display the Text for dignostic purposes
e.g
Message 1: Waiting for Sensor XXX On (Clamp 5 Off)

I only have a single Byte to play with on the Robot side which is good for 255 messages.


Then this should work, if it is only for diagnostics, once one of the conditions clears, then the next one takes over...

QUOTE

Thanks for your help - I'd never seen any Omron gear prior to this week!


Providing you can interpret the manuals, you will start to understand things. They do things differently than others, but that is the norm with different manufactures....

Hi Scott - What value did you use in the control word - i tried 0100 but the result stays at zero?
I'm using settings from manual W340-E1-15+CS CJ Series+InstrRefManual.pdf

James
Thanks - i needed an example using IR,DR to learn from

Thanks again

Got it i think 1110 !!
stl
QUOTE

Got it i think 1110 !!


Maybe not sad.gif works ok on the first 16bits only - back to the manual
stl
Gave up with the DMPX instruction and went back to indirect addressing - its not pretty but it works dancered.gif
scottmurphy
QUOTE(stl @ Apr 16 2009, 08:32 AM) [snapback]81131[/snapback]

Gave up with the DMPX instruction and went back to indirect addressing - its not pretty but it works dancered.gif


Hi Stl,

Sorry, shutdown the PC for the night.... The value that I used was #1010, so you were pretty close.

Is good that you got the Indirect using Index Registers working, another 'feather in the cap' as they say.

The beauty of the DMPX is that it only requires 1 rung!!

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.