Interesting Problem
Archiver
Posts: 46,084
Hi
I am trying to control (Variable Speed) of a motor
using an Hbridge .The 2 terminal(Logic inputs) of the
hbridge are being driven form the stamp IOs out0 and
out1.Please refer to the code shown below.
'{$STAMP BS2}
output 0
output 1
output 2
output 3
temp var word
'RUN MOTOR FORWARD AT A CERTAIN SPEED
for temp = 1 to 100
out0= %0
pwm 1,150, 10
NEXT
'RUN THE MOTOR BACKWARD AT A CERTAIN SPEED
for temp = 1 to 100
out1= %0
pwm 0,150, 10
NEXT
The problem is that in the first part the program
works fine and the motor runs forward at a certain
speed . But when the part to reverse direction comes
the motor just stops. I saw teh output pine on the
scope and interestingly. Even though the first part
works fine . In the second loop. IO 1 still keeps on
giving PWM inspite of the command OUT1 = %0. the
magnitude of the PWm is lesser. But its enough to keep
the fan off. Why isnt IO1 staying at 0.
Kindly Advise
Thanks
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
I am trying to control (Variable Speed) of a motor
using an Hbridge .The 2 terminal(Logic inputs) of the
hbridge are being driven form the stamp IOs out0 and
out1.Please refer to the code shown below.
'{$STAMP BS2}
output 0
output 1
output 2
output 3
temp var word
'RUN MOTOR FORWARD AT A CERTAIN SPEED
for temp = 1 to 100
out0= %0
pwm 1,150, 10
NEXT
'RUN THE MOTOR BACKWARD AT A CERTAIN SPEED
for temp = 1 to 100
out1= %0
pwm 0,150, 10
NEXT
The problem is that in the first part the program
works fine and the motor runs forward at a certain
speed . But when the part to reverse direction comes
the motor just stops. I saw teh output pine on the
scope and interestingly. Even though the first part
works fine . In the second loop. IO 1 still keeps on
giving PWM inspite of the command OUT1 = %0. the
magnitude of the PWm is lesser. But its enough to keep
the fan off. Why isnt IO1 staying at 0.
Kindly Advise
Thanks
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
Comments
for digital-to-analog conversion by charging an RC network.
The other problem you're having is the the PWM command doesn't care what you
do with the Outs or Dirs register. It will take the pin you give it, make it
an output, then run the PWM function.
-- Jon Williams
-- Parallax
In a message dated 2/17/2003 6:32:54 PM Central Standard Time,
suri_list@y... writes:
> Hi
> I am trying to control (Variable Speed) of a motor
> using an Hbridge .The 2 terminal(Logic inputs) of the
> hbridge are being driven form the stamp IOs out0 and
> out1.Please refer to the code shown below.
>
> '{$STAMP BS2}
> output 0
> output 1
> output 2
> output 3
> temp var word
> 'RUN MOTOR FORWARD AT A CERTAIN SPEED
> for temp = 1 to 100
> out0= %0
> pwm 1,150, 10
> NEXT
>
> 'RUN THE MOTOR BACKWARD AT A CERTAIN SPEED
> for temp = 1 to 100
> out1= %0
> pwm 0,150, 10
> NEXT
>
> The problem is that in the first part the program
> works fine and the motor runs forward at a certain
> speed . But when the part to reverse direction comes
> the motor just stops. I saw teh output pine on the
> scope and interestingly. Even though the first part
> works fine . In the second loop. IO 1 still keeps on
> giving PWM inspite of the command OUT1 = %0. the
> magnitude of the PWm is lesser. But its enough to keep
> the fan off. Why isnt IO1 staying at 0.
>
> Kindly Advise
> Thanks
[noparse][[/noparse]Non-text portions of this message have been removed]
Changing OUT1 modifies the value in the ouput latch for pin 1, which
has no external effect when the pin is an input. I suspect you're
seeing noise on the input pin 1 in the second loop rather than a PWM
output. Try LOW 1 instead of OUT1 = 0 and see if that helps.
Regards,
Steve
On 17 Feb 03 at 16:31, harshit suri wrote:
> Hi
> I am trying to control (Variable Speed) of a motor
> using an Hbridge .The 2 terminal(Logic inputs) of the
> hbridge are being driven form the stamp IOs out0 and
> out1.Please refer to the code shown below.
>
> '{$STAMP BS2}
> output 0
> output 1
> output 2
> output 3
> temp var word
> 'RUN MOTOR FORWARD AT A CERTAIN SPEED
> for temp = 1 to 100
> out0= %0
> pwm 1,150, 10
> NEXT
>
> 'RUN THE MOTOR BACKWARD AT A CERTAIN SPEED
> for temp = 1 to 100
> out1= %0
> pwm 0,150, 10
> NEXT