Host Engineering Forum
General Category => DirectSOFT => Topic started by: U.G. on February 14, 2012, 10:28:02 AM
-
Hello people of Host Engineering,
New person here. I have most of my experience in LabVIEW, Matlab and C#, but this is my absolute first time I am working with a PLC and, it is not what I expected and I was wondering if someone could help.
I have a DD0 06 PLC from Automation Direct. It is controlling four servos that take 0-5VDC as a function of angle and two motor controllers that take a binary signal for direction and a 0-5VDC for speed. I have 4 potentiometers that output 0-10VDC and various end stop buttons.
I have added cards to the box to do 10x 0-5VDC output, 8x 0-10VDC input, 4 thermocouple (for a future part of the program) and a display screen.
I have been researching how to do ladder logic, but it has been a sharp learning curve and I don't know anyone with any experience and how to contact anyone. Unlike other programs I have worked with, I can't figure out how to test or experiment with the code before I upload it.
I have been reading the manual for DirectSOFT5 and for the PLC and I have a full pseudo code layout of what I would want the code to do (with stages, comparators, jumps, etc.), but I am at an impasse with some issues.
I realize that I can assign or read various parts of V-memory with the ANLGIN or ANLGOUT. How can I assign a piece of V-memory to a value I want.
Here is an example of a problem I can't seem to solve. I output 5VDC to the motor and read the pot until the voltage from the pot reaches a specific value.
How can I tell the program to compare a voltage, for which I do not know what form the voltage is in? How do I say I want V410 to be 5 volts? Am I supposed to tell the machine that V410 is the value 5 for 5V or some sort of binary or hex value which is a function of the full travel? How do I assign V memory to specified values?
Most likely what is occurring is that I am missing something obvious. Could someone point me to somewhere where I could find examples of ladder logic code (other then the ones that come with DirectSOFT5) which deal with analog input/output?
And as for why I chose ladder logic? Because I know I will be using ladder logic in the future. I need to learn this some time.
Sincerely
U.G.
-
Once the ANLGIN instruction is executed the analog input will automatically show up in the V registers specified in the 'Input Data Address' section of that instruction. The appearance of the data will be dependent on the setup of the module. Read the analog module documentation carefully.
Using that information you will have raw data. Scaling will be used to convert the raw data into 'Engineering Units'. The ANSCL(B) commands receive the raw reading and convert it.
Comparison can be done using the inline ( > , < , = etc) commands.
To move a constant value into a V memory location you can use the MOVE(D/W) IBox commands or use a LD command with a constant then OUT to the V memory location.
At some point you will just have to send a program into the PLC and see what happens. Start with a simple section, for example, just reading an analog input. Add a rung to compare it to a value. Turn on an internal bit according to the results. Do this until you are comfortable with the number formats.
-
Concerning the loading of a certain value into v-memory, use the command "LD" (load)then type the value you wish to enter preceded by the letter "k" (a constant BCD value), for example: LD k2048. Then enter an "OUT" (send the value in the accumulator to:)and type the v-memory location where you wish to place the value "V2000".
SP0 -----------
---| |--------------| LD k2048 |
| -----------
| ------------
--| OUT V2000 |
------------
This example will examine sp0 on every scan of the PLC, for the first scan only sp0 will contain a "1" and the PLC will load the bcd constant of 2048 into the accumulator and out into memory location v2000. Unless you write a new value to v2000 somewhere else in your program, v2000 will always contain "2048" and you can use it anywhere you want as a compare or for math instructions. Hope this helps, btw I believe there are some free videos on automationdirect.com that may help you to get a good start.