DirectSoft 6 Math and negative results with BCD

labeledas

Member
Join Date
Apr 2010
Location
Peace River Alberta
Posts
536
Hi all,

I got thrown into a project using a D2-240 CPU, never used Directlogic or AD before this morning and am fumbling through it but have a few questions regarding AD's handling of negative math results using BCD format.

This is an upgrade/Modification to an existing project and I don't have access to the hardware to just test this out.

I don't need negative results but just wondering what happens if the calculation results in a negative number.

For example:
LD V2001
SUB V2022
OUT V2002

IF V2001 = 10
V2022 = 5

V2002 will equal 5

What happens when
V2001 = 5
V2022 = 10

am i right to assume from my readings that
V2002 will = 5
With SP70 being set to 1
or will it cause a fault


again I am not familiar with this brand, I usually only with with the Logix 5000 platform, and am under the gun to get this done as I am the 'PLC Guy' and am supposed to show up to site with the program working and this is the only thing really holding me up at this point

Thanks in Advance
 
Last edited:
I occasionally have to deal with the possibility of negative results. If it looks likely I do an inline comparison of the two operands to affect a bit. Then I use the bit to determine the later actions. I'm not sure about the resultant flags. The result would be interpreted as a very large number.
 
If you think the number might go negative, you really should convert to Binary or Real data types before doing any math. Then you can check the upper bit to see if it is on (negative) before reconverting back to BCD.
 
You are correct. You can convert to Binary, but you cannot do the binary math...
Just put your SP70 immediately below your SUB instruction, so that you can respond accordingly.
 

Similar Topics

I am not a Automation Direct programmer. I have done a lot of RS500 I have the DS5 software and I am able to look at the program. I am reaching...
Replies
10
Views
1,160
Hello, I have a couple of problems with the directsoft 6 software. I couldn't find a previous answer, and uninstalling and reinstall hasn't...
Replies
4
Views
1,466
Hello all, We have an old AutomationDirect DL405 (CPU 440) PLC, and we've been using DirectSOFT 5.3. Since we are NOT upgrading this PLC for a few...
Replies
6
Views
2,254
Hey everyone, Working on a system with a Koyo DL06 processor and it's my first experience with them. I have DirectSoft 6 and we got the program...
Replies
5
Views
2,311
All, I have a program that I am adding the counter on Rung 83 (see attached). The reset logic is exactly the same as on rung 84, but I can't seem...
Replies
16
Views
3,933
Back
Top Bottom