AD DirectSoft 5 BCD Question

JohnMDO

Member
Join Date
Jun 2012
Location
Los Angeles, CA
Posts
4
This is my first post guys so thanks for any help in advance.

I'm trying to modify some code off of some existing equipment. Since I don't have too much experience with BCD and how the AD plcs handle them I'm a little stuck and was wondering if anyone can just help decipher what the current code is doing so I can modify it. I've attached the two lines of code that are confusing me with the notes the programmer left. Thanks again.
 
The first rung, at PLC startup, stores two numbers into two memory locations.

The second rung uses the contents of these memory locations to perform math.

The MUL counld have used an argument of K819 and the DIV could have used an argument of K20.

There may be a couple of reasons why the programmer chose to do it this way.

Doing it this way better documents (via the Nickname and comment) the function of the two numbers.

If these same numbers had been used as constants (K) in many places in the code then needed to be changed for some reason it is much easier to just change the instructions which appear in the first rung than to change a 'K' constant in every use in the program.

If you have other questions please post back.
 
So basically what is happening is that there is some X value being multiplied by K819 and then divided by K20?

X*K819/K20 = V2020

Does the PLC convert these to BCD just to do the math? My guess now is that the constants have some physical value important to the application such as motor ratio or a scale value. Thanks.
 
The basic math instructions (those that don't have 'B' or 'BD' on the end) expect BCD values. The entry of a constant using 'K' is inherently hex or BCD.

If you were using 'binary' math (instructions ending in 'B' ort 'BD') you (the programmer) would have to convert a decimal number to its hex equivalent to enter it as a constant.

An important point to remember is that there is no mechanism to directly tell the format of a number which exists in V memory. It is up to the programmer to keep these identified using comments. Especially document the second used word of 2 word values (double BCD, double binary or Real).
 
Last edited:

Similar Topics

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...
Replies
6
Views
3,346
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,177
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,486
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,263
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,338
Back
Top Bottom