BCC Microprocessors Class- The GPS Sensor

BCC Microprocessors Class- The GPS Sensor


Today we’re going to plug the GPS sensor into
the board. The first thing you’re going to do is take the yellow wire- that’s the data
wire- and plug it into port d0 or port d1. They’re already set up to run the GPS. Take
the black wire, and that’s ground. Your board has ground and 5 volts on it already. Red
goes into 5 volts. Once you have those 3 wires the GPS is ready to go. You will need to be
near a window or outside to get the satellite signal. Next we will take a look at some of
the coding that you need to get this to work and display the data. Once you have the GPS
plugged in you need to start coding in order to display the data. You’ll have to include
2 files- one is “serial_32.h” and the other is “lcd_txt_driver_328.h” You can download
both of these from the Angel site and include them with your build. Once you have those
two files included, to start your program, you need to initialize contact with the GPS
by using the command “serial_init” and if you go to the serial_32.h file you will find
a graph of what number you need t put in. We’re using 25 so it will do 4800 baud. The
instructor will tell you what number you need to use here. After that command, you’re going
to initialize the LCD screen using the “lcd_init” command. And once those two are done you can
start outputting data. In this specific example we set up an array “char c[100];” that will
allow us to take data and store it in order to display it. The first thing this will do
is take the serial stream from the GPS and search for the character “$”- this marks the
beginning of the stream that the GPS is sending circular/ over and over again. Once it finds
the beginning of the stream, our next command is going to go through and choose which characters
to display.This may be different depending on what data you want. Look it up in the book
and it will tell you a little more on how to do this. Finally we go to the home on the
LCD screen, and we display the data that we want to show- you can use different commands,
different characters. You’ll be able to see an example of the stream of data, you can
choose to show the time, the location, the altitude, like I said look in the book and
you’ll find more examples of what you can display. So you just need the includes, the
initializes, and then you just fool around with the data to display it how you want it
to.

Leave a Reply

Your email address will not be published. Required fields are marked *