Sign in to follow this  
Followers 0
OdinPT

Sequence With 3 Digit

10 posts in this topic

Hi people, I have done a program that compares the 2 Digit sequence from a Scanner reading to the last scanner reading. I move this 2 digit from the read result to a new Word and then i do a compare with the last read, and to a total sequence number, as in the first 2 pictures. Well after some help from some forum users it's done !!! But i have a last problem... i need to controll 3 number sequence... and then i can't compare with CMP since it occupyes more then a word :|, im very noob in the PLC world... is there a way to compare the values in the (D530&D531) and (D540&D541). Or treat them as only a value ? Is there any way to do this ? there is an example of the actual reading in the last picture. Sorry for my english... i can try to explain more clearly if there is any dought. Thanks.

Share this post


Link to post
Share on other sites
How about CMPL - compare long.

Share this post


Link to post
Share on other sites
Well i can't seem to get the right compare with CMPL... For example this situation: The value in D542 has to be = to the value in (D572 + 1) in the picture below. The +1 is in the D552 Position (can't see in text mode) That's when i have the 2 digit.. i can +B(404) to the D572 an then compare the D542 with D572. With 3 Digits i don't know how to do that... or more simple... how can i do the +B(404) with the 3 digits occupying the 2 words ? Thanks. Edited by OdinPT

Share this post


Link to post
Share on other sites
Hi OdinPT, Just as a side note: when you want to use a fixed number in an instruction, you don't necessarily have to specify a word (DM) that holds this value. Instead of entering the D542, you can also enter the value you want to be added, in this case #1. # sign indicates use of a BCD value, & indicates use of an decimal (integer) value. Now to your question; if you want to add a double word, use the +BL instruction. Be careful not to overlap words when using instructions with double words! For instance: So this instruction will do the following: (D542,D543) + 1 = (D572,D573) Instructions that use double words always need the operand words to be consecutive. I suggest you download the CS-CJ Instructions Reference Manual, it is a very good reference for using instructions. Hope this helps!

Share this post


Link to post
Share on other sites
Hi, I was seeing this instruction :), ok i will study a little bit more, as soon as i complete this program i will put it here in the forum and make a full description of what it does. Thanks for all the help.

Share this post


Link to post
Share on other sites
Yet ! As you can see in the Picture im doing the sum to the D540 +1, the D571 should be .899 and it is .998, is adding the 1 in the first left digit and it should be in the first right. I understand that it starts from the left to right, but is there any way to overcome this ? to do the normal sum ? Other thing... even if i can do that... when i sum +1 to the value .899 it should appear .900 and it appears .89@, i think that is because is BCD and not normal real values... Other problem Thanks. Edited by OdinPT

Share this post


Link to post
Share on other sites
There appears to be something wrong with your monitoring window - there are only 2 digits showng. If set up for BCD each word will show 4 digits - if binary there will be 5 digits I think in each channel. What word type have you set up to monotor in the window?

Share this post


Link to post
Share on other sites
The monitor is set up to Text because if i put it in Hexa is more dificult for me to understand what im reading... but yet..for example 98 TEXT is = to 3938 Hexa so its the same i have to work with 2 words. Thanks.

Share this post


Link to post
Share on other sites
Hex is really pretty easy. Use the Windows calculator to convert. Have you tried BCD? ASCII (text) may be giving you wrong readings.

Share this post


Link to post
Share on other sites
OdinPT, download this tool. It helps understanding and converting HEX values to binary and decimal. This tool will help you translate the ASCII values to the HEX equivalents. This explains ; you are monitoring in text and your ladder instructions are using HEX values! Adding #1 in a +B instruction does not mean the text value of the word you are monitoring will increase by 1! This is a fundamental thing you must understand.

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
Sign in to follow this  
Followers 0