Project help plzzzz

Discussion in 'General Electronics Chat' started by laloopershad, Feb 5, 2014.

  1. laloopershad

    Thread Starter New Member

    Feb 4, 2014
    16
    0
    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 :)
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,387
    497
    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.
     
    laloopershad likes this.
  3. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,520
    2,369
    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.
     
    laloopershad likes this.
  4. laloopershad

    Thread Starter New Member

    Feb 4, 2014
    16
    0
    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
     
  5. laloopershad

    Thread Starter New Member

    Feb 4, 2014
    16
    0
    This is my circuit
     
  6. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,387
    497
    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?
     
  7. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,520
    2,369
    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.
     
  8. laloopershad

    Thread Starter New Member

    Feb 4, 2014
    16
    0
    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
     
  9. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,387
    497
    (2^8)-1=255
    This means that Max used 8 bits to represent digital values.
     
    laloopershad likes this.
  10. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,520
    2,369
    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.
     
    laloopershad likes this.
  11. laloopershad

    Thread Starter New Member

    Feb 4, 2014
    16
    0
    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.
     
  12. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,520
    2,369
    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.
     
    laloopershad likes this.
  13. laloopershad

    Thread Starter New Member

    Feb 4, 2014
    16
    0
    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
     
  14. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,520
    2,369
    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.
     
    laloopershad likes this.
  15. laloopershad

    Thread Starter New Member

    Feb 4, 2014
    16
    0
    when i used this and turn on X0, i get K2X000=255 and D1=255. what does that mean?.
     
  16. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,520
    2,369
    Appears to be reading all high on the inputs?
    Is this in a simulator?
    Max.
     
    laloopershad likes this.
  17. laloopershad

    Thread Starter New Member

    Feb 4, 2014
    16
    0
    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
     
  18. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,520
    2,369
    ?? 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.
     
  19. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,520
    2,369
    What happens when you read a discrete bit?
    Say, IN X0 out to Y0.
    Max.
     
  20. laloopershad

    Thread Starter New Member

    Feb 4, 2014
    16
    0
    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.
     
Loading...