OPENPLC and MEGABAS 0-10Vdc inputs

TimP

New member
I have been able to make the TRIAC outputs, LED outputs, 0-10Vdc output and the dry contacts all work in OPENPLC as I expected pretty much. The 0-10Vdc inputs are different story. I can't get them to read anything but zero. My setup has the 0-10Vdc outputs connected to inputs 6 thru 8. The jumpers are set for 0-10Vdc inputs. Below is the OPENPLC program. Using the command line MEGABAS adcrd commands to read the values I get the proper voltage readings so I think the card working properly. They track nicely but not in OPENPLC. It stays at zero. I am either missing something or something isn't working.

How do I read the analog inputs in OPENPLC?


1702398856924.png
 

alexburcea

Moderator
Staff member
Hi,
The universal inputs types are selected from INx_T inputs. Please set these inputs to zero , theoretically this should be the not connected value.. but just to be sure.
The rest of the values are 1 for 1k thermistor and 2 for 10k thermistor resistance.
 

alexburcea

Moderator
Staff member
Let me check but first did you say is working well from the command line but bad from OpenPLC?
Could you increase the loop period just for testing?
 

alexburcea

Moderator
Staff member
Hi Tim,
I just create a project to test your problem and the card sims to work just fine.
I use a loopback cable to route the outputs to the inputs and create int variable so you can monitor it in the runtime web interface.
Check the attached archive.
 

Attachments

  • Bas_test.zip
    86.8 KB · Views: 2

TimP

New member
My original program worked well from the command line but showed zero values in OpenPLC.

I loaded your program as is. Same results. Command line shows correct values. OpenPLC shows zero values.

How and where do you increase the loop period?
 

alexburcea

Moderator
Staff member
Hi,

I just find the error, actually only the input channels from 1 to 4 are working.
I just made a pull request on the OpenPLC_v3 repo.
This could take some time until approves, but you are in a hurry you can modify the source code by yourself.
Go to "OpenPLC_v3/webserver/core/hardware_layers/" and edit sequent.cpp at line 1265 and change "IND_U_IN_CH_NR_MAX" with "BAS_U_IN_CH_NR_MAX"
 

TimP

New member
I moved the 0-10Vdcs to IN1, IN2 and IN3. It works now!
I also changed it in my original test program. It works now also.
I only need 3 0-10Vdcs for right now on this project so that will work.

Thanks!
 
Top