Internet PLC Forum

General => Technical support => Topic started by: shaneP on December 07, 2013, 09:08:50 AM

Title: analog custom function read
Post by: shaneP on December 07, 2013, 09:08:50 AM
Hi helpfull list,
i am not a fantastic basic programmer, and to date i havent been able to read the data memory od any ADC
data, i simply have entred basic code to read analog input on a fmd88 plc, compiles ok, runs ok, i did get an out of range error at one stage but i think i resolved that, however i still cant get any data values on the simulate screen or view io box, have entered the code to read adc 1 etc ,
can anyone point me in the right direction to simply read adc data, dm 16 or dm 32.

thanks,  
Title: Re:analog custom function read
Post by: support on December 07, 2013, 09:37:32 PM
You can read an analog input into DM using the following statement:

DM[n] = ADC(m)


E.g.

DM[10] = ADC(5)

will read the ADC value (0 to 4095) into DM[10].

Make sure that your custom function that contains the above statement is executed by your PLC program.

If TBASIC is new to you, please refer to the following forum thread for some tips and samples:

http://www.triplc.com/yabbse/index.php?board=2;action=display;threadid=1817