News:

  • December 05, 2024, 05:56:07 AM

Login with username, password and session length

Author Topic: Analog Input  (Read 15575 times)

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Analog Input
« Reply #15 on: September 29, 2010, 11:10:36 AM »
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.
« Last Edit: September 29, 2010, 11:15:29 AM by b_carlton »
An output is a PLC's way of getting its inputs to change.

PStiles

  • Full Member
  • ***
  • Posts: 31
Re: Analog Input
« Reply #16 on: September 29, 2010, 06:09:06 PM »
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

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Analog Input
« Reply #17 on: September 29, 2010, 07:11:39 PM »
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?

An output is a PLC's way of getting its inputs to change.

PStiles

  • Full Member
  • ***
  • Posts: 31
Re: Analog Input
« Reply #18 on: September 29, 2010, 08:02:49 PM »
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.

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Analog Input
« Reply #19 on: September 29, 2010, 10:30:06 PM »
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.
« Last Edit: September 29, 2010, 10:31:45 PM by b_carlton »
An output is a PLC's way of getting its inputs to change.

PStiles

  • Full Member
  • ***
  • Posts: 31
Re: Analog Input
« Reply #20 on: September 30, 2010, 08:32:11 AM »
I will have a D4-DCM module in physical slot 1.

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Analog Input
« Reply #21 on: September 30, 2010, 09:17:58 AM »
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.
An output is a PLC's way of getting its inputs to change.

PStiles

  • Full Member
  • ***
  • Posts: 31
Re: Analog Input
« Reply #22 on: September 30, 2010, 09:19:55 AM »
Thanks again for your help.

PStiles

  • Full Member
  • ***
  • Posts: 31
Re: Analog Input
« Reply #23 on: October 19, 2010, 11:34:13 AM »
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

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Analog Input
« Reply #24 on: October 19, 2010, 01:46:26 PM »
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.
An output is a PLC's way of getting its inputs to change.

PStiles

  • Full Member
  • ***
  • Posts: 31
Re: Analog Input
« Reply #25 on: October 19, 2010, 01:55:23 PM »
I am adding 3 more sensors on channels 2-4.

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Analog Input
« Reply #26 on: October 19, 2010, 02:07:57 PM »
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.
An output is a PLC's way of getting its inputs to change.

PStiles

  • Full Member
  • ***
  • Posts: 31
Re: Analog Input
« Reply #27 on: October 19, 2010, 04:13:36 PM »
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

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Analog Input
« Reply #28 on: October 19, 2010, 04:22:36 PM »
Get rid of

STR SP1
FOR K4

and

NEXT

The instructions left as they stand will bring in all 4 channels.
An output is a PLC's way of getting its inputs to change.

PStiles

  • Full Member
  • ***
  • Posts: 31
Re: Analog Input
« Reply #29 on: October 19, 2010, 04:38:52 PM »
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