initialization program and speed controllers

does anyone know how the initialization program works? heres my problem:

  1. my team wants to build a motorized cart to haul our robot around
  2. we want to be able to have tank drive
  3. therefore, we need some kind of speed controller
  4. the victor 884 needs to be programmed or have pulses sent to it
    5a) sol: use a stamp
    5b) sol: something else to generate pulses???

problems with 5a)

  1. the default code or something in the special stamp designed for first requires the operator interface. too complicated and not one to spare.

  2. we have spare bs2 stamps that are very like the the bs2sx, except without all the fancy stuff. it uses direct contact with the pins, not serial messaging. no operator interface required. unfortunately, the programming seems to be different. it wont allow a simple pwm = ***. it has to be the command
    pwm pin#, duty cycle, #of milliseconds to recharge a capacitor

i dont really get it.

so, what i need help on:

  1. anyone know if its a hardware or software thing that requires the operator interface? and how to make our first robot controllers not require it?
  2. to accomplish #1, anyone have documentation for the initialization program?
  3. anyone know how to generate pulses to work the victor 884 speed controllers cheaply and easily without going through a stamp?
  4. anyone know how to program non-first bs2 stamps?

thanks!

One site i really reccomend you check out for Basic Stamp Programming is http://www.parallax.com/ that site is for the BOEBOTS and many other educational rpbptocs kits and things, check them out for help.
~Mike

unfortunately, the programming seems to be different. it wont allow a simple pwm = ***. it has to be the command

I think you use the pulseout command to make pwm waves. PWM actually creates an analog voltage which is not what you want. And in this case its called PPM not PWM. PPM is the wave signal that goes into the speed controller while PWM is the voltage wave that comes out.

I can help you with al of the above mentioned Okay first of all pwm does not generate an analog voltage by itself. A pwm signal can however be filtered to make an analog voltage. The PWM command in pbasic outputs a PWM signal jsut like what you need but there is a problem. While the basic stamp is executing the PWM command it can’t do anything else. This makes the command useless for your purposes because you will need a steady PWM signal and you can’t spend all your time in the PWM command. The easiest way to acomplish this with a bs2 is with Parallax’s new PWM PAL THe Basic stamp plugs into this and allows for PWM in the backgroung while doing other tasks like reading joysticks. Just ask if you need any other help or a mosre specific explanation. I can even write the code and give you a circuit if u need.

thanks for the help everyone. two up from me it was mentioned that i want to use pulseout, which i think will be easier than buying anything now. ive used pulseout with a servo, but what is the frequency i want with the speed controller? if possible, include the code. thanks!

Okay i called innovation first and they said it uses standard RC signals with a period of 1-2ms sent every 17 ms, not a true PWM pulse like i previously thought. If you send a 1ms pulse, that will be full backward, a 1.5 millisecond pulse, still, a 2ms pulse full forward etc. The 1-2ms part will be easy. It will not be easy however to do this exctly every 17 ms. Usually (at least with servos the 17 ms is not all that critical though and there may be some leeway). you may or may not be able to acheive acceptable spacing without any external hardware. below is an example of the type of pulsout command you need. In a few minutes i will post more.

Pulsout 1,1000
'on a BS2 this would send a 2ms pulse out on pin 1. note: the period paramater of the pulsout command is in units of 2microsconds. (ie: 1000 = 2milliseconds)

======== The rest i promised ==============
Here is some code that will take two numbers from 0 to 255 (First style) and send the appropriate pulses. This code obviously does not handdle the spacing between the pulses. This code will only work for a BS2 or BS2E.

'put this stuff at the beginning of your code.
Temp var word
L_pin con 0 'pin tio send left pulses too
R_pin con 1 'pin to send right pulses too
Pause_time con 17 'adjust this accordingly to acheove 17 ms spacing. I put 17 ms only as an example and you will have to play with this. You may not need a dalay you program may already take more than 17 ms. In this case you need to do some optimizing to the rest of you program.

beginning:

'code to read joysticks or whatever and assign values to
r _speed and L_speed goes here

