Go to Post They can build a robot in 6 hours, so they don't need to start meeting for months... - Karthik [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-08-2003, 21:20
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
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.
  #2   Spotlight this post!  
Unread 05-10-2004, 03:35
sckam sckam is offline
Registered User
no team
 
Join Date: Oct 2004
Location: Malaysia
Posts: 1
sckam is an unknown quantity at this point
Unhappy ADC0832 with Basic Stamp 2(BS2)

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
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Battlebots I.Q.- A serious threat to FIRST or a half thought up cheep copy? Joe Matt General Forum 75 17-10-2005 20:43
switch speed control wayne 05 Programming 6 01-10-2003 09:35
A DEAD reckoning program rcubes85 Programming 5 19-03-2003 14:21
last years speed controllers..... archiver 2001 9 23-06-2002 23:44
Speed Controllers archiver 2000 1 23-06-2002 23:01


All times are GMT -5. The time now is 02:27.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi