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 - How can i add the adc function in ANSI C?

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

How can i add the adc function in ANSI C? (by Carlos )

I'm interested in adding the function of adc reading and have a variable from this feature I've seen in the section of this function ansic.cpp that there is only one message. and I can modify the code and do not throw me error.Greetings
Wed Oct 28 2015, 22:46:46
(no subject) (by Jonathan Westhues)
You can modify your PLC runtime code to write the A/D result to a special variable every frame before it calls PlcCycle(). For example, to make the ADC result available as the ladder logic variable AdcResult, you'd write to U_i_AdcResult.

Take a look at the comment around EXTERN_EVERYTHING in the generated code, and let me know if you have any questions. A similar technique can be used to implement analog outputs, like a DAC or PWM duty cycle.
Wed Oct 28 2015, 23:45:46
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):