'put this at the end of your code.
temp2 = L_speed * 256
temp2 = (temp / 32) + 2000
PULSOUT L_Pin,Temp
temp2 = R_speed * 256
temp2 = (temp / 32) + 2000
PULSOUT R_pin,Temp
pause pause_time
goto beginning

Note: the forums messed up the spacing and i am too lazy to fix it so it may be a bit hard to read .

Okay first of all pwm does not generate an analog voltage by itself. A pwm signal can however be filtered to make an analog voltage. The PWM command in pbasic outputs a PWM signal jsut like what you need but there is a problem. While the basic stamp is executing the PWM command it can’t do anything else.

Actually I just looked through the documentation. The PWM command is supposed to be used to generate an analog voltage with the help of a capacitor.

Note: the forums messed up the spacing and i am too lazy to fix it so it may be a bit hard to read .

Just use the code command. It should retain the formating of anything you type. It is that pound symbol next to the php button.

*Originally posted by Adam Y. *
**Actually I just looked through the documentation. The PWM command is supposed to be used to generate an analog voltage with the help of a capacitor. **

That is ONE of its purposes. The PWM command by itself generates only a train of digital pulses. Like you said, this can however be filtered to create a rather rough analog. Kindof a really bootleg DAC. Now lets not start a stupid argument about this.

That is ONE of its purposes. The PWM command by itself generates only a train of digital pulses. Like you said, this can however be filtered to create a rather rough analog. Kindof a really bootleg DAC. Now lets not start a stupid argument about this.

Yeah I know but I have read this in two differnt places. One was an article about the PwmPal and the instruction manual. Also a question about the victors. I know that the RC versions of them require a signal booster. What does that do to the signal??

anyone know how to generate pulses to work the victor 884 speed controllers cheaply and easily without going through a stamp?

You could try a 555 pwm circuit. I know it is here somewhere on this forum. It may not work.
http://www.chiefdelphi.com/forums/showthread.php?s=&threadid=14565&highlight=555+circuit

[quote]*Originally posted by Adam Y. *
** Also a question about the victors. I know that the RC versions of them require a signal booster. What does that do to the signal??QUOTE]
call IF tech support @ 903-454-1978 and ask. Im not even really sure what the difference btw the IF and RC version is in the first place.**[/quote]

…Well how are things coming?:confused:

Originally emailed to me by Tom Watson, of IFI
The part number of the IC that we use is MM74HCT14M. You can get datasheets on the web.

This response was to my question of which IC it is that IFIRobotics (the BattleBots oriented branch of IFI) provides with the “PWM Signal Driver” option, on the order form for a Victor 883/885 (their Thor 883 was recently discontinued).

BLAH, BLAH
When I cloned the '98 controller (in the clear plastic box), I made up a PIC 16c84 program to do the interfacing with the Tekins, which have the same signal standards as the Victors : Pulse 1 ms +/- 0.5 ms, repeated every 16 ms. Biggest problem was getting the eight serial signals out of the BS2 at the fastest it would go, into the PIC. For only four, just use an interrupt or poll to see when the BS2 wants to send (using SEROUT); blast in the numbers, then start all outputs at the same time, let them stay on for 0.5 ms, then run through the stored numbers, while counting the milliseconds - input number is zero, drop the pin immediately - input number 254, wait until the count has reached 254 before dropping the output (a full millisecond). Wait for the next time BS2 wants to talk.

DETAILS

  • Clock in the BS2 data (which could include a PWM channel number if you want to get picky), and store each in its own cubby hole.
  • Start all (or just those you want to function) pins high, use TMR0 to count down 500 us, then set TMR0 to count to 1 ms = 1000 us, and set your own counter to zero, and see if channel ‘n’ is supposed to be ‘0’ : if so, turn it off; if not, skip to test channel ‘n+1’. Repeat for all channels, then check that you have a proper length for your loop [each loop represents 1000 ms/128, or 1000 ms/32 if you count by 4’s]. Then go back and loop through it all again until they are all off. Wait till TMR0 has finished the 1 ms, and/or wait for BS2.

