To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 7919
7918  |  7920
Subject: 
Re: VECTOR 2X
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Tue, 4 Jul 2000 22:36:31 GMT
Reply-To: 
glivick@pacbell.net[stopspam]
Viewed: 
916 times
  
This is my routine to use the Vector 2x with my board (see link below my name)
with an I/O expansion board connected.  You will need to change the I/O port
#defines to work with the Handy Board I/O ports on your expansion board, but
other than that it should work fine.  The compass is used in slave mode with this
routine, so connect the pins accordingly (some go to ground, some to +5, follow
your manual).

To set up the compass, you will need to call reset_compass() from your main()
routine, and then when you want to see what it has to say, use the read()
function.

#define porth 0x7C00     /* ignore this, it is for setting data direction on my
board */
#define set_h bit_set(0x7e00,0b00000100)

#define pc_low bit_clear(porth,0b00100000)  /* these next 4 ports will be digital
outputs on your board */
#define pc_high bit_set(porth,0b00100000)

#define sclk_low bit_clear(porth,0b01000000)  /* "porth" is port h on my board,
not a new instruction :-) */
#define sclk_high bit_set(porth,0b01000000)

#define ss_low bit_clear(porth,0b00001000)
#define ss_high bit_set(porth,0b00001000)

#define reset_low bit_clear(porth,0b00010000)
#define reset_high bit_set(porth,0b00010000)

#define read_sdo input_j(1)  /* these will be digitial input points on your board
*/
#define check_eoc input_j(0)  /*                  ditto                        */



void reset_compass()
{set_h;
  poke(porth,0);  /* this clears all the outputs in general, you may just want to
clear some of them on your board, depending on what else you have connected */
  ss_high;
  pc_high;
  sclk_high;
  reset_high;
  reset_low;
  msleep(15L);
  reset_high;
  msleep(5L);}


int read()
  {int i;
   int j;
   int heading;

   heading=0;

   sclk_high;
   ss_high;
   msleep(15L);
   pc_low;
   msleep(15L);
   pc_high;

   while(!check_eoc)
    {;}

   msleep(15L);
   ss_low;
   msleep(15L);

   for(i=1;i<8;i++)
    {sclk_low;
     msleep(5L);
     sclk_high;
     msleep(5L);}

   sclk_low;
   msleep(5L);
   sclk_high;
   msleep(5L);
   if(read_sdo==1)
     {heading=256;}

   msleep(15L);
   for(j=7;j>0;j--)
    {sclk_low;
     msleep(10L);
     sclk_high;
     msleep(10L);
     if(read_sdo != 0)
      {heading +=(int)((2.^(float)(j))+1.);}}
   sclk_low;
   msleep(5L);

   pc_high;
    sclk_high;

   return heading;}

A couple of things to note:

1.  Since this is done in IC, the routine is too slow to pick up the last bit on
the heading, degrading maximum accuracy to +/- 2°

2.  The Vector 2X doesn't work very well indoors due to disturbances in the
magnetic field caused by metalic objects and other fields.

3.  Because of 2., 1. doesn't matter much.

4.  There is a good way to compensate for the errors caused by indoors use.  You
must calibrate for the fields as they exist in your robot lab, and then the
compass will provide headings that you can use.  Email me when you get to that
point.

Good luck,

Gary Livick

http://www.teleport.com/~raybutts/
tiny HC11 boards for your projects

Robert Kelly wrote:



Hi all,

I am currently fabricating my new HBoard based robot and have only gotten to
the design stages. I have ordered a Vector 2x but haven't recieved it yet. I
am not particularly well endowed with electronics or assembly language skills
(very little except that I knew enough  to correctly solder my board together
by following instructions)I can program adequately in IC.

I have looked at the Vector 2x stuff submitted by Tom Brushaver (sp?) and am
not sure it will work with my setup. It looks like his method requires the use
of motor ports or something.

Has anyone successfully implemented one of these things using the HBoard and
expansion board without permanent modifications?

Most importantly, can anyone give explicit instructions(with info on what
other components are needed, connection from pins on the Vector 2x to the
specific I/O ports on the Hboard and Expansion Board, code if possible) and
even software to get one of these working?

Any tips on mounting to reduce interference of the mag field?

Thanks all,

Bob K.



Message is in Reply To:
  VECTOR 2X
 
Hi all, I am currently fabricating my new HBoard based robot and have only gotten to the design stages. I have ordered a Vector 2x but haven't recieved it yet. I am not particularly well endowed with electronics or assembly language skills (very (...) (24 years ago, 3-Jul-00, to lugnet.robotics.handyboard)

3 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR