Author Topic: Changing the values of the ADC inputs  (Read 12465 times)

kilodelta

  • Newbie
  • *
  • Posts: 3
  • I'm a llama!
    • View Profile
Changing the values of the ADC inputs
« on: June 20, 2008, 03:23:08 AM »
I am running a program reading the ADC input from CH1.

Changing the Contents of Variables.?
Can this value be modifed when the system is running in test mode like the other variables. I have changed the other input without any worries, eg, A=500 or DM[23]=685..

But i just can not get the syntax for the ADC?...

Would anyone have the syntax to change one of these channels when testing please?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Changing the values of the ADC inputs
« Reply #1 on: June 20, 2008, 10:07:12 AM »
If you are running the program on the actual hardware, then the variable assigned to ADC(n) would be what the PLC actually got from the analog channel and you can't change it.

For testing purpose you could skip the running of the actual ADC(n) function and test your program using the variable that the ADC is supposed to be assigned to.

E.g

'  DM[1] = ADC(1)     ' comment out this statement so that it doesn't run.

IF DM[1]= xxx Then
....
Else
.....
ENDIF

This way you can use online monitoring to change the data in DM[1] and it would not be overwritten by the actual ADC(1).

Alternatively, you can use an internal relay CR1 to control a ladder circuit that trigger a custom function containing the DM[1] = ADC(1) statement. For actual run the relay will be OFF. For testing the relay will be ON:

     CR1   others      Fn_#1
|---|/|----| |--------{dCusF}

Once CR1 is ON, the Fn_#1 in the above ladder circuit will not run and therefore the DM[1]= ADC(1) function will not be executed and the variable DM[1] can be changed from online monitoring.
« Last Edit: June 20, 2008, 10:07:57 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

kilodelta

  • Newbie
  • *
  • Posts: 3
  • I'm a llama!
    • View Profile
Re:Changing the values of the ADC inputs
« Reply #2 on: June 20, 2008, 10:40:32 AM »
Thanks