Project help plzzzz

Thread Starter

laloopershad

Joined Feb 4, 2014
16
my project is about the detection of power spikes using Mitsubishi PLC. I was told to use the analogue unit FX2N-4AD to read data of the current sensor ACS712 using the TO and FROM function in the GX IEC Developer which isn't tht big prob as the example prog are available in the data sheet. What happened was that the analogue unit available in the lab is FX2N-4AD-TC which is for thermocouple and can only detect temperature reading so i was no longer able to use the analogue unit.
The supervisor told me to skip the analogue unit and connect my inputs with the FX1N-40MR Microcontroller. As the FX1N-40MR-DS only accept the digital inputs so i designed the A/D converter and amplified the voltage to 24vDC as the requirement for the FX1N-40MR. I just wanted to know that in this case how can i read data of the current sensor from the digital inputs of FX1N-40MR.

I will be happy to answer any question and will really appreciate any answers.

Thanks alot :)
 

shteii01

Joined Feb 19, 2010
4,644
A/D converter takes analog input, converts it to digital value. Then you feed the digital value to microcontroller.

Analog goes into ADC. Digital comes out of ADC. Digital goes into uC. Pretty simple chain.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
You either have to modify the -4AD output and scale it in order for the 4AD-TC to accept it, otherwise I don't see how you are expected to use a digital input system to read an analogue device without some intermediate circuit of some kind?
Max.
 

Thread Starter

laloopershad

Joined Feb 4, 2014
16
Dear Max,
I have made a circuit to convert the analogue output from current sensor to digital outputs which will be the inputs of the Microcontroller FX1N-40MR as it only accepts digital inputs. But i don't know how to read these inputs. Also the output will be in binary form so i have to convert it to numerical/decimal form and then collect this data to MX sheet or excel sheet so that i can analyse data and draw graphs to show the harmonics or surges/spikes.
In have drawn my ladder logic simply as inputs/outputs X0-Y0, X1-Y1, X2-Y2, X3-Y3.... but i am not getting any output value from current sensor.
Thanks
 

shteii01

Joined Feb 19, 2010
4,644
I watched youtube video about ACS712. So.

Analog current goes to ACS712. 0-5 volts (call it Signal A) comes out of ACS712, the voltage correspond to the detected current. Signal A is then sent to ADC.

Here is the question. What kind of digital inputs does FX1N-40MR has? Serial? Parallel?
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
The Mits PLC's have discrete (usually 24vdc) digital inputs.

I built a similar interface for the Mits, but this was just a method of expanding 8 inputs by detecting them in a binary code fashion to get up to 255 values.
Max.
 

Thread Starter

laloopershad

Joined Feb 4, 2014
16
Thanks Max. You are right, It has 12-24vdc digital inputs.
Could you please be able to explain how you got upto 255 values by detecting it in a binary code. It would really ease my life. That exactly what i want.

Thanks alot Max
 

shteii01

Joined Feb 19, 2010
4,644
Thanks Max. You are right, It has 12-24vdc digital inputs.
Could you please be able to explain how you got upto 255 values by detecting it in a binary code. It would really ease my life. That exactly what i want.

Thanks alot Max
(2^8)-1=255
This means that Max used 8 bits to represent digital values.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
My application was a bit different than yours, but I recommend reading up on the Mathematical and advanced instructions in the FX manual, you have the FX2 so this model should posses all the advanced instructions.
I initially import the whole port with the [MOV K2X000 D1] stored in D1.
Once read in then you can use the math instructions to detect values etc.
Max.
 

Thread Starter

laloopershad

Joined Feb 4, 2014
16
Thanks Max. I am using FX1N and it also has advanced functions but i don't know how to use them to read the digital inputs from FX1N-40MR to get outputs. Do you have any sample programme please.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
What do you intend to do with the data?
The program that I used was to detect an 8 bit output port from another device and decode it in a binary fashion to expand the 8 output functions of the device.
Max.
 

Thread Starter

laloopershad

Joined Feb 4, 2014
16
From the data i need to carry out some power calculations. I have to use the binary to decimal function, multiplication function and compare functions in GX IEC Developer to compare the data samples for power spikes.
The problem is that i don't know how to read the data from the FX1N using ladder logic. For example we have inputs [X0, X1, X2, X3, X4, X5, X6, X7] and the digital inputs(these are the output from current sensor converted to digital using A/D Converter) to these are [1 0 1 0 0 1 0]. I need a programme that gives me the output for example [y0, y1, y2, y3, y4, y5, y6,y7]. I am fimiliar with the MOV functions but i cant put X0 value to d using the MOV function because the MOV function doesn't accept X0,X1....X7 as the source (s) to transfer it to destination(d).
I will be thankful if would would please be able to help me with this
Thanks
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
Ref: FX program manual JY992D48301
Mitsubishi FX programming by John Ridley:

To input the port, I have a conditional rung with the output [MOV K2X000 D1]
This stores the 8bit inputs stating at X0 (word 0) at the storage reg D1.
After this you can use any other mathematical function to operate on the data in D1.
Also see 'Moving Groups of bit devices' e.g K2Y0
[MOV K2D4 K2Y000] to move any result to outputs.
Max.
 

Thread Starter

laloopershad

Joined Feb 4, 2014
16
I got this when i downloaded it to PLC. When all inputs were zero i got D0=255 when i turned on X0 i got K2X000=255 as well. For example the input to X1 was 1 so it should have stored 1 in D0 i.e, D0=1
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
?? This is the exact instruction I am using, and tested and works?
In fact it is similar to the instruction example in the JY992D48301 man.
Max.
 

Thread Starter

laloopershad

Joined Feb 4, 2014
16
For the input X0 when i turned on the switch it turned Y0 turned on i.e, 1. I removed the switches as they were connected to the inputs at the same time as the digital outputs from my circuit so there was short circuit and overlapping. I used the same programme that you gave me [K2X000 MOV D0] after removing the switches. Now when i used ----[K2X000 MOV D0], the function MOV will only work if i activate(trigger) the X000 as there are no switches to turn on X0-X7. I tried using M8002 AND M8000 but i get the value 0 in D0 despite the value to input X0 is 1.

I appreciate your help. You are helping me when you don't have to. Thanks alot for that.
 
Top