Author Topic: analog custom function read  (Read 11061 times)

shaneP

  • Newbie
  • *
  • Posts: 1
  • I'm a llama!
    • View Profile
analog custom function read
« 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,  

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:analog custom function read
« Reply #1 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
« Last Edit: December 07, 2013, 09:38:29 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS