|
||||||||
|
||||||||
|
DAN121 Interfacing the Dios to VECTOR Compass Module By Michael Simpson
Have you ever wanted to create a portable compass that can be used with some of your electronic applications. Well the Vector is the answer. Its accurate and can be read at a rate of once every 150ms.
Schematic 1 There are a lot of pins on the compass module but just use the above schematic and it will make things a bit simpler. We will be reading the module in binary slave mode. This will allow us to read a heading between 0-359 degrees. One other thing the schematic shows the reset connected to IO port on the Dios. This is optional. During all my tests I never used the reset at all.
One of the most difficult aspects of working with the Vector module is that the form factor wont fit on a normal breadboard. Here you can see how I used to connected breadboards to place the Vector.
You can also make a carrier board by using some sockets and/or headers. After connecting the Dios to the Vector load the following program and enable the debug terminal. Program 1 download it here
The program initializes the Vector by setting up the IO ports and creating a couple global constants. We then make calls to the readvector function. This function uses two shiftin commands to pull the 16 bits of data. The data is combined into the retval variable and is returned as a 0-359 value representing the heading. Parts
|
Copyright © 2001 - 2007 Kronos Robotics