Sign in

username:

password:



Not a member?

Search oopic



Search tips

Subscribe to oopic



Ads

Discussion Groups

Discussion Groups | | trying to link a oKnob to a oPWM

trying to link a oKnob to a oPWM - fred_feuerstein8173 - Feb 20 4:23:39 2008

Hello,

I hope you can help me im trying to link a 0 to 5 Volts analoug input
to a PWM so when no voltage comes in the pulsing is off and when a
voltage is introduced that it switches the PWM
This is the code i have but it does not work.
Dim A As New oPWM
Dim B As New oKnob

Dim bus As New oBus

Sub Main()
ooPIC.Delay = 500

A.IOLine = 17
A.Operate = 1
B.IOLine = 1

B = cvInput

bus.Input.Link(B)
bus.Output.Link(A.Value)
bus.Operate = cvTrue

Do
A.Value = B.Position/2
Loop

End Sub
Thanks for your help in advance

Fred



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )


Re: trying to link a oKnob to a oPWM - ooPIC Tech Support - Feb 21 0:09:00 2008

Does not work is a bit vague. However, you will have some bobble at the
extremes of oKnob and A2D values are notoriously unstable, but this can
work. However you should link bus.output.link(A.DutyCycle). You have
not set up the oPWMH.period or oPWMH.prescale settings. You also need
to have B.Operate = cvTrue set as well. Your "do" loop is not needed.
The VC will handle the movement of the oKnob value to oPWMH.

DLC

fred_feuerstein8173 wrote:
> Hello,
>
> I hope you can help me im trying to link a 0 to 5 Volts analoug input
> to a PWM so when no voltage comes in the pulsing is off and when a
> voltage is introduced that it switches the PWM
> This is the code i have but it does not work.
> Dim A As New oPWM
> Dim B As New oKnob
>
>
> Dim bus As New oBus
>
> Sub Main()
> ooPIC.Delay = 500
>
> A.IOLine = 17
> A.Operate = 1
> B.IOLine = 1
> B = cvInput
>
> bus.Input.Link(B)
> bus.Output.Link(A.Value)
> bus.Operate = cvTrue
>
> Do
> A.Value = B.Position/2
> Loop
>
> End Sub
> Thanks for your help in advance
>
> Fred
>
>
>



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )

Re: trying to link a oKnob to a oPWM - fred_feuerstein8173 - Feb 22 8:21:48 2008

Hello Denis,

Thanks for your fast replay.
Maybe it is better if i explain what i want to do a maybe you could
tell me what best to use, since you wrote that the oKnob is not very
stable in the extreme situations of its working range.
I need to control a PWM from a data logger with a 0-5 Volt analogue
output from the logger this should than give me the full range on the
PWM at a frequency of 19,6 kHz. Also i need a digital high when a
pulse is produced that is between 1 and 255 binary on the oPWM.

Thanks for your help in advance.

Regards,

Fred
--- In o...@yahoogroups.com, ooPIC Tech Support wrote:
>
> Does not work is a bit vague. However, you will have some bobble at
the
> extremes of oKnob and A2D values are notoriously unstable, but this can
> work. However you should link bus.output.link(A.DutyCycle). You have
> not set up the oPWMH.period or oPWMH.prescale settings. You also need
> to have B.Operate = cvTrue set as well. Your "do" loop is not needed.
> The VC will handle the movement of the oKnob value to oPWMH.
>
> DLC
>
> fred_feuerstein8173 wrote:
> > Hello,
> >
> > I hope you can help me im trying to link a 0 to 5 Volts analoug input
> > to a PWM so when no voltage comes in the pulsing is off and when a
> > voltage is introduced that it switches the PWM
> > This is the code i have but it does not work.
> >
> >
> > Dim A As New oPWM
> > Dim B As New oKnob
> >
> >
> > Dim bus As New oBus
> >
> >
> >
> > Sub Main()
> >
> >
> > ooPIC.Delay = 500
> >
> >
> >
> > A.IOLine = 17
> > A.Operate = 1
> > B.IOLine = 1
> >
> >
> >
> >
> > B = cvInput
> >
> > bus.Input.Link(B)
> > bus.Output.Link(A.Value)
> > bus.Operate = cvTrue
> >
> > Do
> > A.Value = B.Position/2
> > Loop
> >
> > End Sub
> >
> >
> > Thanks for your help in advance
> >
> > Fred
> >
> >
> >
> >
> >



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )

Re: trying to link a oKnob to a oPWM - rtstofer - Feb 22 13:56:16 2008

--- In o...@yahoogroups.com, "fred_feuerstein8173"
wrote:
>
> Hello Denis,
>
> Thanks for your fast replay.
> Maybe it is better if i explain what i want to do a maybe you could
> tell me what best to use, since you wrote that the oKnob is not very
> stable in the extreme situations of its working range.
> I need to control a PWM from a data logger with a 0-5 Volt analogue
> output from the logger this should than give me the full range on
the
> PWM at a frequency of 19,6 kHz. Also i need a digital high when a
> pulse is produced that is between 1 and 255 binary on the oPWM.
>
> Thanks for your help in advance.
>
> Regards,
>
> Fred

This code is known to work with Ver 6 and a B.2.2+ chip:

Dim Knob As New oKnob
Dim PWM As New oPWM
Dim Bus As New oBus

Sub main()
Knob.IOLine = 1
Knob.Operate = cvOn

PWM.IOLine = 17
PWM.Operate = cvOn

Bus.Input.Link(Knob)
Bus.Output.Link(PWM)
Bus.Operate = cvOn
End Sub

The problem Dennis mentioned is that the Knob value may never get to
exactly 0 or exactly 255. As a result, the oPWM may never turn fully
on or fully off. But it's darn close. YMMV

Richard



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )