Have many questions
Hi everyone, I have been lurking here for quite a while. I have
looked at about 2500 previouse messages and can't find any answers.
First, I have programmed the BS2 before, but I am doing a project now
for a BS2P40 and I am having trouble setting up pin assignments. Do
any of you know where I can get this information? How do I set the
pins high and low? Second, I am driving some motors, but I want to
limit the rotation of the motors-Is there a way to count how many
pulses I send to the motor so I know the position? I know this
probably isn't a very accurate way because steppers can jump
position. This is for my senior design project so we are very
limited in cost. I have include prox. sensors to sense when the
object has spun to the limit, but would like to know where the object
is at all times. Sorry for this being long, just trying to give you
all the information.
Thanks,
Greg
looked at about 2500 previouse messages and can't find any answers.
First, I have programmed the BS2 before, but I am doing a project now
for a BS2P40 and I am having trouble setting up pin assignments. Do
any of you know where I can get this information? How do I set the
pins high and low? Second, I am driving some motors, but I want to
limit the rotation of the motors-Is there a way to count how many
pulses I send to the motor so I know the position? I know this
probably isn't a very accurate way because steppers can jump
position. This is for my senior design project so we are very
limited in cost. I have include prox. sensors to sense when the
object has spun to the limit, but would like to know where the object
is at all times. Sorry for this being long, just trying to give you
all the information.
Thanks,
Greg
Comments
As to the pin assignments, you need to use the AUXIO command to access the
"X" pins. So:
AUXIO
high 3
would bring pin X3 high. Once you have used the AUXIO command, you need to
use the MAINIO command if you wish to address the "regular" pins.
Jonathan
www.madlabs.info
> Hi everyone, I have been lurking here for quite a while. I have
> looked at about 2500 previouse messages and can't find any answers.
> First, I have programmed the BS2 before, but I am doing a project now
> for a BS2P40 and I am having trouble setting up pin assignments. Do
> any of you know where I can get this information? How do I set the
> pins high and low? Second, I am driving some motors, but I want to
> limit the rotation of the motors-Is there a way to count how many
> pulses I send to the motor so I know the position? I know this
> probably isn't a very accurate way because steppers can jump
> position. This is for my senior design project so we are very
> limited in cost. I have include prox. sensors to sense when the
> object has spun to the limit, but would like to know where the object
> is at all times. Sorry for this being long, just trying to give you
> all the information.
> Thanks,
> Greg
You can define the main 16 pins, known as p0 to p16, and also the
auxiliary 16 pins, known as x0 to x16.
Look up the MAINIO, AUXIO and IOTERM commands in the BASIC Stamp manual.
' defined on mainio:
motor5 PIN 5
' defined on auxio
sensor5 PIN 5
Observe that a pin is hooked up with two different names, but you
mean one of them to control a motor on p5 and the other to control
a lamp on x5.
DO
MAINIO
HIGH 5 ' turn on motor on p5
AUXIO
LOOP WHILE sensor5=0 ' test sensor on x5
MAINIO
LOW 5 ' turn off motor on p5
As to counting the pulses, exactly how you do it will depend on
whether or not you are using an external stepper motor driver chip,
or generating the phases with the Stamp itself. But sure, something
like this:
FOR idx=1 TO 37 ' send exactly 37 pulses
PULSOUT 5,75 ' pulse motor driver on p5
NEXT
Steppers don't usually jump position unless they are forced.
-- Tracy
>Hi everyone, I have been lurking here for quite a while. I have
>looked at about 2500 previouse messages and can't find any answers.
>First, I have programmed the BS2 before, but I am doing a project now
>for a BS2P40 and I am having trouble setting up pin assignments. Do
>any of you know where I can get this information? How do I set the
>pins high and low? Second, I am driving some motors, but I want to
>limit the rotation of the motors-Is there a way to count how many
>pulses I send to the motor so I know the position? I know this
>probably isn't a very accurate way because steppers can jump
>position. This is for my senior design project so we are very
>limited in cost. I have include prox. sensors to sense when the
>object has spun to the limit, but would like to know where the object
>is at all times. Sorry for this being long, just trying to give you
>all the information.
>Thanks,
>Greg
it works out. I will let you know if I need more help.
Thanks again,
Greg
--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> Hi Greg,
>
> You can define the main 16 pins, known as p0 to p16, and also the
> auxiliary 16 pins, known as x0 to x16.
>
> Look up the MAINIO, AUXIO and IOTERM commands in the BASIC Stamp
manual.
>
> ' defined on mainio:
> motor5 PIN 5
>
> ' defined on auxio
> sensor5 PIN 5
>
> Observe that a pin is hooked up with two different names, but you
> mean one of them to control a motor on p5 and the other to
control
> a lamp on x5.
>
>
> DO
> MAINIO
> HIGH 5 ' turn on motor on p5
> AUXIO
> LOOP WHILE sensor5=0 ' test sensor on x5
> MAINIO
> LOW 5 ' turn off motor on p5
>
> As to counting the pulses, exactly how you do it will depend on
> whether or not you are using an external stepper motor driver chip,
> or generating the phases with the Stamp itself. But sure,
something
> like this:
>
> FOR idx=1 TO 37 ' send exactly 37 pulses
> PULSOUT 5,75 ' pulse motor driver on p5
> NEXT
>
> Steppers don't usually jump position unless they are forced.
>
> -- Tracy
>
>
>
>
> >Hi everyone, I have been lurking here for quite a while. I have
> >looked at about 2500 previouse messages and can't find any
answers.
> >First, I have programmed the BS2 before, but I am doing a project
now
> >for a BS2P40 and I am having trouble setting up pin assignments.
Do
> >any of you know where I can get this information? How do I set the
> >pins high and low? Second, I am driving some motors, but I want to
> >limit the rotation of the motors-Is there a way to count how many
> >pulses I send to the motor so I know the position? I know this
> >probably isn't a very accurate way because steppers can jump
> >position. This is for my senior design project so we are very
> >limited in cost. I have include prox. sensors to sense when the
> >object has spun to the limit, but would like to know where the
object
> >is at all times. Sorry for this being long, just trying to give
you
> >all the information.
> >Thanks,
> >Greg