Host Engineering Forum
General Category => DirectSOFT => Topic started by: PStiles on September 28, 2010, 02:06:37 PM
-
I am trying to use a temperature sensor that outputs 1 Mv per degree. I have the sensor working on a F4-08AD Analog card on a 440 CPU. I am reading the voltage at the sensor and in data location V3000 and 3100, but the scaling seems to be off. For example at last reading the sensor was outputting 864 Mv and the reading in memory location V3100 is 80. This reading does increase and decrease with the temperature increase seen at the sensor. Would it be possible for someone to take a looka at the program below and maybe see where I went wrong?
PLC 440
// Rung 1
// Address 0
STR SP1
LDF X0 K8
BCD
LDF X34 K3
OUTX V3000
// Rung 2
// Address 7
STR SP1
LD V3000
MUL K1000
DIV K2200
OUT V3100
// Rung 3
// Address 12
END
// Rung 4
// Address 13
NOP
#BEGIN ELEMENT_DOC
"UW0","4096","",""
#END
-
Why aren't you reading the value from the input as shown in the manual? If you followed it would be LDF X0 K12.
-
Because if I us the K12 value, I do not get the correct result. I receive 921 on V3100.
-
OK, leave it at K12.
What is your setup of the analog card?
What ACTUAL voltage is at the first channel terminals?
What is the BCD reading in V3000?
-
I am only using channel 1 on this card until I can get this issue resolved. Card is setup for +2 to -2 Voltage with Unipolar. The BCD reading in V3000 is 2311 which is .891 Mv
-
+2 to -2 Voltage with Unipolar.
I don't see that as an option for the jumpering. The manual is hazy in that it talks about the -2 to +2 but then doesn't mention it anywhere alse. I think either the different parts were written by different people or they only changed one section.
-
My mistake, the card is setup for 1 to 5 volt input. Misread the manual
-
If you have a reading less than 1 volt (you said
.891 Mv
but I'm assuming you mean 891 mv) then a minimum setting of 1 volt wouldn't really work. Try 0-5 VDC settings.
-
Reconfigure card for the 0-5 volt unipolar. The reading in location V3000 is 1648, and the reading in location 3100 is 355. The sensor is at 821 millivolts.
-
I would expect 672 in V3000 for the 821 mv input. Are you viewing the value in V3000 at the same time that you have meter leads on the input terminal (thinking about meter loading effects.)
-
Yes meter is connected to the input of the card where the sensor is connected
-
As a side issue, is 821 mv reasonable for the temperature sensor? Thats 821 degrees according to your first post.
You didn't specify Kelvin, Celsius, Rankine, Farenheit?
Also for 1648 in V3000 you should get 749 in V3100 according to the program in your original post.
-
The readings are in Farenheit. I just looked at the sensor sheet, the sensor outputs +10mV/°F.
Specs from the data sheet.
For example, a
temperature reading of 75.3°F produces an analog signal on T10 of
(0.010V/°F x 75.3°F) = 0.753V
-
I looked at your program again. This exerpt:
STR SP1
LDF X0 K8
BCD
LDF X34 K3
OUTX V3000
if the module is in the first slot should be
STR SP1
LDF X0 K12
BCD
LDF X14 K3
OUTX V3000
the channel bits are near the top of the input word. You are referencing something else in the fourth line I posted.
-
I changes my program to reference the changes you suggested. Now V 3000 shows 1652, and V3100 shows 356 the sensor is outputting 828 millivolts.
-
You have two problems.
1. Why isn't the measured voltage at the input pins being read correctly?
Please verify the module slot and ALL jumper settings.
To see the raw data do
STR SP1
LDF X0 K12 (don't do a 'BCD')
LDF X14 K3
OUTX V - something else (a free set of 4 memory positions)
Read the result using a datatable with the setting as 'decimal'
2. The second problem is - why doesn't the MUL/DIV produce, in V3100, a result a little less than 1/2 of that in V3000? Is something else also affecting V3100? Can you post your entire program?
2.
-
Here is the way the card is configured.
Number of channels: No jumpers installed = 1 Channel
Voltage or current selection = Jumper off on channel 1, on on all the rest
Signal selection range has a jumper on the 2 post for 0-5 Volts.
Polarity jumper is set to unipolar.
Program
PLC 440
// Rung 1
// Address 0
STR SP1
LDF X0 K12
BCD
LDF X14 K3
OUTX V3000
// Rung 2
// Address 7
STR SP1
LD V3000
MUL K1000
DIV K4095
OUT V3100
// Rung 3
// Address 12
END
// Rung 4
// Address 13
NOP
#BEGIN ELEMENT_DOC
"UW0","4096","",""
#END
-
1. Even with 4095 as the divisor the result in V3100 doesn't jive. That's a puzzler.
2. Re-confirm the slot next to the CPU.
3. You have 24VDC power to the card attached?
I'm running out of suggestions. Have you tried AD phone support?
-
The issue was the card was in the slot marked 1 which I guess is the 2nd slot. I moved the card to the first slot, next to the processor, and the readings are correct. Two questions, first what do I need to change to have the card in the 2nd slot from the cpu and what do I need to add to have 3 additional channels?
Thanks for your help.
-
It depends on what is in the first slot. You must have an output, or a integral number of 16 bit inputs between the card and the CPU. If you have outputs between the CPU and the card then you won't have to change anything. Let's say you have 16 input bits (X0 - X17) between the CPU and this analog card:
Change
STR SP1
LDF X0 K12
BCD
LDF X14 K3
OUTX V3000
to
STR SP1
LDF X20 K12
BCD
LDF X34 K3
OUTX V3000
Actually just like the manual shows.
If you have just 8 inputs (X0 - X7) then you would have to change the card to a 16 bit one. Another possibility might be the manual I/O setup but I won't recommend that.
For more channels just change the 'number of channels' jumpers. The code you have will automatically send the values from channels 2,3 and 4 to V3001, V3002 and V3003. If it isn't clear how it's doing that just post back.
-
I will have a D4-DCM module in physical slot 1.
-
I don't think the D4-DCM consumes any I/O so this program section:
STR SP1
LDF X0 K12
BCD
LDF X14 K3
OUTX V3000
will be fine to grab the analog values.
-
Thanks again for your help.
-
One more question regarding analog inputs. I am reading x1 perfectly and now ready to connect sensor to the 2nd to the 4th inputs of my card. I have written the following program but it is not reading the values. I suspect it is because of the input addressing, but not sure. Below it ths programing.
PLC 440
// Rung 2
// Address 21
STR SP1
LDF X1 K12
BCD
LDF X14 K3
OUTX V3000
// Rung 3
// Address 28
STR SP1
LD V3000
MUL K1000
DIV K4095
OUT V3100
// Rung 4
// Address 33
STR SP1
LDF X10 K12
BCD
LDF X14 K3
OUTX V3001
// Rung 5
// Address 40
STR SP1
LD V3001
MUL K1000
DIV K4095
OUT V3101
// Rung 6
// Address 45
STR SP1
LDF X3 K12
BCD
LDF X14 K3
OUTX V3002
// Rung 7
// Address 52
STR SP1
LD V3002
MUL K1000
DIV K4095
OUT V3102
// Rung 8
// Address 57
STR SP1
LDF X4 K12
BCD
LDF X14 K3
OUTX V3003
// Rung 9
// Address 64
STR SP1
LD V3003
MUL K1000
DIV K4095
OUT V3103
-
I really don't know what you are doing. The one set of instructions in Reply #21 will, on successive scans, read ALL FOUR channels into V3000 then V3001 then V3002 the V3003. You don't need to repeat or modify them.
-
I am adding 3 more sensors on channels 2-4.
-
I got that, but you don't need to moddify the program. The one set of instructions cycle through the 4 channels, reading them and writing their value to th 4 memory locations.
-
I have modified my program to just scan the 4 inputs. The first input reads with no problem, but the other three do not change. Below is the programming.
PLC 440
// Rung 1
// Address 0
STR SP1
FOR K4
// Rung 2
// Address 3
STR SP1
LDF X0 K12
BCD
LDF X14 K3
OUTX V3000
// Rung 3
// Address 10
NEXT
// Rung 4
// Address 11
END
// Rung 5
// Address 12
NOP
-
Get rid of
STR SP1
FOR K4
and
NEXT
The instructions left as they stand will bring in all 4 channels.
-
Do I have to have a rung for each memory location that shows the following to scale the output?
// Rung 9
// Address 64
STR SP1
LD V3003
MUL K1000
DIV K4095
OUT V3103
-
I modified the programming to just read the inputs. I have sensors hooked to the first 4 inputs. Memory location V3000 that is associated to input 1 is showing 326. Memory location 3001, which is associated with input 2, is showing 2374. Both inputs increase when you hold the sensor in your hand. Not sure why input 2 (Memory location is showing this, it should be very close to input 1.
I measure the voltage on both sensors and they are .3 millivolts off.