If you count by 4’s, then the number you receive from BS2 should be divided by 4 (shift right) so 254 becomes 63. 63 loops will then time out at around 1 ms, or to turn it around, 63 loops through the comparing-and-turning-off loop will take 1000 us. if you counted by 2’s, and divided by 2 to start, 127 loops would take 1000 us.

Feed this pulse train to your Victor (one Victor / output) and it should work. If you would like, you could use the timer to do two pulse every time the BS2 does a loop (during which it does a SEROUT).

MORE INFO
No Transmitter
Remember, if you write your own program for the BS2, the timing for the BS2 loop comes from the sampling loop in the transmitter: there is one BS2 loop for each data set sent by the transmitter. For a simple program, there is no advantage to using a faster BS2xyz. If you don’t have a transmitter, you will have to time your BS2 loop, and adjust as required.

Joystick into BS2 via ADC
You may want the BS2 to read an ADC (eg ADC0832) as laid out by Parallax, with the joystick being run from Ground to the ADC input, then to a constant current source (LM134?) connected to a higher voltage that the V+ for the ADC. The current should be set at enough to make full resistance give 5V. This is more linear with pot position than Innovation First’s circuit by a percent or so: They use the charge-a-cap’r-and-count method, also detailed by Parallax.

And No, the Victor does not respond to an analog voltage level, however well filtered your BS2 PWM output may be, on its input. It times out the input pulse, then does its own PWM thing at 12 V.

And Yes, the timing values may need adjustments : it’s been 5-6 years and three computers since I did the work.

thanks everyone for the help. we got the program to work with servos that were on the bot we were testing with. we arent sure about the motors because the program was barely outputing fast enough. when their were debug statements, the servos were very jerky. however, i still want to know if anyone has documentation on the intillization program. i have no idea how it works, and ive been wondering for a while. thanks

The BS2sx program goes through some housekeeping: after the directives to the compiler, variables are declared, and typed (p1_x VAR byte, for example). Some bytes are reserved for the transmitted data, and for the local on-robot stuff, as both OI stuff and the RC input stuff are not “read” directly by the ‘computing process’, but are passed to it from the input process via the SERIN statement.

Think of the CPU as three functions ; input, ‘computing’, and output.

When you get to the “set the initiallization constants” section, you are preparing to tell the input organizer which bytes to send. As they tell you in the default program, you cannot accept all the bytes the input section has and can send you; you must select a subset to be sent.

You set the constant for a particular byte you want, and then, in the MASTER uP INIT’N section of the default, tempA = (the constant for p3_x shift left once + the constant for p4_x) shift left + the next yada yada … shifts the first 5 bits into tempA.

dataInitA shifts the 5 bits collected in tempA, along with 3 more, to give eight bits.

Eventually you have 4 bytes of dataInit, A,B,C, and D and then after declaring you want to send it, you wait until the input process is ready to receive, the shift it out. OUTPUT COMA sets the COMA pin to output, LOW sets it to 0 V, INPUT puts the pin into input mode. Lows on COMA and COMB are a signal to the input process. You don’t send right away, but you wait, until IN3 goes low, which is the signal the input process is ready to hear from you.

Once that’s sent, you get into the main loop, and there the serin command expects to hear as many bytes as you requested, sent in the order IFI has arranged for in their machine code, in the input process, and in the which order you have written your serin (as they cautioned you to do). If you didn’t make the c_whatever CON equal 1, it won’t be sent; if you don’t have it in the correct order (IFI’s), your right front wheel might well be executing the commands for your battle-arm. If you don’t have the correct number of bytes in the SERIN, you’ll see BASIC INIT ERROR.

Think of the input process looking at the 4 bytes, bit by bit, as it sends out data - “is this one that i send ? , if so I will, if not I’ll test the next bit, and if it’s set, I’ll send that”. Each bit corresponds to a byte it can send to the computing process

Clearer ?:smiley:

Dear all,
Hello!
Everybody, how are your !

I am Kam, a new comer to the world of embedded !

Any one know how to program BS2 using the ADC0832CCN converter ?
As I was informed that the BS2 code for ADC0831 and ADC0832 are different.

Any advise ?

Thank you.
Kam