EmbeddedRelated.com
Forums

PID Controller on HCS12 ??

Started by Andrew Leech January 30, 2004
Has anyone implemeneted a PID controller on an HCS12 ?

I've founf a Motorla application note that describes how to do one
on an HC11 with a built in maths co-processor, but nothing for the
HCS12.

I'm trying to control the pressure in a cylinder, that has a varying
input pressure, and a proportional valve between the two, controlled
by a PWM output. I've also got the signal from a pressure sensor
that tells me what the pressure is in the cylinder. At the moment
I'm controlling it with a simple lookup table, which works, but
takes quite a bit of setting up, and if something changes (say
demand from the cylinder) it tends to mess it up. So I want to
convert it to closed loop.

Just wondered if anyone has any thoughts or examples on this before
I start from scratch !

Andy



Andrew:
I have implemented a servo controller as a school project that uses a
PID controller written using floating point and developed with
Codewarrior and Hiware C Cross compiler. If you like, email me and I
will forward you the source code. The project uses a VB based HMI that
communicates to the HCS12 through the SCI.
Len Klochek

Andrew Leech wrote:

>Has anyone implemeneted a PID controller on an HCS12 ?
>
>I've founf a Motorla application note that describes how to do one
>on an HC11 with a built in maths co-processor, but nothing for the
>HCS12.
>
>I'm trying to control the pressure in a cylinder, that has a varying
>input pressure, and a proportional valve between the two, controlled
>by a PWM output. I've also got the signal from a pressure sensor
>that tells me what the pressure is in the cylinder. At the moment
>I'm controlling it with a simple lookup table, which works, but
>takes quite a bit of setting up, and if something changes (say
>demand from the cylinder) it tends to mess it up. So I want to
>convert it to closed loop.
>
>Just wondered if anyone has any thoughts or examples on this before
>I start from scratch !
>
>Andy >--------------------To learn more about Motorola Microcontrollers, please visit
>http://www.motorola.com/mcu
>o learn more about Motorola Microcontrollers, please visit
>http://www.motorola.com/mcu >
>

--
Len Klochek
School of Electronics and Computer Engineering Technology
Seneca College
416-491-5050 ext 2400
Room 1028B (Automation Lab)




Dear Len

I am quite intrigued by this thread because I am working on a HCS12
based controller for a small wind turbine generator and had already
been wondering whether "fuzzy" logic would be something that could be
applied to maximum power point tracking.
Could you indicate some literature to learn about PID controllers (what
does "PID" stand for?), and evtl. how it might be applied to embedded
systems?

Many thanks!
Robert On Jan 31, 2004, at 05:39 Europe/Paris, Len Klochek wrote:

>
> Andrew:
> I have implemented a servo controller as a school project that uses a
> PID controller written using floating point and developed with
> Codewarrior and Hiware C Cross compiler. If you like, email me and I
> will forward you the source code. The project uses a VB based HMI that
> communicates to the HCS12 through the SCI.
> Len Klochek
>
> Andrew Leech wrote:
>
>> Has anyone implemeneted a PID controller on an HCS12 ?
>>
>> I've founf a Motorla application note that describes how to do one
>> on an HC11 with a built in maths co-processor, but nothing for the
>> HCS12.
>>
>> I'm trying to control the pressure in a cylinder, that has a varying
>> input pressure, and a proportional valve between the two, controlled
>> by a PWM output. I've also got the signal from a pressure sensor
>> that tells me what the pressure is in the cylinder. At the moment
>> I'm controlling it with a simple lookup table, which works, but
>> takes quite a bit of setting up, and if something changes (say
>> demand from the cylinder) it tends to mess it up. So I want to
>> convert it to closed loop.
>>
>> Just wondered if anyone has any thoughts or examples on this before
>> I start from scratch !
>>
>> Andy
>>
>>
>> --------------------To learn more
>> about Motorola Microcontrollers, please visit
>> http://www.motorola.com/mcu
>> o learn more about Motorola Microcontrollers, please visit
>> http://www.motorola.com/mcu
>>
>>
>>
>>
>>
>>
>>
>
> --
> Len Klochek
> School of Electronics and Computer Engineering Technology
> Seneca College
> 416-491-5050 ext 2400
> Room 1028B (Automation Lab) >
>
> --------------------To learn more
> about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
> o learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu >
>




Hello again,

Excuse, have just found the first part of the response:
http://www.engin.umich.edu/group/ctm/PID/PID.html
(PID = proportional, integral, derivative controller)...
I would still be very interested to learn more about how this might be
done on an embedded system, if anyone has any pointers.

Many thanks!
Robert On Jan 31, 2004, at 05:39 Europe/Paris, Len Klochek wrote:

