its data at 2400 baud 8N1 formatted
serial. There are only six I/O lines to
work with on this part and I use five to
control the compass, so a synchronous
serial output was not in the cards for this
design. Figure 1 shows the schematic
for the Dinsmore 1490 project. I did the
pinout for the 1490 part as if I were
looking down on the top of it. Note that
the leads on the compass module are
not at .1 inch centers; they are flexible
“transistor” style leads.
Figure 2 shows what my board
layout looks like. I did the board using
one of the on-line PCB design programs
that link directly to their production
facilities. This works fine for simple
“one off” designs that you don’t want to go through the
work of doing more documentation, Gerber files, etc.
The parts placement for this board isn’t important;
there are no complex or high speed signals being used.
The PIC12F508 is running on its internal 4 MHz RC
oscillator which is just fine for timing a 2400 baud serial
connection under most circumstances.
I wrote the PIC code in PIC assembly. It is really easy to
do. The source for this project is a good starting point for
those wanting to do simple PIC projects and “bit bang” a
software UART to communicate. Low speed software UART
that don’t have a USART in hardware are quite reliable. If
you want to go over 9600 baud, however, you should look
to more accurate crystals and possibly a hardware USART to
handle it. In the case of this project, I used a simple lookup
table to translate the arbitrary bit patterns that will be seen
on the GPIO lines from the compass to a number from 0 to
7 that will be returned. The program first waits to see a
high to low transition on GPIO 5, then the program will
Figure 1. The Dinsmore 1490 board.
Figure 2. A simple compass board.
LISTING 1. Table Lookup.
;Set up the look up table of readings
;D16+READING = the register that has the
MOVLW 0xFF ; 16
MOVLW 4 ; South
MOVLW 2 ; East
MOVLW 3 ; South East
MOVLW 0 ; North
MOVLW 1 ; North East
; South West
; North West
; These last three are for
; they can’t be hit, no
; 0xFF can be hit.
SERVO 11.2009 15