Home
Service Manual
Contents
1. float c lat c lon float int c lon int c lat c lat child latitude parent latitude c lon child longitude parent longitude int c lon long int ceil c lon int c lat long int ceil c lat int c lon c lon int c lat gc lat if int c lat 0 0 amp amp int c lon 0 0 child theta 90 0 else if int c lat 0 0 amp amp int c lon lt 0 0 child theta 0 0 else if int c lat 0 0 amp amp int c lon gt 0 0 child theta 180 0 else if int c lon 0 0 amp amp int c lat 0 0 child theta 270 0 else if int c lon 0 0 amp amp int c lat gt 0 0 child theta 90 0 else child theta atan c_lat c_lon child theta child theta 180 0 3 1415926535898 if int c lat gt 0 0 amp amp int c lon lt 0 0 child theta child theta else if int c lat 0 0 amp amp int c lon 0 0 child theta 180 0 child theta else if int c lat 0 0 amp amp int c lon 0 0 child theta 360 0 child theta else child theta 180 0 child theta void calc_direction void if child theta gt 337 5 amp amp child theta lt 360 0 child theta gt 0 amp amp child theta lt 22 5 child direction E else if child theta gt 22 5 amp amp child theta lt 67 5 child direction P else if child theta gt 67 5 amp amp child theta lt 112 5 38 child direction
2. enable hl output low PIN B7 t31 0 output low PIN B6 t21 output low PIN B5 ol output low PIN B4 z1 enable hl WRITE DATA TO CG RAM FOR BOTTOM LEFT ARROW output high PIN B2 rsh 10 00000001 output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 output low PIN B5 f1 0 output low PIN B4 f41 enable hl output low PIN B7 t31 output low PIN B6 t21 A OG output low PIN B5 ol output high PIN B4 EA f enable hl output high PIN B2 rsh 10 00000010 output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 output low PIN B5 fl output low PIN B4 f41 enable hl output low PIN B7 t3h output low PIN B6 t21 output high PIN B5 o1 0 70 output low PIN B4 z1 enable hl output high PIN B2 rsh 10 00000010 output low PIN B3 rw1 output 1 output 1 output 1 output 1l ow PIN B7 s71 ow PIN B6 s61 ow PIN B5 f1 ow PIN B4 f41 enable hl output low PIN B7 t3h output low PIN B6 t21 output high PIN B5 ol output low PIN B4 z1 enable hl r Ld output high PIN B2 rsh 10 00010010 output low PIN
3. high PIN B4 hl PIN B7 PIN B6 high PIN B5 PIN B4 hl high PIN B2 w PIN B3 w PIN B7 high PIN B6 PIN B5 PIN B4 hl PIN B7 PIN B6 high PIN B5 PIN B4 hl high PIN B2 PIN B3 PIN B7 PIN B6 PIN B5 PIN B4 i h1 PIN B7 PIN B6 high PIN B5 PIN B4 h1 high PIN B2 h rwl rn B3 PIN B7 PIN B6 PIN B5 PIN B4 Ai lt lt lt hl PIN_B7 PIN_B6 PIN_B5 s61 fl 41 75 3 O t210 hr ea ee rsh rw1 sT1 s6h 10 01000010 OG i f 8105 41 t3h ELLET s Ol his rsh 10 00000010 rwl s71 s61 1 41 0 r r i li i r E E Shu 5 SEEDS o1 an rs 10 00000001 s71 s61 ET NP 0 r hy 0 t31 PS PELL d 0107 80 output high PIN B4 z10 enable hl output high PIN B2 rsh 10 00000000 output low PIN B3 A owe 0 output low PIN B7 s71 0 output low PIN B6 s61 0 output low PIN B5 f10 output low PIN B4 f41 enable hl output low PIN B7 t31 output low PIN B6 t21 output low PIN B5 ol output low PIN B4 zl enable hl END OF WRI ING 4TH CH
4. else input 0 0x00 input 1 0x0B input 2 20x73 input 3 0x10 input 4 0x00 input 5 0x00 input 6 0x00 input 7 0x00 input 8 0x00 input 9 0x00 input 10 0x00 input 11 20x00 VAA input 12 0x37 return 13 while i lt length timeout 0 kbhit kbhit wait max of 20 ms while kbhit 0 amp amp timeout lt 2000 delay us 10 kbhit kbhit if kbhit data getc input i data itt else return i return i KKKKKKKK KKK KKK KKK KKK KKK KKK k kc k KKK KKK KKK KKK ckok ck ke ke x x transceiver transmit x LE x KKKKKKKK KKK KKK KKK KKK KKK KKK k kc k KKK KKK KKK KKK ckok ck ke ke void transceiver transmit char data 20 int length char output 20 output 0 PREAMBLE output 1 PREAMBLE output 2 PREAMBLE output 3 SYNC output 4 0x00 output 5 char length BUS SWITCH CODE output_high PIN_B4 output low PIN B5 make sure the transceiver is not in hopping state while input DSR 1 delay us 10 M output low TE while input CTS 0 delay ms 1 transmit output 6 transmit data length output high TE while input CTS 1 delay us 10 if the transceiver has hopped while transmitting repeat transmission if input
5. child 4 struct parent struct Global structure for storing parent information boolean panic Child Panic state char direction N S E W Q Z M P parent struct output struct char package id Package id for transmission char alarm id Store parents alarm button status float latitude Latitude of the parent float longitude Longitude of parent char package id 2 Ending package id for transmission to child Start of main program main struct input_struct Structure for recieved data from child 41 to pare for tra char package id transmission char panic and child id information long int distance nt char direction from parent to child char package id 2 int i 3 nsmission from child char input 7 from child char output child code boolean transmit time false transmit reguest to child boolean first time true int error int time from GPS through the code checking errors on transmissions Used to control bus switch isn t floating and the PIC doesn t recieve garbage output low PIN C4 output low PIN C5 Delay to let GPS acquire satellites delay ms 2000 delay ms 2000 delay ms 2000 delay ms 2000 delay ms 2000 delay ms 2000 delay ms 2000 delay ms 2000 delay ms 2000 Mak
6. gt panic and child gt panic and chi gt panic and chi gt panic and chi bit test input packet amp amp bit test input packet wait 50ms x if CHILD NUMBE ld id 3 else if CHILD ld id 2 else if CHILD Td dd 1 else if CHILD error bit gt panic_and_chi ld id 0 error bi error bi error bi child 1 NU T Z C NU R 1 Ces 0 0 amp amp bit test input packet 0 t packet t packet t packet t packet 30 if error 1 input PIN B3 1 turn on alarm output high PIN BO turn on green gereral alarm LED output high PIN B2 lse if error 0 turn off alarm output low PIN BO turn green gereral alarm LED off output low PIN B2 get panic data error bit test input packet gt panic and child id 4 if error 1 input PIN B3 1 output high PIN BO output high PIN B1 ow PIN BO output 1 low PIN B1 output get location from GPS Bus Switch code delay ms 1000 output low PIN B4 output high PIN B5 get cposition is location valid if not valid current loction previous location if valid save current location get distance and direction child longitude 39 6334 30ft child latitude 79 9639 parent latitude 39 6333
7. LON out at ranga indicator os f r I Begin drei haki Dai wel imaje and exl I I I I I I update boop kr child alarme oi at ranga bi W amcared Update Children darin amrai an paroni LCD Deienure which child device in sprer bars nanga imi direct in kop Trani parent longeecs and bidude 1n chid dee cs 1 Bias red diri w drertian v TTA TT Fi Va Fa b a E Hari A E F y F N H Yes fis ma chi d Did ees em B l gt n NANA 7 JE P ai on bean E y n E s prassan al vr I Stare child n as mal of ange io tus saca child nacer res ponds d Tum alam and LED pasa miim gn parent deci Snare child n karan i Tum an parent aim Figure 6 Parent Flow Chart 15 Block 1 Getting ready for operation The GPS requires up to 90 seconds to acquire enough satellites to determine the parent device s location The PIC16F877 checks to see how many children are present by checking which dipswitches are moved to the on position Block 2 Getting ready for transmission to child device The PIC16F877 checks to see if the parent alarm has been pressed and stores the status of the alarm button The PIC16F877 sends a request to the GPS for the current position of the parent device The longitude and latitude given by the GPS is then stored The GPS and PIC16F877communication can be watched by monitoring the USAR
8. output 1 H output high PIN B5 output high PIN B6 ow PIN B4 output low PIN B7 enable hl void low t void OU ou ou ou ou ou tpu tpu tpu tpu tpu tpu t t te ts t high PIN_B2 low PIN B3 high PIN B4 high PIN B5 high PIN B6 low PIN B7 enable hl RS TO HIGH R W TO HIGH gt 0110 HIGH ORD RS TO HIGH R W TO gt 0100 RS TO HIGH R W TO HIGH gt 0110 HIGH ORD RS TO HIGH R W TO gt 0110 RS TO HIGH R W TO LOW gt 0111 HIGH ORD LOW LOW ORDER NIBBLE LOW LOW ORDER NIBBLE ER NIBBLE ER NIBBL ER NIBBL EH 68 output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW output low PIN B4 0100 LOW ORDER NIBBLE output low PIN B5 output high PIN B6 output low PIN B7 enable hl void low_n void 0110 1110 void low_o void 0110 1111 void low u void 0111 0101 BLOCK FOR VISIBLE ALARMS void block void output high PIN B2 RS TO HIGH output low PIN B3 R W TO HIGH output high PIN B4 gt 1111 HIGH ORDER NIBBLE output high PIN B5 output high PIN B6 output high PIN B7 enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW output high PIN B4 gt 11
9. parent longitude 79 9639 parent latitude input packet gt latitude parent longitude input packet gt longitude calc distance calc theta calc direction get panic button state if input PIN B3 1 31 else else set panic bit bit set output panic and child id 7 turn on panic LED output high PIN B1 set panic bi bit clear outpu to 0 panic and child id 7 turn panic LED off output low PIN B1 initialize output packet output pac output pac output dis kage id 0x73 kage id 2 0x37 tance child distance output direction child direction output theta child theta output distance 100 output theta 99 99 output direction 0x00 if CHILD NUMBER 1 else if CHILD NUMB bit clear ou bit clear ou bit set outp bit clear ou else if CHILD NUMB bit clear ou bit set outp else if CHILD NUMB bit set outp bit set outp z ah u H u H u u put panic and child id 5 put panic and child id 6 t panic and child id 5 tput panic and child id 6 tput panic and child id 5 t panic and child id 6 t panic and child id 5 t panic and child id 6 transmit output packet output distance 100 output direction N output low PIN B5 output high PIN B4 data amp output transceiver transmit data
10. xwl NE B3 PIN B7 PIN B6 PIN B5 PIN B4 hl high PIN B6 high PIN B5 low PIN B4 hl PIN B3 PIN B7 PIN B6 PIN B5 high PIN B4 hl PIN B7 PIN B5 PIN B4 h1 high PIN B2 low PIN B3 high PIN B6 oh z zh 41 high PIN B7 high PIN B2 h xwl SJ ST i high PIN B6 o1 zh t3h t2h rs 10 00001110 s71 s61 1 0 0 y i i r S t31 0 t21 v E sd lahi rs 10 00010101 OG s61 f1 S N i ja t31 t2h 01 zh rsh 10 00000100 rwl s71 s61 1 41 0 y r i i li t3h ef E210 S Ean NE 01000100 82 output_low PIN_B7 output_high PIN_B6 output_low output_low PIN_B5 PIN_B4 enable_hl output_low PIN_B7 output_high PIN_B6 o1 Pl output low PIN B5 output low PIN B4 enable hl output high PIN B2 output low PIN B3 output low PIN B7 output low PIN B6 output low PIN B5 output low PIN B4 enable hl output low PIN B7 output high PIN B6 Ol PET AG output low PIN B5 output low PIN B4 enable hl output high PIN B2 h rwl output low PIN B3 output l
11. Recarerss parent alam status longilude and latitude CHILD DEVICE FLOW CHART um n Fem oul range loss of communciation LED Tes KL N 5 alarm LET Gel basain nar GPS Block ls tha location valid no satellite gt s hinckage i M Current keabon TANSMI Curerd i previous localion distance draction I and parc information i ll ee TEE i I 1 i Tamale child s i i distance and i drection i Figure 7 Child Block Diagram 18 Block 1 Waiting for GPS acquisition and parent information The PIC16F877 waits 90 seconds for the GPS to acquires satellites and determine the child device s longitude and latitude coordinates The GPS and PIC16F877communication can be watched by monitoring the USART transmit pin PIN 25 and the USART receive pin PIN 26 on the PIC16F877 Refer to Appendix A for the request sent to the GPS and a typical response received from the GPS The PIC16F877 enters a receive mode until it receives the parent devices location and alarm status or times out If the child devices times out this means the parent device didn t send a transmission The PIC16F877and the transceiver communication can be watched by monitoring the USART receive pin PIN 26 on the PIC16F877 Refer to Appendix C for a typical transmission received from the child device Block 2 Process and store the information received from the parent
12. output 7 0x0A Line Feed data length receive input 27 transmit output 8 while kbhit 0 delay us 10 data length receive input 23 data length receive input 27 Conversion of the input 0 9 into floating point latitude latitude int input 0 48 10 int input 1 48 temp int input 3 48 10 int input 4 48 temp temp int input 6 48 1 int input 7 48 01 temp temp int input 8 48 001 int input 9 48 0001 temp temp 60 latitude latitude temp child latitude latitude Conversion of the input 13 26 into floating point longitude longitude int input 13 48 100 longitude longitude int input 14 48 10 int input 15 48 temp int input 17 48 10 int input 18 48 temp temp int input 20 48 10 int input 21 48 100 temp temp int input 22 48 1000 int input 23 48 10000 temp temp 60 longitude longitude temp child longitude ET longitude longitude amp amp latitude output high PIN B2 data length receiv input 26 37 data length receive input 23 KKKKKKKK KKK KKK KKKK KKK KKK KKK KKK KKK KKK e temp distance and direction K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKI void calc theta
13. 0x40 output 1 0x40 Q output 2 0x45 E output 3 0x71 q output 4 0x00 0 for the mode of output once output 5 0x34 Checksum for Eq0 output 6 0x0D Carriage Return output 7 0x0A Line Feed transmit output 8 data_length receive input 22 Conversion of the input 20 21 into integer seconds time int input 20 48 10 int input 21 48 return time KKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK kok e ke transmits first n characters of the output array where n length kah KK KKK KK k k K k K k k kc KOK kck k kck ck kck ck KOK KOR kO ke ke e void transmit char output 20 int length int i 0 for i 0 1i lt length i putc output il K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKI receives n characters and stores them in the first n elements of the 48 input array where n length and is NOT equal to 0 If lenght 0 it continues to get characters data it receives a carriage return Ki K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKAI int receive char input 20 int length char data a long int timeout 0 int i 0 int kbhit 0 timeout 0 if length 0 A while data 0x0D Z kbhit kbhit L wait max of 20 ms while kbhit 0 amp amp timeout lt 2000 delay us 10 kbhit kbhit if timeou
14. determined by the GPS unit will be sent serially through the UART and stored by a software component Bus Switch This block will determine if the data entering the UART is communicating with the transceiver or the GPS unit Coordinate Manipulation This block will first check the child selector switch to determine the number of children This block will then start polling the children through the transceiver It will gather and store both the parent and child GPS coordinates Panics or Alarms This block will check the data received from the child through the transceiver for the child s panic state A child s panic state is considered on under any of two conditions if the child is out of range of the parent and or if the child has pressed their own panic button Distance and Direction This block takes the child information received by the transceiver uses the digital compass to update the direction It then displays the child information on the display Display This block contains a display for the parent which shows the distance and direction to the child ren Audio Alarm This block contains an alarm to notify the parent that a child is in a panic state Parent Panic LED This block contains an LED that will turn on when it receives a signal from the PIC The only time it will receive a signal from the PIC is when the parent presses the panic button on the parent device It will only turn off when the panic button is pressed aga
15. device The parent s transmission to the child includes the child s out of range and the parent s alarm information According to the transmission received by the child device the appropriate LED s and the alarm is turn on Block 3 Now that the parent location and the child location is known the distance and direction from parent to child is calculated for transmission back to the parent device Block 4 Now that the distance and direction of from the parent is located it is transmitted back to the parent The transceiver and PIC16F877 communication can be watched by monitoring the USART transmit pin PIN 25 on the PIC16F877 Refer to Appendix C for a typical transmission received from the child device 19 SUBSYSTEM BREAKDOWN The Microchip processor is responsible for controlling each device If the parent or child device would fail to operate the problem may be found by checking one of the following subsystems Below is a listed of expected outputs from each device including possible reasons for error The pinouts for many many of the devices are included in the text and in appendices It may be helpful in troubleshooting to download the specifications for each device from the manufactures homepage Power Circuit Refer to the schematic of the power circuit located in the schematics in Figure 2 and Figure 3 on pages 11 and 12 The circuit can be found on the perforated circuit board within the parent and child units With
16. fully charged batteries there should the power circuit should always output 4 85 5 15 volts and 2 85 3 15 to the respective power bus To verify this check that there is 3 volts at the output of pin 3 of the 3V voltage regulator and 5 volts at the output pin 3 of the 5V voltage regulator If the appropriate voltage levels are found the regulators are working properly Also check the power busses located on the parent child device to ensure proper voltage readings If an unexpected voltage level is found check all connections within the power circuit and the parent child main circuit board PIC16F877 As previously mentioned the PIC16F877 controls all input and output devices A good indication that the PIC may be malfunctioning is if the LCD never initializes The fist place to check is the power circuit Make sure appropriate voltages are on the power busses Next check to see if pin 1 and pin 11 have 5 volts Next check all grounds to the PIC Refer to the schematics to find which pins are tied to ground Another possible problem may be the oscillator Using an oscilliscope the oscillator can be tested for the right frequency output If all this seems to be operating correctly the PIC may need to be replaced Replace the PIC with another PIC with the same specifications and the respective hex file generated from MPLAB C Transceiver To ensure that the transceivers are communicating properly first monitor pin 20 of the transceiver i
17. high PIN B5 output low PIN B6 output low PIN B7 enable hl output high PIN B2 output low PIN B3 output low PIN B4 output high PIN B5 output low PIN B6 output low PIN B7 enable hl e hree void output high PIN B2 output low PIN B3 output high PIN B4 output high PIN B5 output low PIN B6 output low PIN B7 r enable hl output high PIN B2 output 1ow PIN B3 r output high PIN B4 output high PIN B5 output low PIN B6 output low PIN B7 enable hl our void output high PIN B2 output low PIN B3 output high PIN B4 output high PIN B5 RS TO HIGH R W TO HIGH gt 0011 HIGH ORDER NIBBLE RS TO HIGH R W TO gt 0010 RS TO HIGH R W TO HIGH gt 0011 HIGH ORDER NIBBL RS TO HIGH LOW LOW ORDER NIBBLE Gl R W TO LOW gt 0011 LOW ORDER NIBBLE RS TO HIGH R W TO HIGH gt 0011 HIGH ORDER NIBBLE 62 five output low PIN B6 output low PIN B7 enable hl output high PIN B2 output low PIN B3 output low PIN B4 output low PIN B5 output high PIN B6 output low PIN B7 enable hl void five void six output high PIN B2 output low PIN B3 output high PIN B4 output high PIN B5 output low PIN B6 output low PIN B7 enable hl ou
18. on pins 7 and 14 of each logic chip If all chips in the switch have power and ground and there are no discontinuities then one or more of the chips must not be functioning correctly Replace each chip noting that the 7404 NOT chip needs to be replace by a chip that interfaces with the GPS receiver s 3V logic levels 29 Appendix A Position request sent to GPS and corresponding response GPS location request ASCII EqmC lt CR gt lt LF gt GPS response ASCII Eq mm dd yy hh mm ss dd mm mmmm n ddd mm mmmm w shhhh h sss s hh h m t dd d nn rrrr aa CCC lt CR gt lt LF gt The parent device is only concerned with the current longitude and latitude all other information can be disregarded Date mm month 01 12 dd day 01 31 yy year 99 19 UTC Time hh hours 00 23 mm minutes 00 59 SS seconds 00 60 Latitude dd degrees 00 99 mm mmmm minutes 00 59 9999 n direction N North S South Longitude ddd degrees 000 180 mm mmm minutes 00 59 9999 w direction W West E East Velocity SSS S speed in knots 000 0 999 9 hhh h heading in degrees 000 0 359 9 Reciever status m fix mode 0 autonomous 1 differential t fix type 0 no fix 1 2D fix 2 3d fix 3 propagate mode dd d dilution of preciesion DOP 00 0 99 9 nn number of satellites in use 00 37 rrr reference station ID 0000 1023 aa age of differential data in s 00 60 CCC checksum 000 255 24 Appendix B Digital compass directions and PIN data Vee 45
19. output low PIN B6 7 output high PIN B ow ow N enable hl 0110 LOW ORDER NIBBLE RS TO HIGH R W TO HIGH gt 0011 HIGH ORDER NIBBLE RS TO HIGH R W TO LOW gt 0111 LOW ORDER NIBBL RS TO HIGH R W TO HIGH gt 0011 HIGH ORDER NIBBL RS TO HIGH R W TO LOW gt 1000 LOW ORD F HJ ER NIBBLE 64 void nine void output high PIN B2 RS TO HIGH output low PIN B3 R W TO HIGH output high PIN B4 0011 HIGH ORDER NIBBLI output high PIN B5 output low PIN B6 output low PIN B7 enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW output high PIN B4 gt 1001 LOW ORDER NIBBLE output low PIN B5 output low PIN B6 output high PIN B7 enable hl CHARACTERS Space void space void output high PIN B2 RS TO HIGH output low PIN B3 R W TO HIGH output low PIN B4 0010 HIGH ORDER NIBBLE output high PIN B5 output low PIN B6 output low PIN B7 enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW output low PIN B4 0000 LOW ORDER NIBBLE output low PIN B5 output low PIN B6 output low PIN B7 enable hl void pound void output high PIN B2 RS TO HIGH output low PIN B3
20. range if child i distance gt 2500 child i oor true else child i oor false Turn on parent alarm if any child devices are out of if child 1 oor child 2 oor child 3 oor true output high PIN A5 else output low PIN A5 Update LCD with each child s position and info Check Panic and OOR check pan oor delay ms 1000 Display child names big c low h low i OG r low 1 low d one Space Display the distance display distance low f 7 low t Display the directions get compass display direction Displays the rest of the children on the Display display roc KKKKKKKK KKK KKK K K K K KKK KKK KKK KKK KKK KKK KKK Ck kCk Ck KKK kok k Ck kc k Ck KOK k KKK I ck KKK KKK KKKKKKKKK KKK KKK KKK Ck k K Ck KKK KKK k kc k k kc k ck KKK KKK KKK KOK ke ke ke e KKK KK KK KKK KKK k k k ke k k e Get lon and lat KOK KOK KKK KK k k k k k k KK KK void get position char output 8 46 48 char input 27 char crap long int i int data_length 0 float temp float latitude float longitude delay_ms 2000 output 0 0x40 output 1 0x40 Q output 2 0x45 E output 3 0x71 q output 4 0x00 0 for the mode of output once output 5 0x34 Checksum for Eq0 output 6 0x0D Carriage Return outp
21. switch mult case 1 one break case 2 two break case 3 three break case 4 four break case 5 five break case 6 six break case 7 seven break case 8 eight break case 9 nine break 56 default zero break KOK KKK k k k X k k k K K k K KOK K K KOK k K KOK K I KOK KOK KOK K KOK KOK KOR KOK K K OO e e ke x displays to the LCD whether or not the panic x pe or out of range are set for a child KOK KK KR KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK kk e ke void check pan oor void if child 1 present true line1 if child 1 panic true block else space if child 1 oor true block else space else space space K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKAI Kf initialized the LCD s x KKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK kk e ke void initialize lcd void delay ms 100 Wait more than 15ms after Vcc 4 5V the number was made to be 100ms because of the wider voltage operating range of the PIC compared to that of the LCD output low PIN B1 delay ms 1 37 output low PIN B2 4 bit output low PIN B3 output low PIN B4 output high PIN B5 output low PIN B6 output low PIN B7 enable hl output low PIN B2 Set N and F output
22. t31 output low PIN B6 t21 output low PIN B5 ol output low PIN B4 zl enable hl output high PIN B2 10 00000000 output low PIN B3 pulu output low PIN B7 d output low PIN B6 s61 output low PIN B5 f10 output low PIN B4 f41 enable hl output low PIN B7 t31 output low PIN B6 t21 output low PIN B5 ol output low PIN B4 zl enable hl END OF WRITING 1ST CHAR O SET CG RAM ADDRESS TO 2ND CHAR 1 output low PIN B2 rsl 00 01001000 Set CG RAM address output low PIN B3 rwl output low PIN B7 s71 output high PIN B6 s6h output low PIN B5 f1 0 output low PIN B4 f41 enable hl output high PIN B7 t31 0 output low PIN B6 t21 0 output low PIN B5 ol output Low PIN B z 21 enable hl M T 1111111 WRITE DATA TO CG RAM FOR BOTTOM RIGHT ARROW output high PIN B2 rsh 10 00010000 output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 E output low PIN B5 f1 0 r r r 73 output high PIN B4 f4h enable hl output low PIN B7 t31 0 output low PIN B6 t21 output low PIN B5 ol output low PIN B4 z1 enable hl output high PIN B2 rsh 10 00001000 output low PIN B3 rw1 output low P
23. void zero void void one void void two void void three void void four void void five void void six void void void void void void void void void void void void void void void void void void void void seven void eight void nine void space void block void pound void right arrow void left arrow void up arrow void down arrow void top left arrow void top right arrow void bottom left arrow void bottom right arrow void check pan oor void cursor move left void cursor move right void display num int mult display distance void void display direction void void void void update direction void create arrows void display on void 92 void void void void void void long void void top right arrow void bottom right arrow void top left arrow void bottom left arrow void down arrow void up arrow void int get dir char dir display roc void get compass void Transceiver h NOTE This is for the child device The parent devic another transceiver h defi defi defi defi defi H 68 ne T ne CTS 56 ne DSR 57 ne CONFIG START BYTE 0x65 ne PREAMBLE 0x55 defi char char void int t ne SYNC 0x3A PORTC 0x07 PORTD 0x08 transceiver tran
24. 0 output low PIN B1 output low PIN B3 while TRU Gl output low PIN B4 output low PIN B5 for i 0 i lt 10000 i loop for 10 seconds if kbhit 0 delay ms 1 else error transceiver_receive input_data 11 input packet struct input struct input data if error 11 amp amp input packet gt package id 0x73 amp amp input packet gt package id 2 0x37 if bit test input packet gt panic and child id 7 0 if bit test input packet gt panic and child id 6 0 if bit test input packet gt panic and child id 5 0 29 child exit loop if polling this i 10000 break get panic button state gt updates panic LED if input PIN B3 1 gt panic and child id 4 1 else kI set pa bit set turn output hig turn ou on on output hig set panic bi bit clear outpu turn panic LE panic Li h PIN B1 CT CT bit test input packet nic bit tput panic and child id 7 ED audio alarm h PIN BO ko c7 panic and child id 7 D off output low PIN B1 turn off audio alarm output low PIN B0 if error 11 amp amp input packet gt package id 0x73 amp amp input packet gt package id 2 0x37 amp amp Id id 7 gt panic and chil gt panic and chi
25. 11 LOW ORDER NIBBLE output high PIN B5 output high PIN B6 output high PIN B7 enable hl ARROWS right arrow void right arrow void 69 output output outpu outpu outpu outpu t b t t enable hl output high PIN B2 output low output low PIN B4 output high PIN B5 output high PIN B6 output high PIN B7 enable hl left arrow void left arrow void output output outpu outpu outpu outpu t t E t enable hl output hig output low output high output high output high output high enable hl high PIN B2 low PIN B3 high PIN B4 high PIN B5 high PIN B6 low PIN B7 high PIN B2 low PIN B3 high PIN B4 high PIN B5 high PIN B6 low PIN B7 RS TO HIGH R W TO HIGH RS TO HIGH PIN B3 r RS TO HIGH R W TO HIGH r RS TO HIGH R W TO h PIN B2 PIN B3 51111 E E void enable hl void output high PIN B1 delay ms 1 output low PIN B1 delay ms 1 E HIGH E LOW void create arrows void SET CG RAM ADDRESS TO 1ST CHAR 0 output low PIN B2 rsl output low P IN B3 rw1 1110 LOW ORD DATA BEING SI 50111 HIGH ORD R W TO LOW gt 0111 HIGH ORD LOW LOW ORD ER NIBBLE ER NIB
26. 21 output low PIN B5 ol output low PIN B4 z1 enable hl M T L T BP 1 5 A 1 1 1 1 11 ff 1 1 1 WRITE DATA TO CG RAM FOR UP ARROW output high PIN B2 rsh 10 00000100 output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 output low PIN B5 f1 0 output low PIN B4 f41 0 enable hl output low PIN B7 t3h output high PIN B6 t2h output low PIN B5 oh output low PIN B4 zh enable hl output high PIN B2 rsh 10 00000100 output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 0 output low PIN B5 f1 0 output low PIN B4 f41 0 enable hl 84 output low PIN B7 t310 KE a I output low PIN B5 oh output low PIN B4 zh enable hl output high PIN B2 rsh output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 output low PIN B5 f1 0 output low PIN B4 f41 enable hl output low PIN B7 t310 output high PIN B6 t2h output low PIN B5 ol output low PIN B4 zh enable hl output high PIN B2 rsh output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 0 output low PIN B5 f1 0 output low PIN B4 f41 enable hl output low PIN B7 t3
27. 21 0 output 1 output 1 enable hl down arrow void dow output high PIN B2 rsh ow PIN B3 rwl s71 output 1 output 1 output 1 output 1 output 1 OW OW OW OW n arrow void PIN B7 PIN B6 PIN B5 PIN B4 SLA lt lt s s6 SL EL 41 ow PIN B5 oh ow PIN B4 zl 00 00001110 10 00000100 10 00000101 87 enable hl output 1 output output 1 high PIN B4 zl output enable hl top left arrow void top left arrow void ow PIN B7 t31 high PIN B6 t210 ow PIN B5 oh OG OG output high PIN B2 rsh 10 00000011 output 1 output 1 output 1 output 1 output 1 ow PIN B3 rwl ow PIN B7 ow PIN B6 ow PIN B5 ow PIN B4 s61 lt NG ES enable hl output 1 output 1 enable hl top right arrow void top right arrow void LO sT1 LO ow PIN B7 t3l ow PIN B6 t21 output high PIN B5 oh output high PIN B4 z1 r r 1 f41 output high PIN B2 rsh 10 00000000 output 1 output 1 output 1 output 1 output 1 ow PIN B3 rwl ow PIN B7 ow PIN B6 ow PIN B5 ow PIN B4 s6 GA R VA lt R S enable hl output 1 output 1 output 1 output 1 PIN B7 PIN B6 PIN B5 P
28. 6 32 turn on alarm output high PIN BO turn on green out of range L output high PIN B2 ED f KKKKKKKK KKK KKK KKKK KKK KKK KKK KKKK KKK KKK KKK KKK KKK KKK Ck kc k Ck KKK KKK KKK KKK KKK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKIKI K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKII transmits first n characters of the output array where n length kkkkkKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKAKK void transmit char output 20 int length int i 0 for i 0 i lt length i f putc output i KOK k kok k k X k k kok k k K KOK K K KOK K K KOK k KKK KOK KOR kO ke receives n characters and stores S them in the first n elements of the input array where n length and is NOT equal to 0 If lenght 0 it KIA continues to get characters data nd it receives a carriage return Kf K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKI int receive char input 20 int length char data a long int timeout 0 int i 0 int kbhit 0 timeout 0 if length 0 KP while data OxOD kbhit kbhit Lf wait max of 20 ms while kbhit 0 amp amp timeout lt 2000 ZZ delay us 10 kbhit kbhit if timeout gt 2000 33 return 0 if kbhit data getc input i data i else f return i
29. AR 3 SET CG RAM ADDRESS TO 5TH CHAR 4 output low PIN B2 rsl 00 01100000 Set CG RAM address output low PIN B3 rwl output low PIN B7 s71 output high PIN B6 s6h output high PIN B5 fl output low PIN B4 f41 0 enable hl output low PIN B7 t31 output low PIN B6 t21 output low PIN B5 ol output low PIN B4 z1 enable hl Ts s JA SERE Zh T 1 EK 1 Jf 1 WRITE DATA TO CG RAM FOR UP ARROW output high PIN B2 rsh 10 STI output low PIN B3 rwl output low PIN B7 S7107 output low PIN B6 s61 0 output low PIN B5 f1 0 output low PIN B4 f41 enable hl 81 output_low output_ output_low output_low enable output output lo output lo output lo output lo output lo enable output output output output enable output output low output low output low output low output enable output low output high PIN B6 output low PIN B5 output high PIN B4 enable hl output high PIN B2 output low PIN B3 output low PIN B7 output low PIN B6 output low PIN B5 output low PIN B4 enable hl output low PIN B7 output output low output low enable output output PIN B7 PIN B5 PIN B4 hl high PIN B2 h
30. B3 rw1 output 1l output 1l output 1l output high PIN B4 41 ow PIN B7 s71 ow PIN B6 s61 ow PIN_B5 f1 enable hl output low PIN B7 t3h output low PIN B6 t21 output high PIN B5 ol output low PIN B4 zh enable hl r output high PIN_B2 rsh 10 01010100 output low PIN B3 rwl output 1 high PIN B6 s6h output output 1 high PIN B4 410 output enable output 1 high PIN B6 t2h output output 1 output 1l ow PIN B7 s71 ow PIN B5 fl hl ow PIN B7 t31 ow PIN B5 o1 0 ow PIN B4 zh enable hl r output high PIN B2 rsh 10 00011000 output low PIN B3 rw1 output low PIN B7 s71 output 1 output 1 ow PIN B6 s61 ow PIN B5 f10 TI output high PIN B4 f41 enable hl output high PIN B7 t31 0 output 1 output 1 output 1l enable hl ow PIN B5 oh ow PIN B6 t21 ow PIN B4 zh output high PIN B2 rsh 10 00011110 output low PIN B3 rw1 S710 output 1l output 1l output 1 output enable output output output ow PIN B7 ow PIN B6 hl s61 ow PIN_B5 f1 high PIN B4 41 high PIN B7 t3h high PIN B6 t2
31. BL ER NIBBLE ER NIBBLE ENT TO LCD STOP OF DATA TRANSFER L 00 01000000 Set CG RAM address 70 output low PIN B7 s71 output high PIN B6 s6h output low PIN B5 24 8105 out put low PIN_B4 41 enable hl output low PIN B7 t31 output low PIN B6 t21 output low PIN B5 ol output low PIN B4 zl enable hl LV WRITE DATA TO CG RAM FOR TOP RIGHT ARROW output high PIN B2 rsh output low PIN B3 rwl output low PIN B7 s71 0 output low PIN B6 s61 0 output low PIN B5 f1 0 output low PIN B4 f41 enable hl PIN B7 PIN B6 PIN B5 PIN B4 output high t3h output high output high output high oh zh S r Re NE enable hl output high PIN B2 rsh output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 output low PIN B5 f1 0 output low PIN B4 f41 0 enable hl output low PIN B7 t31 0 output low PIN B6 t21 OG OG output high PIN B5 oh output high PIN B4 zh enable hl output high PIN B2 rsh output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 output low PIN B5 fl output low PIN B4 f41 enable hl t2h 0 10 00001111 10 00000011 10 00000101 71 outp
32. CHILD LOCATOR Service Manual DECEMBER 12 2001 AUTHORS JEREMY DAY JOSHUA DAY GARY SHIVES RICHARD BEVINS ISRAEL HALL TABLE OF CONTENTS INTRODUCTION SYSTEM DESCRIPTION INTRODUCTION The Child Locator is composed of two or more devices the parent and up to four child devices The Child Locator uses GPS technology to acquire both the parent and child devices location Using GPS technology allows the Child Locator to be a versatile child location system It can operate in any outdoor environment in the world In order to achieve the range of operation needed the Child Locator uses spread spectrum transceivers that give a large range of communication The transceivers operate at 2 4Ghz where few other wireless communication devices operate This allows for fewer communication problems with other devices using the same frequency band The Child Locator is a true stand alone device that doesn t require any centralized computer or special hardware to be set up in the area of use The Child Locator uses a GPS to acquire the parent and child device s location Once the parent longitude and latitude coordinates have been determined it is then sent to the child device by the transceiver to calculate the relative distance and location from the parent The child device then sends the distance and direction back to the parent device by the transceiver Once the parent receives the child devices distance and direction it is then disp
33. DSR 0 1 clear latch transceiver transmit data length R K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKII Kf transceiver receiv x xz KKKKKKKK X k k k K k k K K K K K K K K k K K k K KOK KOK K k kok k kok ck ckck ck KOR O ke e int transceiver_receive char data 20 int length bytes EY long int len i char receive data 20 BUS SWITCH COD Lu receive length 2 bytes gt accounts for lenght high and low from transceiver for i 0 1 lt 10000 i delay ms 1 if i 10000 len receive receive data length 2 strip the length high and length low bytes off of transmission for i 0 i lt len 2 i data i receive data i 2 return int receive data 1 return 0 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKII y get position x E KKKKKKKK KKK KKK KKK KKKK KKK KKK KKK Ck kck ck KKK KKK I ck ckok ck ke Y e void get cposition char output 8 char input 27 36 char crap long int i 0 int data length 0 float temp float latitude 2 55 float longitude 6 66 delay ms 2000 output 0 0x40 output 1 0x40 output 2 0x45 E output 3 0x71 q output 4 0x00 0 for the mode of output once output 5 0x34 Checksum for Eq0 output 6 0x0D Carriage Return
34. IN B4 Ow Ow Ow Ow lt gt lt S lt enable hl bottom left void bottom left arrow void outpu outpu outpu outpu outpu outpu t Er 1 t ta arrow low PIN_B7 PIN_B6 PIN B5 PIN B4 low low low lt lt s LO sT1 LO sf EST t21 01 z1 1 41 OG high PIN B2 rsh 10 00000010 low PIN B3 rwl s71 s61 1 41 88 enable hl output low PIN B7 t31 0 output low PIN B6 t21 output high PIN B5 oh output low PIN B4 z1 enable hl bottom right arrow void bottom_right_arrow void output high PIN B2 rsh 10 00000001 output low PIN B3 rwl output low PIN B7 s71 output low PIN B6 s61 0 output low PIN B5 f1 0 output low PIN B4 f41 enable hl output low PIN B7 t31 0 output low PIN B6 t21 output low PIN B5 oh output high PIN B4 zl enable hl char get_compass void Check to see the orientation of parent device char direction if input PIN A0 amp amp input PIN Al parent direction Q NE else if input PIN A0 amp amp parent direction Z NW else if input PIN_A2 parent direction P SE else if input PIN_A2 parent directio
35. IN B7 s71 output low PIN B6 s61 0 output low PIN B5 f1 0 output low PIN B4 f41 0 enable hl output high PIN B7 t3h output low PIN B6 t21 output low PIN B5 ol output low PIN B4 z1 enable hl output high PIN B2 rsh 10 00001000 output low PIN B3 rw1 output low PIN B7 s71 output low PIN B6 s61 0 output low PIN B5 f1 0 output low PIN B4 f41 0 enable hl output high PIN B7 t3h output low PIN B6 t21 output low PIN B5 ol output low PIN B4 z1 enable hl output high PIN B2 rsh 10 00001001 output low PIN B3 rw1 output low PIN B7 s71 output low PIN B6 s61 0 output low PIN B5 f1 0 output low PIN B4 f41 enable hl output high PIN B7 t3h output low PIN B6 t21 output low PIN B5 ol output high PIN B4 zh 74 enable hl output high PIN B2 rsh 10 01000101 output low PIN B3 rwl output 1 ow PIN B7 s7l output high PIN B6 s6h output 1l output 1 enable output 1 output output 1l output enable hl hl ow PIN_B5 f1 ow PIN B4 41 ow PIN B7 t31 high PIN B6 t2h ow PIN B5 ol high PIN B4 zh l output high PIN_B2 rsh 10 00000011
36. KK KKK Ck kc k Ck kc k k kok ck KKK KKK KKK k float lat sqr lon sqr dist more accurate calc lat sqr 69 1 69 1 child latitude parent latitude child latitude parent latitude more accurate calc cos parent latitude 57 3 only used for more accurate calculation can be taken out cont lon sqr 69 1 69 1 lon sqr more accurate calc more accurate calc this line can be taken out if not enough RAM concluded lon sar child longitude parent longitude child longitude parent longitude dist sqrt lat sgr lon sqr in miles dist 5280 0 in feet child distance long int dist hay 40 Appendix F Complete Parent Software Parent Device Software Created by Team 20 Child Locator device PIC16F877 include 16F877 H include trans h include serial h include display h use fast io B Decreases the number of lines in the output of Port B include lt stdlib h gt include lt math h gt fuses HS NOWDT NOPROTECT Declaring global variables struct child struct Global structure for storing child information boolean present Tells parent device if child is present switch info long int distance Distance from parent to child char direction Relative direction from parent to child boolean oor Set if child i is out of range boolean panic Set if child i sends a panic
37. N else if child theta 112 5 amp amp child theta 157 5 child direction Q else if child theta gt 157 5 amp amp child theta lt 202 5 child direction W else if child theta gt 202 5 amp amp child theta lt 247 5 child direction Z else if child theta gt 247 5 amp amp child theta lt 292 5 child direction S else child direction M void calc_distance void float lat sqr lon sqr dist lat sar 69 1 69 1 child latitude parent latitude child latitude parent latitude lon sgr 53 53 lon sar child longitude parent longitude child longitude parent longitude dist sqrt lat sgr lon sqr in miles dist 5280 0 in feet child distance long int dist void calc_distance void ekk k kok k oko k k k K K k K K K K K K K K k oko K K KOK K K KOK K K KOK KOK KOK KOK KOK KOK K Ck Ck kc k K K KOK kok ck kck ck kok ck ck KOK K Ji Approximate distance in miles sqrt x x y y Kf Kf J where x 69 1 lat2 latl kf gt and y 53 lon2 lonl Kf jo You can improve the accuracy of this approximate distance Ef calculation by adding the cosine math function x x Aisi Approximate distance in miles sqrt x x y y tf 39 Kf where x 69 1 lat2 latl K J and y 69 1 lon2 lonl cos latl 57 3 x KKKKKKKKKKKKKKKKKK KKK KKK KKK KKK KKK KKK KKK Ck kCk Ck K
38. N B4 enable hl output high PIN B7 output low PIN B6 output low PIN B5 output low PIN B4 enable hl output high PIN B2 output low PIN B3 output low PIN B7 output low PIN B6 output low PIN B5 output high PIN B4 enable hl output low PIN B7 output high PIN B6 010 sh PIN B5 PIN B4 output low output low enable hl output high PIN B2 output low PIN B3 output low PIN B7 rwlO A STAY 5 h rwl s71 RAM FOR TOP RIGHT ARROW rsh 10 00011110 0 r r r s61 N 1 n 3n0 t2h NE zh rsh TUSONG s71 s61 E 10 00011000 EN d LESI t21 oh zh rs 10 00010100 0 s61 f1 x bA i i li t31 t2h et ys s7T1 rsh 10 00010010 79 output_low output_low output_ enable output low output low output output low enable output output lo output lo output output low output low enable output low output low output output low enable output output low output low output low output low output low enable output low output low output output low enable output output lo output lo output lo output lo output lo enable output low output low output low PIN B6 PIN B5
39. N B6 output low PIN B7 enable hl void line2 void line two and four output low PIN B2 rs low output low PIN B3 output low PIN B4 1100 output low PIN B5 output high PIN B6 output high PIN B7 enable hl output low PIN B4 0000 output low PIN B5 output low PIN B6 output low PIN B7 enable hl void cursor_move_left void 59 void cursor move right void DI ou ou ou ou ou ou tpu tpu tpu tpu tpu tpu low PIN B5 low PIN B6 low PIN B7 enable hl output 1 output output output PIN B4 PIN B5 PIN B6 PIN B7 Ow LOW LOW LOW r r r EE DER enable hl ou ou ou ou ou ou tpu tpu tpu tpu tpu tpu low PIN B5 low PIN B6 low PIN B7 enable hl output output 1 ow PIN B5 output high PIN B6 output low PIN B7 enable hl ECIMAL void decimal void ou ou ou ou ou ou tpu tpu tpu tpu tpu tpu E E t t t t high PIN B2 low PIN B3 low PIN B4 high PIN B5 low PIN B6 low PIN B7 enable hl output high PIN B2 output low PIN B3 output low PIN B4 low PIN B2 RS LOW low PIN B3 R W LOW high PIN B4 0001 0000 low PIN B2 RS LOW low PIN B3 R W LOW
40. R W TO HIGH output low PIN B4 0010 HIGH ORDER NIBBLE output high PIN B5 output low PIN B6 output low PIN B7 65 enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW output high PIN B4 0011 LOW ORDER NIBBLE output high PIN B5 output low PIN B6 output low PIN B7 r enable hl C void big_c void output high PIN B2 RS TO HIGH output low PIN B3 R W TO HIGH output low PIN B4 0100 HIGH ORDER NIBBLE output low PIN B5 output high PIN B6 output low PIN B7 enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW output high PIN B4 0011 LOW ORDER NIBBLE output high PIN B5 output low PIN B6 output low PIN B7 enable hl h void low h void output high PIN B2 RS TO HIGH output low PIN B3 R W TO HIGH gt 0110 HIGH ORDER NIBBLE output low PIN B4 output high PIN B5 output high PIN B6 output low PIN B7 r enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW output low PIN B4 1000 LOW ORDER NIBBLE output low PIN B5 66 output low PIN B6 output high PIN B7 enable hl i void low_i void output high PIN B2 RS TO HIGH output low PIN B3 R W TO HIGH output low PIN B4 0110 HIGH ORDER NIBBLE output high PIN B5 o
41. T transmit pin PIN 25 and the USART receive pin PIN 26 on the PIC16F877 Refer to Appendix A for the request sent to the GPS and a typical response received from the GPS The PIC16F877 then checks PINS 2 5 A0 A3 to get the current heading of the parent from the digital compass Appendix B shows what the digital compass should output given its orientation The PIC16F877 then updates the LCD with the parent device s relative direction to the child devices The parent device is designed to update the direction to each child on the LCD every 20 milliseconds However every 10 seconds the child s distance from parent to child is updated during this maneuver the direction to each child isn t updated until the parent device is finished updating the LCD with the new distance This operation takes less than a second but during this time the direction isn t updated Block 3 Transmitting to child devices and receiving from child devices The longitude and latitude received from the parent GPS and the alarm status are transmitted to the child device using the spread spectrum transceiver The PIC16F877 and transceiver communication can be watched by monitoring the USART transmit pin PIN onthe PIC16F877 Refer to Appendix C for a typical transmission sent to the child device NOTE A transmission may be repeated several times in order to compensate for the frequency hopping of the transceivers so this may happen more than once After tra
42. V c 1 2 3 On 4 O Off Marth u DO O O e Northwest o 1334 Oa North East i West p e East Ps South 4Vest amp g South East Oo O 000 South Refer to the Figure 3 for more information on how the digital compass is wired to the PIC16F778 25 Appendix C The transmission sent to the child device and transmission received from child device Communication from Parent to Child Device s byte 1 byte 2 i bytes 3 10 i byte 11 8 bit Package ID LA tele kere Longitude and Latitude 8 bit Package ID hihihin C h A ad d d d d a 1 2 3 4 r D a Out of Range Child Alarm Control 0 00 Ch L d A 0 01 Ch I L d 2 0 10 Ch L d 3 1 00 Ch L d 4 Example Hexadecimal 7300XXXXXXXXXXXXXXXXXX37 X s depend on location Communication from Child Device s to Parent Device byte 1 i byte 2 i byte 3 5 i byte 6 X X K 8 bit package ID distance and direction 8 bit package ID C C C C Cc h h H h h 2 byte 1 byte I distance direction L d d D d d P 4 B P2 I a n i c Example Hexadecimal 730145622137 26 Appendix D Wiring Diagram for RS232 Co
43. ata pins pin 3 on each side of the compass Connect the 21 LEDs to a 5 Volt source and move the compass in all directions The LEDs will light up when they the data pin goes low and sinks the current If the devices fails to light LEDs or lights up the LEDs in a haphazard manner then the compass made need replacement LCD There are two possible problems that could occur with the LCD The LCD just may not turn on or the LCD may be display unusual or foreign characters to the screen If one of these situations occurs perform one of the following tasks If the LCD quits working there are two possible solutions that should be tried First adjust the potentiometer located on the power circuit board If you still see nothing on the screen try the next step Carefully remove the ribbon cable from the parent PCB board Build a test circuit as seen below in Figure 8 Adjust the potentiometer and if you still see nothing the LCD is probably broken and will need to be replaced If you do see the black squares on the screen on lines 1 and PINZ 10 20k LCD PIN3 POT PIN1 Figure 8 LCD Potentiometer circuit 3 then the LCD is working properly and only the potentiometer will need to be replaced When inserting the LCD back onto the parent PCB be careful and makes sure that PIN 1 on the LCD is connected to PIN 1 on the board The brown wire on the ribbon cable and the leftmost PIN on the board are PIN 1 on both the LCD and
44. ay direction calculates and displays the updated direction ERTER EE TREET Bi V displays the direction about all of the x fo children y KKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK Koko ck kok ck KKK KKK OO K R OO void display direction void long int pdir cdir char pcdir ccdir pcdir parent direction ccdir child 1 direction pdir get dir pcdir cdir get dir ccdir 53 pdir pdir cdir if pdir pdir 360 pdir 360 up arrow else if pdir 45 pdir 315 pdir 405 top right arrow else if pdir 90 pdir 450 pdir 270 right arrow else if pdir 135 pdir 495 pdir 225 bottom right arrow else if pdir 180 pdir 540 pdir 180 down arrow else if pdir 225 pdir 585 pdir 135 bottom left arrow else if pdir 270 pdir 630 pdir 90 left arrow else top left arrow KKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK kok e ke ke f JA gets a numerical representation of the character J direction for the children x 7 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKAI long int get dir char dir long int d switch dir case N d 90 break case Q d 135 break case W d 180 break case Z d 225 break case S d 270 break case M d 315 break case E d 0 b
45. esent false n loop of execution true Check if parent panic button is pressed if input PIN E0 1 parent panic true output high PIN A5 parent panic false output low PIN A5 Check if time to request child location time 0 while transmit time 43 delay ms 200 if time 10 transmit time true if first time Uncomment get compass if you want to use compass compass is useless if the compass info antenna is magnetic relative direction from Bj information get compass function to get update direction updates the current time first_time false transmit_time false Get position from GPS output high PIN C4 output low PIN C5 get position Get panic information ready to transmit to child devices to child alarm id 0x00 Cleared so alarm can be set below for i 1 i 2 i if child il present true Set child ID and alarm information if i 1 if child i oor true bit set to child alarm id 3 if parent panic true bit set to child alarm id 4 if i 2 i 3 i 4 bit set to child alarm id 3 i if child i oor true bit set to child alarm id 4 i if parent panic true bit set to child alarm id 4 Get ready to transmit to_child package_id 0x73 to_child package_id_2 0x37 to_child a
46. h high PIN B5 oh output low PIN B4 zh enable hl output high PIN B2 rsh 10 00000000 output low PIN B3 rw1 S7107 output 1 output 1 output 1 output 1 enable output 1 output 1 output 1l output 1 enable 1111111 SET C output 1 output 1 output 1 output output 1 output enable output output 1 output 1 ow PIN B7 ow PIN B6 ow PIN B5 ow PIN B4 hl ow PIN B7 ow PIN B6 ow PIN B5 ow PIN B4 hl END OF WRIT G RAM ADDR ow PIN_B2 ow PIN_B3 ow PIN_B7 hl s61 a Y ES f41 o1 Y L ESS TO rs t31 24 E231 TING 3ND CHAR 2 4TH CHAR 3 1 00 01011000 Set CG RAM address rwl s 71 high PIN B6 s6h ow PIN B5 f10 high PIN B4 41 0 0 high PIN B7 t31 ow PIN_B6 t21 ow PIN B5 ol 78 output low PIN B4 enable hl z1 LV WRITE DATA TO CG output high PIN B2 output low PIN B3 output low PIN B7 output low PIN B6 output low PIN B5 output high PIN B4 enable hl output high PIN B7 output high PIN B6 output high PIN B5 output low PIN B4 enable hl output high PIN B2 output low PIN B3 output low PIN B7 output low PIN B6 output low PIN B5 output high PI
47. h output high PIN B6 t21 output low PIN B5 ol output low PIN B4 zh enable hl output high PIN B2 rsh output low PIN B3 rwl output low PIN B7 s71 output high PIN B6 a O output low PIN B5 3 1810 output high PIN B4 a enable hl output low PIN B7 t3h output high PIN B6 t21 output low PIN B5 ol output high PIN B4 zl enable hl output high PIN B2 rsh 10 00001110 10 00000100 10 00000100 10 01010101 85 output low PIN B3 rwl output low PIN B7 s71 0 output low PIN B6 s61 0 output low PIN B5 f10 output low PIN B4 f41 enable hl output high PIN B7 t3h output high PIN B6 t21 0 output high PIN B5 o1 0 output low PIN B4 z10 enable hl output high PIN B2 rsh 10 00000100 output low PIN B3 saf OG output low PIN B7 s71 output low PIN B6 s61 output low PIN B5 f1 0 output low PIN B4 oun 0 enable hl output low PIN B7 t31 output high PIN B6 t21 output low PIN B5 ol output low PIN B4 z1007 enable hl output high PIN B2 rsh 10 00000000 output low PIN B3 rwl output low PIN B7 s71 0 output low PIN B6 s61 0 output low PIN B5 f1 0 output low PIN B4 f41 enable hl output low PIN B7 t31 output low PIN B6 t21 output low PIN B5 ol ou
48. he range of the parent s device SYSTEM COMPONENTS This is a brief description of each device in the circuit schematics to follow The purpose of this section is not to explain in detail how each device interacts but more as an introduction to the components in the following schematics and circuit board layouts A more detailed analysis will follow 5 VOLT REGULATOR 3 VOLT REGULATOR These chips are used to convert the 9V DC voltage to appropriate voltage levels for our devices The 5 Volt regulator is a 7805 chip and requires a minimum of 7 2 volts to reliably output 5 volts The 3 Volt regulator is an LM317T chip that reduces the voltage from the batteries to 3 volts This chip requires at least a 5 2 volt input to reliably maintain a 3 volt output The 3 and 5 volt power busses are located on the printed circuit board of the parent and the perforated circuit board of the child PIC16F877 This is a MicroChip programmable IC that controls the inputs and outputs from each device The chip is equipped with multiple 1 0 ports and one serial port used for communicating between the GPS receiver and the transceiver This device uses a 20 MHz crystal to set the clock speed of the device LX2400S 10A TRANSCEIVER The transceiver is used as the communication link between child and parent devices The transceiver used in our devices is the Aerocomm AC1524C 10A LX2400S 10A The transceiver is capable of communicating at speeds up t
49. high PIN B4 0001 Low PIN B4 0100 RS TO HIGH R W TO HIGH gt 0010 HIGH ORD RS TO HIGH R W TO LOW gt 1110 LOW ORDER NIBBLE ER NIBBL Lu 60 output high PIN B5 output high PIN B6 output high PIN B7 enable hl NUMBERS zero void zero void output low PIN B1 E LOW output high PIN B2 RS TO HIGH output low PIN B3 R W TO HIGH output high PIN B4 0011 HIGH ORDER NIBBLE output high PIN B5 output low PIN B6 output low PIN B7 enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW output low PIN B4 0000 LOW ORDER NIBBLE output low PIN B5 output low PIN B6 output low PIN B7 enable hl one void one void output low PIN B1 E LOW output high PIN B2 RS TO HIGH output low PIN B3 R W TO HIGH output high PIN B4 0011 HIGH ORDER NIBBLE output high PIN B5 output low PIN B6 output low PIN B7 r enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW Lu output high PIN B4 gt 0001 LOW ORDER NIBBL output low PIN B5 output low PIN B6 output low PIN B7 enable hl 61 two void two void thre void t four void f output high PIN B2 output low PIN B3 output high PIN B4 output
50. in Digital Compass This block contains a compass which will constantly provide the direction the parent is facing This information is passed directly to the PIC16F877 Child Device The child unit is represented by the block diagram shown in Figure 2 This diagram displays all major components and the flow of data through the child device fam HOT r is AMD 1413 OF Urat ef Range LED Te Teumcuiyez CART panir basten FIC kham ild ge bertar Veitch Low Battery Cimmi Lew BHarrery LED LED Furent Fami v display Figure 2 Child Block Diagram All blocks except the software components have the same description as given for the parent block diagram Calculate Distance and Direction and Update Panic Status This block first gathers the child s current GPS coordinates Next the block calculates distance and direction relative to the parent s location It gathers panic information from the latching panic button and delivers this information to the UART for transmission to the parent Panic LED This block checks the panics or alarms functional block to see if any panics requests have been sent If in fact a panic request has been sent the LED will turn on Out of Range LED This block checks the out of range bit in the data received from the parent If the bit is set value 1 the LED will turn on The LED will only turn off when it is determined that the child is no longer outside t
51. ing rror receiv rror receiv rror receiv rror receiv rror receiv 0 LCD initilization set tris b 0x00 initialize lcd Child these are set Package id for id and panic Distance from child Relative direction Ending package id Message recieved Message sent to For loops in Indicates time to Is it the first time Used for Time recieved so the bus switch sets port B to always output initializes the LCD 42 create arrows creates the arrows for the direction not already on the LCD display on Turn the LCD on and makes it ready to display characters Set childl 4 out of range to false to begin with child 1 oor false child 2 oor false child 3 oor false child 4 oor false Inital location in case parent doesn t get coordinates to child latitude 0 0 to child longitude 0 0 Tes parent output ting purposes direction N low PIN C1 Check external switches to see which children are present if input PIN DO else if input PIN D1 else if input PIN D2 else if input PIN D3 else Mai while child 1 present true child 1 present false child 2 present true child 2 present false child 3 present true child 3 present false child 4 present true child 4 pr
52. larm_id 0x00 output amp to child 44 Get bus switch ready output low PIN C4 output high PIN C5 transce error t from ch before this takes care of frequency hopping of transciever child recieves the is sent until iver_transmit output 11 Recieve from child device ransceiver_receive input 6 ild struct input struct input Recieve child i information if not recieved Request request for i xnput xpires break loop i spackage id 0x73 amp amp from child before tim gt distance gt direction Chec if j gt If c child if bit gt panic and child id 7 1 j 1 j 10 j f error 0 delay ms 10 output low PIN C4 output high PIN C5 transceiver transmit output 11 error transceiver receive input 6 from_child struct input_struct If parent recieved a valid tranmission LTA f error 6 amp amp from child gt package id 2 0x37 if from child gt distance output high PIN C1 child i distance from child child i direction from child j 10 break ks to see if child responded 9 hild i oor true hild responded check panic state of test from child hild i panic true 45 else child i panic false Determine if child is approaching range limits 2500 feet
53. layed on the parent device s display This process is repeated for each child Within the transmissions between the parent and child devices the out of range and panic information is also sent within the transmission This manual is broken down into four main sections The first section is an overall system description It covers the flow of information within and between the parent and child devices The next section is a more detailed look into the child locator It describes the components that make up each device and includes complete schematics and printed circuit board PCB layouts Following this section there is a complete explanation including brief troubleshooting tips concerning the software embedded on the programmable integrated circuit PIC The last section breaks down each aforementioned subsystem in a detailed troubleshooting point of view Within this section are expected outputs from each subsystem device along with tips to what may be causing the child locator to malfunction SYSTEM DESCRIPTION Parent Device The parental device functional block diagram is shown in Figure 1 This block diagram shows the communication links and the flow of information within the parent device Below is a list of each functional block within the figure Each block in the list is described by its communication with other functional blocks Lew Bakery LED hu Sei ih h E i Mia WOT a dr UART i tdi TART T411 DE Pr
54. low PIN B3 character font output low PIN B4 output high PIN B5 output low PIN B6 output low PIN B7 enable hl output low PIN B2 output low PIN B3 output low PIN B4 output low PIN B5 output low PIN B6 output high PIN B7 enable hl output low PIN B2 output low PIN B3 output low PIN B4 output low PIN B5 output low PIN B6 output low PIN B7 enable hl output low PIN B2 output low PIN B3 output low PIN B4 output high PIN B5 output high PIN B6 output high PIN B7 enable hl output low PIN B2 output low PIN B3 output low PIN B4 output low PIN B5 output low PIN B6 output low PIN B7 enable hl Function set Sets interface to 0010 Function set Interface 4 bit for number of lines and 0010 1000 Display ON 0000 1110 Entry Mode Set 0000 58 output low PIN B2 output low PIN B3 output 1l ow PIN B4 0110 output high PIN B5 output high PIN B6 output low PIN B7 enable hl LINES OF DISPLAY void linel void line one and three output low PIN B2 rs low output low PIN B3 output low PIN B4 1000 output low PIN B5 output low PIN B6 output high PIN B7 enable hl output low PIN B2 output low PIN B3 output low PIN B4 0000 output low PIN B5 output low PI
55. mmunication 15V Powered Multichannel RS 232 Drivers Receivers WM Ej amp 1 ir 27 6FCXVW 0ccXVMN Appendix E Complete Child Software device picl6f877 include lt math h gt include lt stdlib h gt include lt 16F877 H gt include trans h include serial h define CHILD NUMBER I define pi 3 14159 fuses HS NOWDT NOPROT Gl CT struct child_struct float theta float latitude float longitude long int distance char direction Jchild struct parent struct float latitude float longitude parent struct output struct char package_id char panic_and_child_id long int distance char direction float theta char package_id_2 Joutput struct input struct char package_id char panic_and_child_id float latitude float longitude char package_id_2 input packet void get cposition void calc distance void void calc direction void void calc theta void 28 float c lat kor main char input data 12 long int error i char data char data2 9 output low PIN BO delay ms 20000 delay ms 20000 delay ms 20000 delay ms 20000 delay ms 20000 delay ms 20000 delay ms 20000 delay ms 20000 delay ms 19000 delay ms 9000 receive input data 12 receive input data 12 output panic and child id 0x00 output distance 0 output direction 0x00 output low PIN B
56. n M SW else if input PIN A0 parent direction W N else if input PIN_A1 parent direction N E else if input PIN A2 parent direction E S else if input PIN_A3 parent direction S W return direction input PIN A3 amp amp input PIN A1 amp amp input PIN A3 Appendix G Header files for Parent and Child Software Serial h duse delay clock 20000000 Huse rs232 baud 9600 xmit PIN C6 rcv PIN C7 initialize USART Function Prototypes void transmit char output 20 int length int receive char input 20 int length void get position int get time Trans h define WR ENA 56 define TST MODE 57 define UP RESET 71 define TE 70 define CTS 58 define DSR 59 define CONFIG START BYTE 0x65 define PREAMBLE 0x55 define SYNC 0x3A char PORTC 0x07 char PORTD 0x08 void parent initialize transceiver void void transceiver transmit char data 20 int length int transceiver receive char data 20 int length Display h Function Prototypes void initialize lcd void void enable hl void void linel void void line2 void void big c void void low h void void low i void void low l void void low d void void low f void void low_t void void low o void void low u void void low n void
57. n the child device After startup the pin should at first be logic level high and after approximately 7 15 seconds the pin should go low If pin 20 never goes low the transceivers may have been switched and the process should be repeated on the transceiver in the parent device If pin 20 of the transceiver in the parent device goes low 20 switch the transceivers and the system should function properly If neither pin 20 of the transceiver in the parent device or the child device goes low then proceed with the following tests First check the amount of current that the parent and child devices are sinking Each device should sink approximately 230mA If either of the devices is sinking less than 230mA of current check continuity between the transceiver and the 5V bus If either of the devices is sinking considerably more than 230mA the transceiver is not functioning correctly and the manufacturer should be contacted If the devices are sinking the correct amount of current the EEPROM on one or both of the transceivers could be corrupted GPS If the LCD starts initialization but returns a blank screen then it is a good indication the parent GPS is not responding It is more difficult to determine if the child GPS quits responding If the child GPS quits responding the parent will timeout and an alarm will sound This will also happen if the transceiver quits working and if the child device is not turned on The best way is to test
58. nsmitting the information the parent device enters a receive mode in which it waits to receive the distance and direction back from the child device The PIC16F877and the transceiver communication can be watched by monitoring the USART receive pin PIN 26 on the PIC16F877 Refer to Appendix C for a typical transmission received from the child device 16 Block 3 can be repeated up to 4 times depending on the number of child devices present Block 4 Checking and storing information received from the child device Occasionally the child device may not respond This either means there is a problem with the child device but more likely the child device has gone beyond the 0 5 mile range of the parent device If this even occurs the parent device will assume the child is out of range If the child device sends a transmission back to the parent device the transmission goes through a series of checks o Checks child device s panic state o Checks child device s distance from parent Refer to Appendix C to see the transmission received from the child and what is checked to know the state of the child Block 5 Updating LCD and alarms The parent device alarm is turned on if any child device is out of range or child device panic button has been pressed The parent device LCD is updated with the child device s new out of range and panic information 17 Child Device The flow chart below describes the software on the child PIC16F877
59. o 115 200 bps but both the parent and child devices are designed to communicate at 9600 baud The range of the transceivers are 3000 ft outdoors and 300 ft indoors The transceivers need a voltage source of 5V 2 This is one of the main purposes of the voltage regulation circuit The transceivers typically sink 115mA each and have a typical output power of 11mW The transceivers operate in the 2 402 2 478 GHz frequency band Transmission sequence to the transceivers must be in the following format 5555553A ength data where length is the 32 bit integer representing the number of bytes of data Information received from the transceivers is in the format length data MOTOROLA ONCORE M12 GPS RECEIVER The GPS receiver receives information from GPS satellites to triangulate its longitude and latitude coordinates The receiver requires at least 2 8 3 2 volts to operate Requests for position and position output from the receiver is sent through a serial connection at 9600 baud in Motorola Binary format Requests must be sent using 3 Volt logic Transmission for the receiver use 3 Volt logic 7404 NOT 7408 AND 7432 OR These three TTL logic chips make up the bus switch The bus switch receives inputs from the PIC to switch serial communication between the GPS receiver and transceiver LCD Parent unit only The LCD is used in our design for an output device to display location information
60. of each child It receives its inputs from port B pins 34 40 of the parent PIC16F877 Pin 33 of port B on the parent PIC is not used for the LCD The LCD is initialized programmed and controlled using a 4 bit data bus instead of the 8 bit data bus that can alternately be used The LCD is initialized after the voltage to the display has risen above 4 5V using software The initialization takes place after the GPS s have been given their time to acquire coordinates This initialization sequence can be seen on the display by the screen turning blank The programming for the LCD is done to store characters into the CG RAM Character Generated Random Access Memory that we needed to display that were not already programmed into the display The controlling of the LCD is just basically putting everything that the parent distance and direction has gathered from the child ren onto the screen for the parent to use to track their child ren DIGITAL COMPASS 1490 Parent only The digital compass tells the direction the parent is facing using a 4 bit output The digital compass is made by Densmore and is capable of detecting 8 different directions 10 The compass can accept input voltages from 5 12 volts The design specified in the following schematics use a 5 volt source The compass uses the magnetic field created by the earth to determine position There is a transistor for each major direction N S E W If the compa
61. oin B P Bhnslber ail J ur Dutch 3 a Children T Branas siver TAE T pani batten FIT alarma chibdielerter wath Law Beary I Welt Comverikr Tinm Leur Betis LED LED Furs Pani mel display Figure 1 Parent Block Diagram Antenna and Transceiver These blocks work together to form the communication link between the parental unit and the child unit Transmission from the parent to the child units is comprised of the parent s longitude and latitude coordinates In response the child unit transmits panic information along with the distance and direction from the parent UART The information received from the child device and GPS receiver travels along a serial link through the UART to form an eight bit bus This data then travels into the first of three software components within the PIC16F877 Panic Button This block represents a button that the parent can push to engage or disengage the alarm mechanism The panic request travels into the software where the panic state is analyzed The panic state is then stored and transmitted along with the next poll children request Number of Children This block is used for the parent to enter the number of children at the start up or to change the number of children during operation of the parental device GPS receiver This block receives a RF radio frequency signal which it analyzes in order to determine it s own location and the current time of day This data
62. output low PIN B3 rwl output 1 output 1 output 1 output 1 ow PIN B7 s71 ow PIN B6 s61 ow PIN B5 f1 ow PIN B4 f41 enable hl output 1 output 1 output high PIN B5 oh output high PIN B4 zh ow PIN B7 t31 ow PIN B6 t2 enable hl 0 f FK r r r r output high PIN B2 rsh 10 00001111 output low PIN B3 rw1 output 1 output 1 output 1 output 1 enable output output output output enable ow PIN_B7 s71 ow PIN B6 s61 ow PIN B5 f1 ow PIN B4 f41 hl PIN B7 PIN B6 PIN B5 PIN B4 high high high high Na NLD hl t3h E JE2NI oh zh r r rs output high PIN B2 rsh 10 00000000 output low PIN B3 rw1 output 1 output 1 output 1 output 1 ow PIN B7 s71l ow PIN B6 s61 ow PIN B5 f1 ow PIN B4 f41 l r 75 enable hl output low PIN B7 t31 output low PIN B6 t21 output low PIN B5 ol output low PIN B4 z1 0 enable hl END OF WRITING 2ND CHAR 1 SET CG RAM ADDRESS TO 3RD CHAR 2 output low PIN B2 rsl 00 01010000 Set CG RAM address output low PIN B3 rwl output low PIN B7 s71 output high PIN B6 s6h output low PIN B5 f1 output high PIN B4 f4h
63. ow PIN B7 output low PIN B6 output low PIN B5 output low PIN B4 enable hl output low PIN B7 output low PIN B5 output low PIN B4 enable hl output high PIN B2 output low output low output low output low output low PIN B3 PIN B7 PIN B6 PIN B5 PIN B4 i enable hl output low output low PIN B7 PIN B6 Pf SESL t21 sT1 s6h 24 8105 E41 03 t3h SJ FEZ J ys rsh 10 00000100 let s71 s61 1 41 0 r i i Hi t3h t21 IFES 10 00000100 s71 s61 ZA ET N OG x 0 r 7 t31 output_high PIN_B6 o1 z1 s d 21 3 rsh 10 00000000 rwl s71 s61 1 41 0 r r i ja ses 83 output low PIN B5 ol output low PIN B4 zl se se enable hl END OF WRITING 5TH CHAR 4 SET CG RAM ADDRESS TO 6TH CHAR 5 output low PIN B2 rsl 00 01101000 Set CG RAM address output low PIN B3 rwl output low PIN B7 s71 output high PIN B6 s6h output high PIN B5 fl output low PIN B4 f41 r enable hl output high PIN B7 t31 output low PIN B6 t
64. reak default d 45 break 54 return d f KKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK kok e ke f displays the distance for the children KKKKKKKK KKK KKK KKK KKK KKK KKK KKK k kc k k KOK ck kck ck KKK KKK kk e ke ke void display distance void long int mult ch distance short int num 0 ch distance child 1 distance if child 1 distance lt 9999 mult ch distance mult mult 1000 if mult gt 1 display num mult ch distance ch distance mult 1000 num 1 else if mult 0 space mult ch distance mult mult 100 if mult gt 1 display num mult ch distance ch distance mult 100 num 1 else if mult 0 if num 0 space else zero mult ch distance mult mult 10 if mult 1 display num mult ch distance ch distance mult 10 num 1 else if mult 0 if num 0 space else zero 55 mult ch distance if mult gt 1 display num mult else if floor mult 0 zero else pound pound OG r pound pound r kkkkkkkkkKkkKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK af function called from display distance to Kf f display the number characters to the LCD KY Kf K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKAI void display num int mult int i
65. smit char data 20 int length ransceiver receive char data 20 int length us Appendix H GPS Pinouts Pin number 1 2 3 4 5 6 7 8 9 o Function TX from GPS 3 volt RX from GPS 3 volt Vin 3V not used Ground 3V backup power not used not used 5V antenna power not used 94 Appendix I Equipment List PART 3 Volt Adjustable Voltage Regulator 5 Volt Adjustable Voltage Regulator Green LED Red LED 12 VDC Piezo Mini Buzzer Push ON Push OFF Switch Aerocomm Transceiver GPS Receiver LCD Digital Compass Switches ON OFF PART NUMBER LM317T 7805 Radioshack 276 271A Radioshack 276 270A Radioshack 273 074A Radioshack 275 1565B AC1524C 10A LX2400S 10A M12 Series Optrex PW16433D CEM 9M Densmore 1490 ALCO MTA206N 95
66. ss is directed in one of the following directions the appropriate output pin sends a corresponding low voltage output The device is connected to port A of the parent device and has pull up resistors to keep voltage levels at 5 volts 1K resistors are used to limit the amount of current into the PIC16F877 and the compass 11 Complete Circuit Schematics SV Regulanor Win 2Gna hour W Regulator Twin Zour 240 PIO16FATT Pin 11 s LX 2400 1604 Tranzceluer Parent Schematic Figure 3 12 SV Regulator iin ZGna LVour J a 7 o Lacching Panic Bumon W Regulator 1NIn Zour 240 PIL16FETT LA 24008 10A Transceiver Figure 4 Child Schematic 13 Circuit Board Layouts Digital LCD 5 Volt Compass Connector Power Bus E TE A Ir 124 D Ground Bus 3 Volt Power Bus 9 GPS x Connector Transceiver Connector PIC16F877 5 Volt Child Selector Power Bus Switch Figure 5 Parent PCB Layout 14 SOFTWARE DESCRIPTION Parent Device The flow chart below describes the software on the parent PIC16F877 Each block will be broken down in the following explanation L Wai 20 seconds for Parent GPS Acquisition i Ba bt St 5 o Ts Hm pure rj dam tutor been pressed i Block 2 Dispi parant In dron tinne Ln I I I I I I Gal param Iecalios Wars me GPS Tum paren alim on Term parent
67. t gt 2000 return 0 if kbhit data getc input i data itt else fit return i else input 0 0x00 input 1 0x0B input 2 0x73 input 3 0x10 input 4 0x00 input 5 0x00 input 6 0x00 input 7 0x00 input 8 0x00 input 9 0x00 input 10 0x00 input 11 0x00 input 12 20x37 49 return 13 while i lt length timeout 0 kbhit kbhit wait max of 20 ms while kbhit 0 amp amp timeout lt 2000 delay us 10 kbhit kbhit if kbhit data getc input i data itt else return i return i KOK KKK KR RK I I I kok k KKK I ck kok RK pe transceiver transmit QUA f4 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKII void transceiver transmit char data 20 int length char output 20 output O PREAMBLE output 1 PREAMBLE output 2 PREAMBLE output 3 SYNC output 4 0x00 output 5 char length BUS SWITCH CODE make sure the transceiver is not in hopping state while input DSR 1 delay us 10 output low TE while input CTS 0 delay ms 1 50 transmit output 6 transmit data length output high TE while input CTS 1 delay us 10 if the transcei
68. that the child device is turned on and the child transceiver is functioning properly Once this is confirmed step throught the following GPS checkpoints Appendix H has a complete list of GPS pinouts Check the power buses for the appropriate busses Refer to the power circuit troubleshooting area if there are unexpected voltage levels Check to see if the appropriate pins are receiving the specified voltage levels If so it is now time to construct the RS232 circuit in Appendix D Make sure the TTL output pin is stepped down from 5 volts to 3 volts before connecting to the GPS RX pin Connect the GPS TX pin to the TTL receive pin on the MAX232CPE chip Open a serial monitoring program on computer Send the following hex statement 40407100340D0A to the GPS and monitor the response in ASCII The response should follow the response in Appendix A Refer to the Motorola webpage for the M12 GPS receiver if the problem persists Compass The digital compass is designed to use a 4 bit bus to determine the direction the parent is facing An indication that the compass has been damaged or is not working correctly is if the parent device arrow is changing but not pointing in the direction of the child The compass can be easily taken out of the circuit and tested Appendix B has the pinouts for the digital compass Connect the ground and the power pins as shown Use resistors to limit the current under 20 mA to the digital compass d
69. the board If the LCD just starts displaying some unusual or foreign characters to the screen the devices just simply need to be restarted If the problem continues make sure that the LCD is plugged tightly onto the parent board and check the PIC16F877 troubleshooting section 22 Bus Switch System The only foreseen problem with the bus switch system is the failure of one of the three logic chips used to form the switch or a broken connection In order to test this system a Maxim232 RS232 chip and the serial port of a computer with appropriate software must be used to probe the circuit First connect the RS232 chip to a serial port of a computer and open any software program that will allow the data to be viewed in hexadecimal values Next place the probe on pin 25 of the PIC16F877 and turn on the system After 90 seconds a request to the GPS receiver should appear followed by a transmission to the transceiver If both requests appear repeatedly then the bus switch is functioning correctly If the requests never appear be sure that the correct pin is being probed If the requests appear only once then the receive pins of both the transceiver and the GPS receiver need to be probed refer to Fig to locate the correct pins If the data is not being received by either or both of the devices then trace the continuity through the bus switch by using Fig If there is no discontinuity then test each chip for power and ground located
70. tput high PIN B2 output low PIN B3 output high PIN B4 output low PIN B5 output high PIN B6 output low PIN B7 enable hl void six void output high PIN B2 output low PIN B3 output high PIN B4 output high PIN B5 output low PIN B6 output low PIN B7 enable hl output high PIN B2 output low PIN B3 RS TO HIGH R W TO LOW gt 0100 RS TO HIGH R W TO HIGH gt 0011 HIGH ORD RS TO HIGH LOW ORDER NIBBL Lu ER NIBBL FJ R W TO LOW gt 0101 LOW ORDER NIBBLE RS TO HIGH R W TO HIGH gt 0011 HIGH ORDER NIBBLE RS TO HIGH R W TO LOW 63 output low PIN B4 output high PIN B5 output high PIN B6 output low PIN B7 r enable hl seven void seven void output high PIN B2 output low PIN B3 r output high PIN B4 output high PIN B5 output low PIN B6 output low PIN B7 enable hl output high PIN B2 output low PIN B3 output high PIN B4 output high PIN B5 output high PIN B6 output low PIN B7 enable hl eight void eight void nine output high PIN B2 output low PIN B3 output high PIN B4 output high PIN B5 output low PIN B6 output low PIN B7 enable hl output high PIN B2 output low PIN B3 output 1 PIN B4 output 1 PIN B5
71. tput low PIN B4 zl enable hl U SET output low output low output low output low output low output low END OF WRI DD RAM ADDR PIN B2 rsl PIN B3 rw PIN B7 s7 PIN B6 s6 PIN B5 f1 PIN B4 f4 ING 6TH CHAR 5 ESS TO BEGINNING 00 00000000 Set DD RAM address 10 10 10 0 10 r 86 enable hl output 1 output 1 output 1 output 1 OW OW OW OW PIN B7 PIN B6 PIN B5 PIN B4 enable hl void display on void output 1 output 1 output 1 output 1 output 1 output 1 enable output output output OW OW OW OW OW OW PIN B2 PIN B3 PIN B7 PIN B6 PIN B5 PIN B4 lt Ne Stt nt x hl t31 SYED 01 s z10 rsl rwl s71 s61 z 10 f41 se se Se N high PIN B7 t3h high PIN B6 t2h high PIN B5 oh output low PIN B4 z1 enable up arrow void up arrow void output high PIN B2 rsh output low PIN B3 rwl output 1 output 1 output 1 output 1 OW OW OW OW hl PIN B7 PIN B6 PIN B5 PIN B4 enable hl output 1 PEE s6 1 4 LO LO LO 0 L ow PIN B7 t31 output high PIN B6 t
72. ut 7 0x0A Line Feed data length receive input 27 transmit output 8 while kbhit 0 delay us 10 data length receive input 23 data length receive input 27 Conversion of the input 0 9 into floating point latitude latitude int input 0 48 10 int input 1 48 temp int input 3 48 10 int input 4 48 temp temp int input 6 48 1 int input 7 48 01 temp temp int input 8 48 001 int input 9 0001 temp temp 60 latitude latitude temp if latitude 0 0 to child latitude latitude Conversion of the input 13 26 into floating point longitude longitude int input 13 48 100 longitude longitude n input 14 48 10 int input 15 48 temp int input 17 48 int input 18 48 temp temp int input 2 10 int input 21 48 100 temp temp ee 1000 EI qu E 8 10000 temp temp 60 longitude longitude temp if longitude 0 0 47 to child longitude longitude data length receive input 23 data length receive input 26 KKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK gets time from GPS sf outputs seconds as integer s kkkkKkKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKAKK int get_time char output 8 char input 22 int data_length 0 int time 0 output 0
73. ut low PIN B7 t31 output high PIN B6 t2h output low PIN B5 ol output high PIN B4 zh enable hl output high PIN B2 rsh 10 00001001 output low PIN B3 rwl output low PIN B7 s7l output low PIN B6 s61 output low PIN B5 f1 0 output low PIN B4 f41 0 enable hl output high PIN B7 t3h output low PIN B6 t21 output low PIN B5 ol output high PIN B4 zh r r enable hl output high PIN B2 rsh 10 01001000 output low PIN B3 rwl output low PIN B7 s71 output high PIN B6 s6h output low PIN B5 f1 0 output low PIN B4 f41 enable hl output high PIN B7 t3h output low PIN B6 t21 output low PIN B5 ol output low PIN B4 z1 enable hl output high PIN B2 rsh 10 00001000 output low PIN B3 rw1 output low PIN B7 s71 output low PIN B6 s61 output low PIN B5 f1 output low PIN B4 f41 ys enable hl output high PIN B7 t3h output low PIN B6 t21 output low PIN B5 ol output low PIN B4 z1 enable hl output high PIN B2 rsh 10 00010000 output low PIN B3 rw1 output low PIN B7 s71 output low PIN B6 s61 ve output low PIN B5 f1 0 output high PIN B4 enable hl output low PIN B7
74. utput high PIN B6 output low PIN B7 enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW output high PIN B4 1001 LOW ORDER NIBBLE output low PIN B5 output low PIN B6 output high PIN B7 enable hl 1 void low l void output high PIN B2 RS TO HIGH output low PIN B3 R W TO HIGH output low PIN B4 0110 HIGH ORDER NIBBLE output high PIN B5 output high PIN B6 output low PIN B7 enable hl output high PIN B2 RS TO HIGH output low PIN B3 R W TO LOW H output low PIN B4 1100 LOW ORDER NIBBLI output low PIN B5 output high PIN B6 output high PIN B7 enable hl d void low d void 67 ou ou ou ou ou ou tpu tpu tpu tpu tpu tpu t t E tx be t high PIN B2 low PIN B3 low PIN B4 high PIN B5 high PIN B6 low PIN B7 r enable hl output high PIN B2 output low PIN B3 output output low PIN B4 low PIN B5 output high PIN B6 output low PIN B7 enable hl void low f void t ou ou ou ou ou ou tpu tpu tpu tpu tpu tpu E t t E t high PIN B2 low PIN B3 low PIN B4 high PIN B5 high PIN B6 low PIN B7 enable hl output high PIN B2 output low PIN B3
75. ver has hopped while transmitting repeat transmission if input DSR 0 clear latch transceiver transmit data length KKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KOR kO OK transceiver receiv 4 KKKKKKKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK I ke e int transceiver receive char data 20 int length long int len i 0 char receive data 20 BUS SWITCH COD Gl receive length 2 bytes gt accounts for lenght high and low bytes from transceiver for i 0 1 lt 8000 i delay ms 1 if i lt 8000 len receive receive data length 2 strip the length high and length low bytes off of transmission Xy for i 0 i lt len 2 i data i receive data i 2 51 return int receive data 1 else return 0 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKAI f displays the information about the rest of the J children Kf kkkkkKkkkKkKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKHK void display roc void 52 K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKII s updates the direction of the children X kkkkkKkKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKHK void update_direction void Int T linel calls line 1 on the LCD for i 0 i lt 15 i cursor move right moves the cursor on the LCD 16 spaces to the right displ
Download Pdf Manuals
Related Search
Related Contents
Hama 00115076 screen protector w Fiche - Charier Sistemas com acionamento alternativo ao teclado e KSC-44 KSC-76 取付 ーー取扱説明書 RHT1851R15 RHT1855R40 OHT1855R RACK-3030 CTI CHASSIS USER`S MANUAL user manual Copyright © All rights reserved.
Failed to retrieve file