>
> Andrew:
> I have implemented a servo controller as a school project that uses a
> PID controller written using floating point and developed with
> Codewarrior and Hiware C Cross compiler. If you like, email me and I
> will forward you the source code. The project uses a VB based HMI that
> communicates to the HCS12 through the SCI.
> Len Klochek
>
> Andrew Leech wrote:
>
>> Has anyone implemeneted a PID controller on an HCS12 ?
>>
>> I've founf a Motorla application note that describes how to do one
>> on an HC11 with a built in maths co-processor, but nothing for the
>> HCS12.
>>
>> I'm trying to control the pressure in a cylinder, that has a varying
>> input pressure, and a proportional valve between the two, controlled
>> by a PWM output. I've also got the signal from a pressure sensor
>> that tells me what the pressure is in the cylinder. At the moment
>> I'm controlling it with a simple lookup table, which works, but
>> takes quite a bit of setting up, and if something changes (say
>> demand from the cylinder) it tends to mess it up. So I want to
>> convert it to closed loop.
>>
>> Just wondered if anyone has any thoughts or examples on this before
>> I start from scratch !
>>
>> Andy
>>
>>
>> --------------------To learn more
>> about Motorola Microcontrollers, please visit
>> http://www.motorola.com/mcu
>> o learn more about Motorola Microcontrollers, please visit
>> http://www.motorola.com/mcu
>>
>>
>>
>>
>>
>>
>>
>
> --
> Len Klochek
> School of Electronics and Computer Engineering Technology
> Seneca College
> 416-491-5050 ext 2400
> Room 1028B (Automation Lab) >
>
> --------------------To learn more
> about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
> o learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu >
>




Here are some PID links I've come across over the years, I cannot
verify their value...

http://newton.ex.ac.uk/teaching/CDHW/Feedback/Setup-PID.html
http://www.engin.umich.edu/group/ctm/examples/pend/invPID.html
http://www.expertune.com/
http://www.control.com/topic_page?use_category=motion_cat&query_start=1
http://members.aol.com/pidcontrol/booklet.html
http://xoomer.virgilio.it/lorgler/sw-step.htm

Steve

Steven D. Letkeman BSc.
President - Zanthic Technologies Inc.
403-526-8318
www.zanthic.com Embedded micro-controllers and CAN interfaces
www.brightan.com Automated lighting systems

----- Original Message -----
From: "ra" <>
To: <>
Sent: Friday, January 30, 2004 11:31 PM
Subject: Re: [68HC12] PID Controller on HCS12 ?? > Hello again,
>
> Excuse, have just found the first part of the response:
> http://www.engin.umich.edu/group/ctm/PID/PID.html
> (PID = proportional, integral, derivative controller)...
> I would still be very interested to learn more about how this might be
> done on an embedded system, if anyone has any pointers.
>
> Many thanks!
> Robert




Hello Len

I would be very interested to learn from your example of PID control --
would you email me the C-code of your school project?

Many thanks in advance!
Robert Imhoff

On Jan 31, 2004, at 05:39 Europe/Paris, Len Klochek wrote:

>
> Andrew:
> I have implemented a servo controller as a school project that uses a
> PID controller written using floating point and developed with
> Codewarrior and Hiware C Cross compiler. If you like, email me and I
> will forward you the source code. The project uses a VB based HMI that
> communicates to the HCS12 through the SCI.
> Len Klochek
>
> Andrew Leech wrote:
>
>> Has anyone implemeneted a PID controller on an HCS12 ?
>>
>> I've founf a Motorla application note that describes how to do one
>> on an HC11 with a built in maths co-processor, but nothing for the
>> HCS12.
>>
>> I'm trying to control the pressure in a cylinder, that has a varying
>> input pressure, and a proportional valve between the two, controlled
>> by a PWM output. I've also got the signal from a pressure sensor
>> that tells me what the pressure is in the cylinder. At the moment
>> I'm controlling it with a simple lookup table, which works, but
>> takes quite a bit of setting up, and if something changes (say
>> demand from the cylinder) it tends to mess it up. So I want to
>> convert it to closed loop.
>>
>> Just wondered if anyone has any thoughts or examples on this before
>> I start from scratch !
>>
>> Andy
>>
>>
>> --------------------To learn more
>> about Motorola Microcontrollers, please visit
>> http://www.motorola.com/mcu
>> o learn more about Motorola Microcontrollers, please visit
>> http://www.motorola.com/mcu
>>
>>
>>
>>
>>
>>
>>
>
> --
> Len Klochek
> School of Electronics and Computer Engineering Technology
> Seneca College
> 416-491-5050 ext 2400
> Room 1028B (Automation Lab) >
>
> --------------------To learn more
> about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
> o learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu >
>




PID without PHD...Try this site, I found it very helpful.

http://goo.gl/T65Nr

Hossam

Andrew Leech <> wrote:
Has anyone implemeneted a PID controller on an HCS12 ?

I've founf a Motorla application note that describes how to do one
on an HC11 with a built in maths co-processor, but nothing for the
HCS12.

I'm trying to control the pressure in a cylinder, that has a varying
input pressure, and a proportional valve between the two, controlled
by a PWM output. I've also got the signal from a pressure sensor
that tells me what the pressure is in the cylinder. At the moment
I'm controlling it with a simple lookup table, which works, but
takes quite a bit of setting up, and if something changes (say
demand from the cylinder) it tends to mess it up. So I want to
convert it to closed loop.

Just wondered if anyone has any thoughts or examples on this before
I start from scratch !

Andy
--------------------To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu
o learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu

---------------------------------
Yahoo! Groups Links

To
---------------------------------