PLUS+1 User Forum

PLUS+1 Software => Code sharing => Topic started by: curtistdc on February 23, 2011, 08:45:46 PM

Title: sample code
Post by: curtistdc on February 23, 2011, 08:45:46 PM
Hello, I am new to The guide prorogram and am trying to teach myself how to program with it.  I have a limited experience with this type of application.  I was wondering if anyone had some sample code that they would like to donate to my education.  I am pretty good at learning by examples so any help would be greatly appreciated.  I need to program a PID loop to control the height of an ultrasonic sensor mounted on a boom.  So an example of a PID loop would help a great deal.
Thanks
Scott
Title: Re: sample code
Post by: Neil on February 26, 2011, 02:26:14 AM
Hi

so what type of PLUS+1 hardware do you have to train with?

Neil
Title: Re: sample code
Post by: curtistdc on February 27, 2011, 01:19:51 AM
50 pin micro
24 pin output module
12 pin input module
2 analog ultrasonic sensors for height measurement
proportional hydraulic valves for height actuation

still waiting on the hardware. just programing.
Thanks
Scott
Title: Re: sample code
Post by: Neil on March 22, 2011, 05:30:18 PM
Hi Scott.

I will often use the attached as a demo to PID control.

All is required is a pot on C1P08, supplied via the senor + pin
There are many different techniques applied for fine tuning, it really depends on the function you’re controlling.

This works for me.
Set EE_T1, EE_P, EE_I, EE_D  to zero.
Increase EE_P to a value of 5000 to cause instability monitored on CP_ERROR , then half the value in the NV, 2500, 1200 and so on until it becomes stable.
With smaller increments increase the value until it just fringes on stable/unstable.
Carry out the same process on EE_I.
I think the default entry’s get it somewhere close from memory.

Ideally your CP_SET and CP_FEEDBACK should follow.

Again Scott, this works for me, others may have different methods. Always remember safety if your tuning on a application.

regards Neil
Title: Re: sample code
Post by: paterianus on March 24, 2011, 03:31:23 PM
I have the reverse application.  I would like to receive a signal from an ultrasonic sensor 0-19mS in duration based upon distance.  How accurate (and repeatable) is the Plus1 in measuring input signal widths?