Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Analog input

(you are viewing a thread; or go back to list of threads)

Analog input (by Jacob Mortensen)
Hello. I'm new into PIC and Ldmicro. I have some experince with programming ladder in Rslogix 5000.

My question is; I want to have a temperature measurement. If the signal from the measuring device is 1-10mA and I want a compressor to start when the measuring device gives a 5mA signal.

How can I make a input be true/1 when the input signal is over 5mA and false/0 when it is under 5mA??

Hope you understand my english.
Tue Sep 25 2012, 14:00:16
(no subject) (by Ziggy)
Jacob,


I too am new to this stuff.

I think You need to convert the current to a voltage ( say using something as simple as two 1kilohm resistors in parallel to get a 500 ohm resistance.

Select Analogue input ( in the ladder ) put the 500 ohm resistor from analogue input to ground. This way 10 mA will be converted to 5 V which I think may be your microprocessor full range analogue input.

So next step is to sample input voltage ( that is current ) and compare to a level and take action on compare result.

I think this is the way to approach. This assumes Your 0 tto 10 mA transmitter will be able to source current to a ground referenced resistor and do so while the voltage across the resistor is 5 volts.
Tue Sep 25 2012, 21:59:48
(no subject) (by Jacob Mortensen)
Ziggu, thanks for the answer. I can definitely use it later.

Actually it was the programming in ladder that i thought about.

Can this be the way to do it?(See ladder below) Here I say that if the input signal is greater than 2 then it is true.

I do not have any microcontroller yet, so I don't know how an analog input signal will be shown? Neither how much voltage a digital input needs to be true/1?



LADDER DIAGRAM:

|| ||
|| Xstartsignal [var >] Ynew ||
1 ||-------] [------------[ 2 ]------------( )-------||
|| ||
|| ||
|| ||
||------[END]----------------------------------------||
|| ||
|| ||


I/O ASSIGNMENT:

Name | Type | Pin
----------------------------+--------------------+------
Xstartsignal | digital in | 2
Ynew | digital out | (not assigned)
Wed Sep 26 2012, 10:09:22
analog (by simon)
Hi Jacob
Your program need to look like this :

LDmicro export text
no MCU assigned, 4.000000 MHz crystal, 10.0 ms cycle time


LADDER DIAGRAM:

|| ||
|| AA0 ||
1 ||--------------------{READ ADC}----||
|| ||
|| ||
|| ||
|| ||
|| [AA0 >=] Yout ||
2 ||-----[ 5 ]------------( )-------||
|| ||
|| ||
|| ||
||------[END]-----------------------||
|| ||
|| ||


I/O ASSIGNMENT:

Name | Type | Pin
----------------------------+--------------------+------
Yout | digital out | (not assigned)
AA0 | adc input | (not assigned)
Sun Sep 30 2012, 15:31:06
(no subject) (by simon)
program
Sun Sep 30 2012, 15:35:18, download attachment analog.ld
temperature sensor (by problem)
what means if it says : Temperature not assigned with a MOV or ADD statement,this is probably a programmer's error and it will be always zero.
I am trying to set a variable temperature.it is suppose to be placed in memory word.how do i do that?
please help me
thanks :)
Sat Feb 9 2013, 16:08:40
(no subject) (by Ziggy)
Line one in above example reads the ADC value and assigns it to a variable AA0

Once You write the above line in Your ladder diagram You will be asked to assign the pin number to the analogue channel.

That is all.

Take a reading so that AA0 contains valid data. Process it, massage it and then You may store it in EEPROM on board the micro. To do that check the form of store instruction which will store it in EEPROM.
Unfortunately I do not have LDmicro operating on this PC I am sending the message from so I can not give You an example of how to store AA0 into EEPROM space.
Sat Feb 9 2013, 18:25:04
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):