Home
University of Hertfordshire
Contents
1. Switch FLASH circuit off to reduce power consumption uw ws s ss FMR0 1 0 FMR0 1 1 FMR1 3 0 FLASH memory power supply on FMR1 3 1 FLASH memory power supply off 0x01 Unlock Protect 0 3 0 Set clock to LOW drive PRCR 0x00 Relock protect void diagnostic void unsigned char pause unsigned char tempvalue 42 2 lt 1 Switch Sub clock OFF and main clock ON l gt 7 0 01 Unlock Protect CMO OXQxD0 Set Xin generation 0x00 Relock Protect for pause 0xFF pause 0 pause Software wait to stabilise sub clock 0 01 Unlock protect CMO 0x50 Set Xin as system clock CMO 0x40 Swatch off the sub clock CMO 0x48 Set high drive capacity PRCR 0x00 Relock protect if low battery OFF 2 0 1 Light LED for pause 0xFF pause 0 pause Software delay to view LED blink P2 0 0 Disable LED 12 4 Use ADC to measure battery status lt 2 ADCONI1 5 1 Vref connected for pause 0xFF pause 0 pause Allo
2. ni qaq ova baee oe ee aee ee e D CLEMENT Y L PANG ENGINEER TITLE FINAL YEAR PHONE Custem Mode Board PROJECT ENGNEER Q 2 Fama Juan PE RX BOARDS 77 Mechanica Layer 4 V GEC gt 2 o Appendix E 1 Rx and Tx PCB layout Clement Y L Pang 81 Microcontroller based directional transducer for child location Appendix 1 Rx and Tx PCB layout Receiver 3V PCB layout 5 0 40 gasses 995 p ag 999999913 T um om I R m 30 T S ATT ATT 3 N 00960 01000404 000 Ut e ur NEN 20 le 90 nn gt ClEMENETYLPANG Y ClEMENETYLPANG PANG 10 E FINAL YEAR Custer Made Board WATER 22 52 FT Em T HERE N Ww gt g gt gt Clement Y L Pang 82 Microcontroller based directional transducer for child location Appendix E 2 Rx and Tx Appendix E 2 Rx and Tx PCB HHP p ko 7 Bug lt 21222223 B LL b 14114111 _____ rae BELLED Clement Y L Pang 83 Microcontroller based directional transduce
3. 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Clement L Pang Microcontroller based directional transducer for child location Appendix D Gantt Chart APRIL 7 81 91104111 12 13 141151161 17 18 19 20 21 22 23 6 211111 1 _ TT RAP TT TT AT 7 Se miss m a Si yf PPT TTT _____ 4 m m mu m El m m m m m m me Clement Y L Pang Microcontroller based directional transducer for child location Appendix 1 Rx and Tx PCB layout Appendix E 1 Rx and Tx PCB layout Transmitter PCB layout ENGINEER TITLE FINAL YEAR iene Custom Made Board PROJECT ENGINEER Q KES FINAL VERSION 01 7 2003 VUE BOARD VERSENS 60 5 0 40 30 E 98 10 20 gt le 20 nm gt E CLEMENT Y L PANG 1 0 N gt gt Clement L Pang 80 Microcontroller based directional transducer for child location Receiver PCB layout e 65 nn 100 mm gt
4. 5 Chapter 3 Hardware Implementation 7 3 0 Chapter Overview eerte sins D eld oeste 7 3 1 Transmutter OVetVIew un NM Nei eee e eater bedste 7 3 1 1 Power supply a 7 3 1 2 Voltage reference oe oem Noe eade PE hee 8 3 1 3 Serial Connector Neo edet Be een 9 3 1 4 Transmitter M16C 62N 9 3 1 5 pud p US Wh du laa 9 3 1 6 Transmitter utut iu ec e reete derart erento d 10 3 1 7 ANCONA s etie f e eo eerte teste tete erectos 10 32 Receiver Overview fete re eme ebbe eh en p Pb 11 32 1 Receiver unt piss eee 11 32 2 Power supply css e ua RORIS REED 12 32 3 pepe Kn 13 3 2 4 Receiver M16C 62A 22 2222 2 13 3 2 5 Mere 13 3 2 6 Serial connector and Anteni u S uma i aa Rn AEE aa au u z 14 3 3 Additional hardware Note8 14 34 Hardware implementation summary eese eene tne 14 Chapter 4 Transmitter and Receiver Printed Circuit Board asas 15 4 0 Chapter Overview
5. Start copy from ROM to RAM char far RAM TX MAIN START i char far ROM TX MAIN START i Copy sleep mode function into RAM for i 0 lt RAM_SLEEP_MODE_SIZE i char far SLEEP MODE START i fa ROM SLEEP MODE START i Copy the interrupt service routine into RAM for i 0 i lt RAM_INTO_ISR_SIZE i Clement Y L Pang 55 Microcontroller based directional transducer for child location Appendix C Software Listing char far RAM_INTO_ISR_START i char far ROM INTO ISR START i j Copy diagnostic function into RAM for i 0 i lt RAM_DIAGNOSTIC_SIZE i DIAGNOSTIC STARTJli cham far ROM DIAGNOSTIC START i Copy HyperTerminal function into RAM for i 0 lt RAM HYPERTERMINAL SIZE H char far HYPERTERMINAL START i gt char far ROM HYPERTERMINAL STARTIi Copy GETC function into RAM for G 0 i lt RAM_PUTC_SIZE i char far RAM_PUTC_START i char far ROM_PUTC_START i Copy PRINTF2 function into RAM for G 0 i lt RAM_PRINTF2_SIZE i char far RAM_PRINTF2_START i cliar far ROM_PRINTF2_START i tx main Call tx function in RAM nn Low level innit called first before main by estartup l f unsigne
6. unsigned char __low_level_init void I Select full speed operation PRCR 0x01 Unlock CMO and CM1 PMO 0x00 Single chip mode CMO 0x40 Disable divider set Fin 8 CMO 0x00 0x00 PRCR 0x00 Relock CMO and Configure UART receive interrupt SORIC 0x00 Set Rx to OIPL 5 0x06 Set IPL to 6 SORIC OxOE Interrupt request enabled return 1 Force cstartup to initialise RAM etc void rx_main void unsigned int pause Declare local variable unsigned char i 0 EEE AE Switch Sub clock ON and main clock OFF 4 PRCR 0x01 Unlock Protect 0 58 Set Xc generation PRCR 0x00 Relock Protect for Pause O0xFF pause 0 pause Software wait to stabilise sub clock PRCR 0x01 Unlock protect CMO 0 8 Set Xc as system clock CMO OxF8 Switch off the main clock 0 0 Set low drive capacity PRGR_ 0x00 Relock protect Switch FLASH circuit off to reduce power consumption FMRO 1 0 Clement Y L Pang 68 Microcontroller b
7. Software wait 0 1 Unlock protect Clement Y L Pang 58 Microcontroller based directional transducer for child location Appendix C Software Listing CM1 0 1 Enter stop mode nop_instruction nop_instruction nop_instruction nop instruction nop instruction 0 0 Relock protect Upon returning from stop mode Flash is automatically switched 1 Set to CPU rewrite mode FMRO 1 0 FMR0 1 1 Set Flash reset bit to turn Flash off 3 0 3 1 0 01 Unlock Protect 0 3 0 Set clock to LOW drive 0x00 Relock protect void diagnostic void I unsigned int pause unsigned char adcvalue low_battery OFF 1 Switch Sub clock OFF and main clock ON w w 0 01 Unlock Protect 0 0 Set Xin generation PRCR 0x00 Relock Protect for pause 0xFF pause 0 pause Software wait to stabilise sub clock 0 01 Unlock protect CMO 0x50 Set Xin as system clock CMO 0x40 Switch off the sub clock CMO 0x48 Set high drive capacity PRCR 0x00 Relock prot
8. S 1 15 Figure 11 Tx in 3Dimensional 16 Figure 12 Rx PCB 65mm by 100mm 16 Figure 13 Rx PCB in 3Dimensional view 16 Figure 14 Rx version 45mm by 90mm amp s f naa 17 Figure 15 M16C software development environment 2 19 Figure 16 Transmitter source code block 3 20 Figure 17 Rx software block diagram 24 Figure 18 Prototype received signal u f a anan anaq aaa eee eene eter entente tne tenni ne 27 Figure 19 PCB Track antenna signal 2 2 2 22 27 Figure 20 PCB with wire antenna signal 1 eerte eene 28 Figure 21 Radiation pattern H 28 Figure 22 Voltage relationship diagram herc ocenienie Qanaq qas eterne nennen eene tete nennen 33 Figure 23 Hyper Terminal Set Upisi Er rire AE a TSE a E EEO NNA EET ETTE E KE aa 33 Figure 24 Transmitted data Arii E ETR REER T 34 Fisure 25 Received datas A RON med ee ARRE 34 Figure 265 KHz buzzer signal J E a eiae E ERESSE ECKE 36
9. Clement Y L Pang 23 Microcontroller based directional transducer for child location Chapter 5 Software Development Figure 17 Rx software block diagram 5 3 5 Timer A0 Interrupt Service Routine TimerA0O the ISR called every 9ms is used to check if the receiver buffer contains any data If the data does not equal to the predefined data OxAA it is ignored and the function ends by returning to the standby function If the data is what is expected it starts timerA I which is set to interrupt every 10 and 24 KHz producing an audible signal of 5 and 12 KHz Once data is received again while the buzzer is active it will disable the buzzer and return to the standby function waiting for the next signal to arrive 5 3 6 5 KHz buzzer signal If the Rx module receives the correct signal ISR timerA1 is set to start counting from 0 and overflows every time it reaches 25 to produce a 5 KHz tone The number 25 is calculated from the following Main clock 2 MHz 8 250 KHz 5KHz 5 KHz 2 10000 The required ratio is 1000077250000 1 10 4 10 25 Hence register TAO 25 The following source code illustrates the above Configure Timer TAI TAIMR 0x40 Set TAI as timer mode with Fx 8 TAI 26 1 ISR to produce 5 KHz tone 5 Set interrupt priority level to 5 5 37 Software LCD Due to time limitations the hardware for the LCD was implemented onto the Rx module but limited software was written for it
10. ONGEF IQ DIODE ssHOrIRY 3VBAIIERY U5 Clement Y L Pang 46 Microcontroller based directional transducer for child location Appendix A 1 Tx and Rx circuit diagram doses Ul far dexouphog purpose Clement Y L Pang 47 Microcontroller based directional transducer for child location Appendix A 2 Tx and Rx Development Board Appendix A 2 Tx and Rx Development Board Clement Y L Pang 48 Microcontroller based directional transducer for child location Appendix B Component Listing and Cost Appendix B Component Listing and Cost Part Type Price Quantity 22pF 0 012 4 10pF 0 012 4 10uF 0 0095 2 100nF 0 039 2 2 2UF 0 05 1 10nF 0 013 1 330 0 008 2 10K 0 008 18 1K 0 008 1 1 6K 0 008 1 2K7 0 008 3 8K2 0 008 1 470K 0 008 9 Tx Rx Pair 9 99 1 M16C 62A 7 1 M16C 62N 7 1 5 VOLTREG 0 66 1 5V RESET IC 0 38 1 9V PP3 Battery 2 1 1 10 PIN CONNECTOR 0 28 1 74HC BUFFER 0 25 2 BUZZER 0 45 1 JUMPER 0 07 2 3V BATTERY 0 75 1 3V RESET IC 0 58 1 INTO Switch 0 32 1 Vref 0 3 1 LCD 5 1 ON OFF 0 58 2 NPN Transistor 0 08 2 PNP Transistor 0 08 2 3V RESET IC 0 64 1 2 2 Crystal 0 25 2 32768KHz 1 05 2 LED 0 1 2 Schotty Diode 0 3 2 Total 41 506 81 Clement Y L Pang 49 Microcontroller based directional transducer for child location Appendix B Component Listing and Cost Clement Y L Pang 50 Microcontroller based directional transducer for chil
11. or output O P respectively with all the ports configured the interrupts UART and ADC registers are then set to the required configurations 5 23 Diagnostic Function The function diagnostic is then called before the sleep mode function that is located in a forever loop In order to achieve an ADC threshold to produce the low battery indication required the value of 2 5V was chosen This threshold voltage was chosen since the minimum voltage required for the MCU to operate is 2 0V more details regarding this value can be found in Chapter 6 9 If the operating voltage of the supply falls below 2 5V the transmit module would still have adequate time before the module switches off hence with a threshold voltage of 2 5V we can convert the analogue threshold into a digital hex value for the MCU to detect The following calculations show how the values are calculated using 8bit 2 resolution ADC When 2 5V Viet Ay V divider 1 9V V diode drop 0 22 Each digital value 22 2 Recommended digital threshold in decimal 2 2 1 9 0 22 10 10 3 0 08 10 107 8 Therefore the digital threshold is 255 8 247 0xF7 Use ADC to measure battery status ADCONI1 5 1 Vref connected for pause OxF pause 0 pau
12. Set as inputs except 2 0 P2 1 P3 0 00 All segments off PD3 0x00 Set as inputs P4 0 00 All segments off 0x00 Set as inputs 0 00 Set port low PD6 0x88 Set as input except P6 3 P7 0 00 All segments off PD7 z 0x00 Set as inputs P8 2 1 Set port8 2 high P8 3 1 Set port8 3 low 8 5 1 Set port 8 5 High NMI P8 6 0 When XCin is set port P8 bit 6 and 7 have to P8 7 0 be set low PD8 20xC3 Port 8 all outputs except b2 3 4 amp 5 0x04 Port9 write enabled PD9 0 00 Set as inputs P9 0 00 All segments off P10 20x00 segments off PD10 0x00 Set as inputs PURO OxFF Pull up resistors for Port0 1 4 7 2 and 3 PURI OxFF Pull up other port4 5 6 amp 7 PUR2 0 3 Without Pull up for P8 0 P8 7 P9 10 pull up ADCONI 5 0 Set Vref no connect iw K mr sa Setup hardware and software interrupts Timers es disable_interrupt set interr pt table 0x0640 Set interrupt table address 0x070A Configure external INTO user button INTOIC 0x00 Disable INTO interrupt Priority level 0 INTOIC 0x05 Set polarity select bit at falling edge INTOIC 0x06 Enable interrupt Clement Y L Pang 57 Microcontroller based directional transducer for child location Appendix C Software Listing Configure UARTO UOMR 0x05 0000 0101 8N1 format UOCO 0x11 No hand
13. 5 1 1 C compiler 24 2 KD30 Debugger 5 1 3 FLASH starter 5 2 Transmitter Source code 5 2 1 Main function 52 2 Tx main function 5 2 3 Diagnostic function 5 2 4 Sleep mode 5 2 5 INTO Interrupt 5 3 Receiver Source code 5 3 1 Main function 9 352 Rx_main function 5 3 3 Diagnostic function 5 3 4 Standby function Ss Timer AO Interrupt Service routine 5 3 6 5 amp 12 KHz buzzer signal 5 3 7 Software LCD 5 3 8 Software summary 50 Chapter Overview The objectives of this chapter are to explain and d scribe the software code written for the transmitter and receiver MCU It will provide a guide for all the features implemented such as the low power features ADC battery monitorpsignal transmission and reception In order to appreciate the software developed an overview of the development environment will also be discussed Full code listing can be found in Appendix C 5 1 Development Environment It has been known that as the structure of a program code increases in the conventional assembly language the more difficult 1615 for programmers to comprehend This is why increasing amounts of embedded applications are now written in the C language To help develop the software for this project a full range of development tools including compilers and debuggers were used Figure 15 illustrates the development environment utilised to compile debug and test the code 511 C compiler The language efficient compil r used within the W
14. 54 Software summary With the workbench development environment source code written could be flashed into the evaluation board tested and debugged This produced optimum time management as it reduced the overall development time necessary for developing and testing the code Various software techniques were implemented in order to achieve the objective of a reliable RF link The software written controls the MCU to operate all the code functions in RAM reducing the overall current consumption utilising the onboard UART and ADC with interrupt operated functions ISR Consequently the individual modules provided the required RF link battery monitor l w power operation and audible tone These software solutions were preferred as it limits any additional hardware components necessary hence reducing the overall system cost Clement Y L Pang 24 Microcontroller based directional transducer for child location Chapter 5 Software Development Clement Y L Pang 25 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase Chapter 6 Testing and Specification comparison phase Chapter contents 6 0 Chapter Overview 6 1 Hardware modification 6 1 1 Tx module RESET IC 6 1 2 Rx Buffer 6 1 3 Tx and Rx antenna 6 2 Specification comparison 6 3 System current consumption and battery life 6 3 1 Transmitter 6 3 2 Receiver 6 4 Battery monitoring with ADC in diagnostic feature
15. Figure 27 Hyper Terminal message setup 2 netenen nente nter esten nene nennen en 41 Clement Y L Pang Microcontroller based directional transducer for child location Chapter Overview Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Introduction Chapter 1 defines the sole purpose of this project in correspondence to the aims and objectives Information regarding the product specification of the system can be found within this section Investigation and Research The essence of this chapter is to illustrate the background knowledge needed to understand and tackle the project s aim It will also provide information regarding the current technologies used in relation to object child location The results from this section will conclude to the technology chosen for the child locator Hardware Implementation This chapter illustrates all the different devices used for both the transmitter Tx and receiver Rx circuit It describes and explains why certain devices were used and its relevance to the final design concept Transmitter and Receiver Printed Circuit Board PCB With the prototype complete the next stage was to import the schematics of the modules onto PCB This chapter highlights the stages taken in order to produce the required PCB whicli was to be later encapsulated if time permitted to create the final prod
16. Ohours 2 48mA 0 Where Estandby Where Esend 5sec 5events 8mA 5sec 5events 8mA Ihour 3600sec 0 2 1 3600 0 056mAh Where Eoft 24day 5hour OmAh Clement Y L Pang 30 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase Therefore 0 0 056 0 0 056mAh Hence the total battery Life is 280mAh 0 056mAh day 5000 Days 364 Days 13 7 Years 14Years 6 3 2 Receiver module Table 3 below indicates the results obtained with the following conditions for the receiver module MCU 5V Measurement Conditions Current Consumption mA Standby mode 5 8 Standby with buzzer 8 7 Table 4 Receiver module current consumption The following calculations below illustrate the theoretical battery life for the complete receiver unit taking the values from table 3 assuming again that the unit is on 5 hours a day with a total alarm duration of 30mins Capacity of 9V PP3 battery 600mAh Receiver board when in standby draws 5 8mA from table 3 Total average battery life using is Equation 3 Estandby Fatarm Eott Where Estandby Shours 5 8mA 29mAh Where Eatarm 30min 7mA 30min 8 7mA 1min 60min 261 1 60 4 35mAh Where 24day 5hour OmAh Therefore Eq 29 4 35 0 33 35mAh 33 4mAh Hence the total battery Life is 600mAh 33 4mAh day 18
17. achieved by applying a rectangular fill over the existing aerial track during the autoroute progress used by Protel to link all the different nets together Once complete the fill was removed to produce the results as shown It should also be noted that the ground plane and aerial track links should be minimal as the links would still act as the radiating ground and aerial therefore the links forthe ground plane and aerial was linked together manually Measurements for majority of the component s footprints were recorded and drawn in Protel as the standard libraries provided did not contain them Once the PCBs were complete with no errors on the design rules check in Protel they were printed out and physically checked with the external components to make sure each component matched When all the components were checked the PCB file was sent to a third party to be manufactured www pcb pool com 43 PCBisummary The process of converting the complete transmitter and receiver circuit schematic to the printed circuit board inyProtel is reasonably straight forward In practice though a lot of time was cons med in ensuring that all the components and layout was correct to the specification and external devices Clement Y L Pang 17 Microcontroller based directional transducer for child location Chapter 5 Software Development Chapter 5 Software Development Chapter contents 5 0 Chapter Overview 5 1 Development Environment
18. d Set I O line high to turn on Transmitter and Buffer uw sss P0 0 1 Set output high to turn on Tx 1 0 Set output low to turn buffer on for pause 0 pause lt OxFF pause Set delay for Tx turn on time uuu w a Send data uw w rn aaa if SW1 0 for i 0 1 lt 3 1 while U0C 1 1 0 wait if transmit buffer is full UOTBL Send preamble data three times while SW1 0 P2 0x01 Light LED for pause 0 pause lt OxFFF pause P2 0x00 for pause 0 pause lt OxFFF pause if low battery ON P2 0x01 else P2 0x00 d Switch Sub clock ON and main clock OFF d 0 01 Unlock Protect CMO 0x58 Set Xc generation 0x00 Relock Protect for pause 0xFF pause 0 pause I Software wait to stabilise sub clock 0 01 Unlock protect CMO 0xD8 Set Xc as system clock OxF8 Switch off the main clock OxF0 Set low drive capacity 0x00 Relock protect d Set I O line low to turn off Transmitter P0 0 0 Set output low to turn off Tx 1 1 Set output high to turn off Buffer Check battery condition ae diagnostic Clement Y L Pang 62 Microcontroller based
19. directional transducer for child location MF TEN NINE CABLE Appendix H 37892 19 NI S19 100 518 CONT 850 9S tC1n0 H10 100 0 1 1 0 8 93 TI3HS 6848050 A 19 92 19 GNO 139891 axl 129491 139861 ODA 139891 5 2 1 323IH SSANO 413538 OND Clement L Pang 88
20. directional transducer for child location Appendix C Software Listing Common header file General Definitions define SW P8 2 define SW2 P8 3 define CRYSTAL FREQUENCY 2000000 define UARTO_BAUD_RATE 1200 define UART1_BAUD_RATE 1200 define ON 1 define OFF 0 define ESC 27 define LF 10 define CR 13 Definition for RAM copying define RAM_TX_MAIN_SIZE 0x001DE define RAM TX MAIN START 0x01000 define ROM TX MAIN START OxFAC22 define RAM SLEEP MODE SIZE 0x000FF define RAM SLEEP MODE START 0 00900 define ROM SLEEP MODE START 500 ftdefine RAM INTO ISR SIZE 0x000FF define RAM INTO ISR START 0 00 00 define ROM INTO ISR START OxFA600 define RAM DIAGNOSTIC SIZE 0x000FF define RAM DIAGNOSTIC START 0 00 00 define ROM DIAGNOSTIC START OXFA700 define RAM HYPERTERMINAL SIZE 0x000FF define RAM HYPERTERMINAL START 0 00 00 define HYPERTERMINAL START OxFA800 define RAM PUTC SIZE 0x00020 define RAM PUTC START 0x00E00 define ROM PUTC START define RAM PRINTE2 SIZE 0x000FF define RAM PRINIF2 START 0 00 22 define ROM PRINTF2 START OxFAB22 Declare interrupts interrupt 29 4 void 110 isr void interrupt 21 4 void timer a0 void Declare functions void battery status void void diagnostic void void hyper terminal void ch r getc void void putc char c void sleep mode void void tx main void void pri
21. fusus sana huu na eerie 15 4 1 Printed Circuit Boa e EE eh geb ER DLE pay A dde ES 15 4 2 PCB impediment ga KM vanskene see ee 17 4 3 PCB summary Ags ss annan kunn 17 Chapter 5 Software a u pasasun uay 18 indi eet Daun eee aaa DEG Lr a eas 18 54 DevelopmegfEEnvirpnment u tenen nen enne teens 18 5 1 1 G conMfler l p eee eere o Re ens 18 542 KON DODUBSEL x owe ie RE E i Ane PE eis ADU 18 5 13 Starter MEER 18 5 2 TWAnimutter So rce Code RISE RD UO e eor E opi enit beans 19 52 1 ER 20 5 22 Ras man EUnctlOn z sere GI 21 52 3 4 Ss as eee ee 21 52 4 Mode 22 5 2 5 INTO Int rtupt 22 Refeiver beatae fect ite 22 5 3 1 Function sur vee gari de e e ederet Hl 22 5 3 2 Rx main function nanan 22 5 3 3 Di gti stic function see diete en ate ed a a le i e Reden te 22 5 3 4 Standby Cn AAAS SO Se a ea ASS aia nad 23 5 3 5 Timer AO Interrupt Service ROUTINE a u S ua aG ua maan enk
22. 1 P2 0x80 hf UORBH 6 1 P2 0x40 hf UORBH 5 1 P2 0x20 UORBH 4 1 P2 0x10 P0 0 0 Set port low to turn Rx off fori 0 1 lt OxF 1 Set delay for Rx turn on time n 2 Switch Sub clock ON and main clock OFF 1 0 01 Unlock Protect CMO 0x58 Set generation 0x00 Relock Protect for pause 0xFF pause 0 pause Software wait to stabilise sub clock 0 01 Unlock protect 0xD8 Set Xc as system clock CMO OxF8 Switch off the main clock OxF0 Set low drive capacity 0x00 Relock protect diagnostic Call diagnostic function hf buzzer ON P7 0 0 Toggle buzzer pin if signal detected interrupt 22 4 void timer_al void delay P7 A 0x0C Clement Y L Pang 73 Microcontroller based directional transducer for child location Appendix C Software Listing Common Files General Definitions define SW P8 2 define ON 1 define OFF 0 define CRYSTAL_FREQUENCY 2000000 define UARTO_BAUD_RATE 1200 define FREQUENCY 2000000 interrupt 21 4 void timer a0 void interrupt 22 4 void timer al void interrupt 23 4 void timer a2 void interrupt 24 4 void timer a3 void interrupt 18 4 void uartO rx void void d
23. 24 5 3 6 S KHz 24 Clement Y L Pang iii Microcontroller based directional transducer for child location 5 3 7 Software LCD dato nm uet ee el a a as 24 5 4 Software summar yit sae ee ee ee 24 Chapter 6 Testing and Specification comparison 26 6 0 ChapterrOVerVI Wss u L ua on eie o ct eed 26 6 1 Hardware 26 6 1 1 Tx module RESET IC m Ari eet eerte 26 6 1 2 Rx b ffet i ede pet 26 6 1 3 Tx and Rx Antenna oim ned PAR e ce eee 26 6 2 Specification f ly 29 63 System current 29 6 3 1 Transmitter module etes 30 6 3 2 Receiver module s deep eh bel NIB oe ees 31 6 4 Battery monitoring with ADC in Diagnostic feature a aa 32 65 Transmitter and Receiver data 2 Nee 33 66 RFRangeandtreliability P WWf 35 SR T2KHZ8SIS al u a Sa gt coe eee 36 6 8 Package 4 36 69 Weight E 37 610 Power Suppl yes s aasan Nb NI e
24. 31 Table 5 Current consumption comparisons n tetett e Bde 31 Table 6 RF range and reliability results 35 Table Buzzer S effectiveness ceo eee tette dite reete Seles 36 Table 8 Dimensions comparison QlNN 36 Table 9 Weight comparison eene 37 Table 10 Power supply comparison 37 Figure 1 Transmitter Module block diagram esee nennen 7 Fisure 2 Tx power Supply 15 2 et ee eet ett Noe 8 Figure 3 10 pin serial connector nob dan cade epe 9 Figure 4 Mitsubishi s M16C 3 Diamonds Boatd a tenerent nennen 9 Figure 5 Transmitter module ines She NN oe SEa EE eSEE EEE SERE Ss 10 Figure 6 Receiver Module block diagram 5 ederent nter eene nennen 11 Eigure 7 Receiver RX Units a s ge M 12 Receiver power Supply o oie nette tefte eee heces 12 Figure 9 14 segment 8 digit LCD a saus W Q l a 13 Figure 10 Tx 40mm by 70mm
25. 62N described in section 3 1 4 the M16C 62A consists of the same rich features in the same 100pin package The reason for using this device is purely due to its similar operating voltage as that of the receiver i e 5V If the receiver unit was the original recommended version AM HRR8 433 then the M16C 62N would have been utilised The advantage of using the M16C 62A in this design is because it is also pin compatible with the MI6C 62N hence both the devices AM HRR8 433 and M16C 62N can be designed into this application with minimal modifications 3245 Buzzer The buzzer chosen to produce the audible signal for the user to trace is a simple 5V operated piezo transducer that is activated by producing a single train of pulses i e square waves across the corresponding pins Clement Y L Pang 13 Microcontroller based directional transducer for child location Chapter 3 Hardware Implementation 3 2 6 Serial connector and Antenna The serial connector and antenna used in the receiver circuit is a replica of the one described on the transmitter in sections 3 1 3 and 3 1 7 respectively 33 Additional hardware Notes Note that not all of the components shown within this chapter described in detail as they may have been taken from recommended application circuits provided by the original manufacturers Appendix B shows a complete table listing all the components used with the overall cost while Appendix A 2 shows a picture of th
26. Days Modules Initial specification Actual results Transmitter lt 5mA power supply 2 48mA Tx module Receiver Rx lt 5mA power supply 5 8mA module Table 5 Current consumption comparisons The results from table 4 shows that the Tx module proves to be extremely successful with the actual results for the standby current nearly half that of what was required On the other hand the Rx module results for standby is just over the original specification This is mainly due to Clement Y L Pang 31 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase the additional components on the Rx module and that the MCU s main clock was set to operate at a higher bandwidth 2MHz 8 throughout the duration of its operation If the 3V Rx and MCU were used as originally planned than the theoretical battery life for the Rx module would increase as illustrated from the following calculations Capacity of 3V coin cell battery 280mAh Receiver board when in standby draws 5 8mA 2mA 3 8mA Minus 2mA as the Rx unit draws 0 5mA compared to 2 5mA from the SV device Total average battery life using is Equation 3 Etotal Estandby Eott Where Estandby 5hours 3 8mA 19mAh Where 30min 6 7mA 30min 6 7mA 1min 60min 201 1 60 3 35mAh Where Eog 24day 5hour OmAh Therefore Eta 19 3 35 0 22 35mAh 22 4mAh Hence
27. G Z HUGECONST HUGE_CONST _FAR_ROM_ADDRESS FET 277 Select C library AEA clml6cy Select for ieee 695 format required for KD30 PD30 amp PD30SIM 5 1 ylmba 1 End of file LNKMI6CY XCL Clement Y L Pang 54 Microcontroller based directional transducer for child location Appendix C Software Listing Transmitter Source Code define Chip_3062x For iom16c62 h M16C 62N include common FLASHOFF h include iom16c62 h include lt intrm16c h gt interrupt 29 4 void intO_isr void hnterrupt 21 4 void timer aQ void void sleep mode void void tx main void void diagnostic void void hyper terminal void void printf2 char str char low battery unsigned char invec_tab 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Interrupt address for KD30 to allow BP and Debugging 0 0 0 0 0 0 0 0 0 0 0 0 0x6B 0x CB OxOF 0x00 0x6B 0xCB 0x0F 0x00 0x22 0x0D 0x00 0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 RAM INTO address 0 0000200 0 0 0 0 0x00 0x0A 0x00 0x00 0 0 0 0 0x0F 0x20 0x00 0x00 void main void unsigned int 1 Copy the transmit function program into RAM for i 0 i lt RAMATXSMAIN SIZE
28. MCU P Buffer Serial Connector Figure 1 Transmitter Module block diagram 311 Power supply The MCU and transmitter data sheet shows that the operating voltages for the devices are around 2 4V 3 6V and 2V 14V respectively The chosen power supply for this module was therefore a standard off the shelf lithium coin cell because the battery had the appropriate voltage level adequate current capacity 280mAh mili amps hours and a small surface area and weight of 24mm diameter and 4g respectively Clement Y L Pang 7 Microcontroller based directional transducer for child location Chapter 3 Hardware Implementation Having a 3V battery supply would also eliminate the need of a 3V 3 3V regulator hence reducing the overall cost and power consumption For safety precautions a standard schottky diode was used in series with the supply voltage Vcc to protect the on board devices in case the battery was positioned incorrectly As with all portable units SW1 provides a simple means to switch the module on or off as shown on figure 2 below gun ONOFF IQ DIODE 11 vec 115 TERY Figure 2 Tx power supply 3 1 2 Voltage reference An important feature listed in the productyspecification please refer to table 1 was a low battery indicator In order to achieve this the Analogue to Digital Converters ADCs on the MCU was used without a regulator for the unit there would be no constant ref
29. Serial I O UARTO UART1 UART2 UART or clock synchronous x 3 Clock generating circuit 2 built in clock generation circuits built in feedback resistor and external ceramic or quartz oscillator Supply voltage 4 2V to 5 5V f XIN 16MHz without software wait Mask ROM flash memory 5V version 2 7V to 5 5V 1 2 with software one wait Mask ROM flash memory 5V version Power consumption 25 5mW f XIN 10MHz Vcc 3V with software one wait 70 characteristics Clement Y L Pang 86 Microcontroller based directional transducer for child location Appendix G dBm to watts conversion chart Appendix G dBm to watts conversion chart dBm Po dBm mV Po Be 1 0 mw 0 80 80 MW 0 71 401 Tun 64 mW 0 64 160 50 MW 0 57 141 40 MW 0 50 125 32 mw 0 45 4118 25 MW 0 40 109 20 mW 0 351 16 mw 0 32 125 mw 0 286 on mw 0 251 0 225 001 UW 0 200 0 180 525 0 160 e e 20 e ois ES oe 8 4 alala o e N gt 50 un 4 o sj Ti 80 225 01 nW 25 co T 200 3 160 L3 zm f r mo 89 80 575 50 10 97 32 co 62 o ol of oo Clement L Pang 87 Microcontroller based Appendix H MF TEN NINE CABLE
30. TAIMR 0x40 Set TAO as timer mode with OxCO for Fc32 7 1 Set reset prescaler TAL 32 1 ISR to produce 4KHz buzz 5 Set interrupt priority level to 5 7 low_battery OFF buzzer OFF alarm 0 Initialise variable delay 0 enable_interrupt Enable all interrupts diagnostic 0 1 Set port high to turn Rx ON for i 0 i lt OxFF i Set delay for Rx turn on time TABSR O 1 Start Timer AO interrupt TABSR 1 1 Start Timer Al interrupt for standby_mode Call wait function q Function to set MCUto wait mode for low power feature E Switch FLASH circuit ON FMRO 1 1 FMR0 1 0 FMR1 3 1 1 FLASH memory power supply off FMRI 3 0 1 FLASH memory power supply on wait for interrupt Enter wait mode Clement Y L Pang 70 Microcontroller based directional transducer for child location Appendix C Software Listing nop instruction nop instruction nop instruction nop instruction nop instruction
31. Voltage Surface Mount Devices Transistor Transistor Logic Transmitter Universal Asynchronous Receiver Transmitter Voltage reference Equation 1 Voltage divider rule Vout Equation 2 wavelength antenna Equation 3 Battery life Ftotal Clement Y L Pang AM ADC Clk CMOS DC DMM FM FSV GPS GND I P LSB IC LCD LED ISR ISI MCU MSB O P PCB RF RAM ROM Rx Vcc SMD TTL Tx UART Vref Vin R R i R 4 Estandby Essa vil Microcontroller based directional transducer for child location Chapter 1 Introduction Chapter 1 Introduction Chapter contents 1 0 Chapter Overview 1 1 Project aims and objectives 1 2 Design limitations 1 3 Product Specification 1 4 Summary 1 0 Chapter Overview Chapter 1 defines the sole purpose of this project in correspondence to the aims and objective Information regarding the product specification of the system can be found within this section 1 1 Project aims and objectives The aim of this project is to design and develop a cost effective and low power radio frequency RF based child locator from initial design to manufactured product The objective is to utilise a pair of RF modules so that the end user adult parent has a transmitter module that can send a signal to the receiver carried by the child to activate an audible signal The user can therefore locate the origin of the sound hence the location of the child To produce an efficient
32. Y L Pang Microcontroller based directional transducer for child location Chapter 2 Investigation and Research Chapter 2 Investigation and Research Chapter contents 2 0 Chapter Overview 2 1 Market potential 2 2 Investigation in location devices 2 2 1 GPS 2 2 2 Indoor location system 2 2 3 Radar and Sonar 2 3 Required RF distance 2 4 Investigation and research summary 2 0 Chapter Overview The purpose of this chapter is to illustrate the background knowledge needed to understand and tackle the project s aim It will also provide information regarding the current technologies used in relation to object child location The results from this section will conclude to the technology chosen for the child locator 21 Market potential The importance of a child s location has become a major concern for many parents over the past few years with reports showing that between 700 800 children go missing every month in the US alone In order to protect children and help parents or guardians know their whereabouts many manufacturers are developing wristwatches and pager sized units that can be used to track lost individuals to within a few feet Reports also claim that one company intends to unveil working prototype of an encapsulated Global Positioning System GPS device that could be surgically implanted inside a person s arm It is also estimated that by 2006 the potential market for child detectors will be around 200 billion USD fr
33. modules The results captured for the on board PCB track antenna showed extremely poor results hence an additional antenna was required To keep the overall cost of the system to a minimum a simple wire was used at the quarter wavelength this proved more successful with a transmission power ten times that of the PCB track If more time was available research and testing would have been performed on various off the shelf antennas from different Clement Y L Pang 40 Microcontroller based directional transducer for child location Chapter 7 Conclusion manufacturers in relation to the transmission power and reliability if implemented in this system From the results it shows that the RF based wireless child locator is cost effective and reliable within the specifications It is also future proof as the MCU implemented can be upgraded with new code by simply writing to it via the on board 10pin connector Nearly every aspect of the product specification was met to a very high standard with only the receiver current consumption greater than expected However as stressed throughout his report if the receiver was utilised in this system then the preferred overall size and current consumption can be obtained 7 1 Future Development This section discusses recommendations for further improvements that could be implemented to the existing system 7 1 1 Software LCD The hardware for the software LCD was implemented into thesfinal PCB desi
34. the PNP transmitter switches enabling a direct connection between the emitter E and collector C hence linking Vcc and pin 14 of the buffer supply voltage pin together This switching method is used so that the operation buffer is solely dependent on the code port pin therefore providing a means of controlling the buffer s on and off time resulting in better power efficiency It can be seen that this technique is also used with the transmitter module U2 Figure 5 Transmitter module 3 1 6 Transmitter unit The transmitter unit AM RT4 433 is a standard off the shelf module from RF Solutions illustrated in figure 5 as U2 The Tx unit features a wide operating voltage 2 14V low current consumption of typically 4mA with CMOS complimentary metal oxide semiconductor TTL transistor transistor logic inputs therefore this hybrid AM transmitter unit provides a complete RF transmitter that can be utilised to transmit data at up to 4KHz directly from the MCU Its standard 4 pin package provides a very simple integration to the Tx module and helps minimise the overall size and weight 3 1 7 Antenna Clement Y L Pang 10 Microcontroller based directional transducer for child location Chapter 3 Hardware Implementation There seems to be little information on compact antenna design for the low power wireless field Good antenna design is required to realize good range performance A good antenna requires it to be the right
35. the correct data out it was connected to the PC via the MF TEN NINE cable and each time theybuttom was pressed it would display a certain character onto Hyper Terminal nig es oa Connect To Settings 2 Hyper CLocator County code United Kingdom 4 Change Icon COM1 Properties EP Part Settings Enter the area code without the lont Arga code 01707 Bit nd Phone number Connect using Direct to Com1 Data bits 8 zi Configure None Stop bits 1 Flow control None Advanced Connected 00 03 01 100 00884 SCROLL CAPS NUM Capture Print echo Figure 23 Hyper Terminal Set up Clement Y L Pang The same procedure was repeated for the receiver module but instead it would detect a specific character from Hyper Terminal and each time it received the correct data it would light a LED This procedure proved that the on board UART was transmitting and receiving the correct format of data The setting used to achieve communication between the modules and the PC is shown in figure 23 33 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase The next testing stage was to transmit and receive the data via the RF link Figure 24 indicates the waveform obtained from the digital oscilloscope when transmitting the Hex value
36. to FLASH write new code into the MCU memory if updated software is available as well as allowing connectivity to the PC s RS232 port COM port using the MF TEN NINE cable shown Figure 3 10 pin serial connector Appendix H 3 1 4 Transmitter M16C 62N MCU The MCU used for the Tx module is the M16C 62N Mitsubishi s compact cost effective low power 16bit MCU that provides high speed processing with RISC like performance Targeted for many modern applications it features low operating voltage 3 3V typical noise immunity rich on chip peripherals and programming efficiency Additional hardware functions such as its 8 10bit ADC three UART Universal Asynchronous Receiver Transmitter channels and eight programmable Timers are also available hence ideal for the project To minimise the amount of time required fo implement the MCU onto the Tx module Mitsubishi s M16C 62N s 3 Diamond board was used This is an evaluation board produced by Mitsubishi semiconductors which consists of the following e M30624FGNFP M16C 62N On chip 265kB Flash memory 20kB RAM operating at 5V Two external clocks o Main clock speed at 2MHz replacing standard crystal of 16MHz o Sub clock speed at 32768SHz 8 independent LEDs 4 Switches connected to INTO INT2 and RESET port of M16C Header connectors to allow connection to all port pins of the MCU 9 Pin D type serial socket for PC connection via UART transceiv
37. warn the users that the unit needs a battery replacement important feature are As the unit will be used in and outdoors it needs to withstand many of the outdoor weather conditions Maximum budget PHASE 2 As many parents have more than a single child or those with many children to look after it is necessary to have multiple receivers to locate each child This software based feature will be programmed into the MCU so that the units can self diagnose themselves by running a routine which test the functions of each module and its RF link Specification 5 and lt 5V power supply lt 5 lt 5V power supply Min 15M and Max 25M 20 100 8 16 bit core Flash memory Low power lt 30mA Low power Feature i e sleep mode wait mode lt 50uA Min 2 Timers A D channel Standard off the shelf 3 6 9V Alkaline Battery Replacement frequency aimed at min 6months Max dimensions of 150mm 85mm 60mm Max of 100g Audible signal of 80dB Red flashing Light Emitting Diode LED Water proof Shock proof Vibration proof Temp range 10C to 50C Max 50 Encode signal with unique signature for each unit Hence a different audible signal used for each child Software based solution to self test the modules to assure that the units are functioning correctly Microcontroller based directional transducer for child location Chapter 1 LCD As the unit gets more complex it would be more use
38. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Interrupt address for KD30 to allow BP and Debugging 0 0 0 0 0 0 0 0 0 0 0 0 0x6B 0x CB OxOF 0x00 Interrupt Address for TAO 0x6B 0xCB 0x0F 0x00 0x00 0x0A 0x00 0x00 0x00 0x0C 0x00 0x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 void main void unsigned int 1 Copy the transmit function program into RAM for i 0 i lt RAM_RX MAIN_SIZE i Start copy from ROM to RAM char far RAM RX MAIN START i char far ROM RX MAIN START i Copy sleep mode function into RAM for i 0 lt RAM SLEEP MODE SIZE i Char far SLEEP MODE START i far ROM SLEEP START i Copy the interrupt service routine into RAM for iZ01 RAM ISR SIZE i char far RAM TAO ISR START i char far ROM ISR START i Copy TIMERa0 isr into RAM Clement Y L Pang 67 Microcontroller based directional transducer for child location Appendix C Software Listing for i 0 i lt RAM_TIMERA1_SIZE i char far RAM_TIMERA1_START i char far ROM TIMERA1 START i Copy the diagnostic function into RAM forGi 0 i lt RAM_DIAGNOSTIC_SIZE i char far RAM DIAGNOSTIC START 1 z far ROM DIAGNOSTIC START i rx_main Call Icd function in RAM
39. 161 erre Programmable Ports 1 163 Wateheag limer SS Electrical characteristic 1 174 R Flash memory version 1 217 Clement Y L Pang 84 Microcontroller based directional transducer for child location Appendix F M16C User Manual Pin Configuration and block diagram of M16C 62 A and N device I O ports Internal peripheral functions Timer 16 bits Timer TA1 16 bits Timer TA2 16 bits Timer TA3 16 bits Timer TA4 16 bits 8 8 8 8 8 Port PO Port P3 A D converter 10 bits x 8 channels Expandable up to 10 channels UART clock synchronous SI O 8 bits x 3 channels System clock generator XIN XOUT XCIN XCOUT Clock synchronous SI O 8 bits x 2 channels Timer TBO 16 bits Timer TB1 16 bits Timer TB2 16 bits Timer TB3 16 bits Timer TB4 16 bits Timer 5 16 bits Watchdog timer 15 bits DMAC 2 channels D A converter 8 bits X 2 channels CRC arithmetic circuit CCITT Polynomial 16 12 5 1 M16C 60 series16 bit CPU core Registers 004 gt ROR RS QE __Vector table INTB x Fig Note 1 ROM size depends on MCU type Note 2 RAM size depends on MCU tvpe Program counter Stack pointer 2 POr Dr pe POs D
40. 300 km making two complete rotations every day The orbits are arranged so that at any time anywhere on Earth there are at least four satellites visible in the sky A GPS receiver s job is to locate four or more of these satellites figure out the distance to each and use this information to deduce its own location This operation is based on a simple mathematical principle called trilateration Clement Y L Pang 4 Microcontroller based directional transducer for child location Chapter 2 Investigation and Research Unfortunately like many other devices on the market some system solutions come with a single or multiple flaws Studying the GPS system further shows that it is difficult for the receiver to receive any signals when operating indoors Some of the reasons for this and other problems are listed as follows Signal multipath This occurs when the GPS signal is reflected off Objects such as tall buildings or large rock surfaces before it reaches the receiver This increases the travel time of the signal thereby causing errors o Visible satellites The more satellites a GPS receiver see the better the accuracy Buildings terrain electronic interference or sometimes even dense foliage can block signal reception causing position errors or possibly no position reading at all Therefore GPS units typically will not work indoors underwater or underground o Satellite geometry shading This refers to the relati
41. 6 1 while U1C1 1 0 Wait if the buffer is full UITBL led char i Send the next character while SW1 1 Stay in while loop till button pressed if low battery ON P2 0x01 else P2 0x00 Switch Sub clock ON and main clock OFF 2 0 01 Unlock Protect CMO 0x50 generation PRCR 0x00 Relock Protect for pause 0xFF pause 0 pause Software wait to stabilise sub clock 0 01 Unlock protect CMO 0 0 Set Xc as system clock OxF0 Switch off the main clock PRCR 0x00 Relock protect interrupt 29 4 void intO 1sr void unsigned char i 0 unsigned int pause Switch Sub clock OFF and main clock ON 0x01 Unlock Protect CMO 0 0 Set Xin generation PRCR 0x00 Relock Protect for pause 0xFF pause 0 pause Software wait to stabilise sub clock 0 01 Unlock protect CMO 0x50 Set Xin as system clock CMO 0x40 Switch off the sub clock Clement Y L Pang 61 Microcontroller based directional transducer for child location Appendix C Software Listing 0x48 Set high drive capacity 0x00 Relock protect
42. 6 5 Transmitter amp Receiver data 6 6 RF range and reliability 6 7 5 amp 12 KHz signal 6 8 Package Dimensions 6 9 Weight 6 10 Power supply 6 11 Cost Analysis 6 12 Chapter summary 6 0 Chapter Overview Chapter 6 evaluates the full performance of the final design in relation to the project s aim and product specification outlined in chapter 1 6 1 Hardware modification Due to unexpected conditions produced by specific components on the TX and Rx modules hardware modifications were essential to produce the best results 6 1 1 Tx module RESET IC RESET ICs are used in MCU applications to serve as a logic power supply monitor so that when power if fed into the system the RESET IC initiates a low logic reset low for M16C families to switch on the MCU Unfortunately the original SMD reset IC ordered MC33464N 27CTR had the required reset threshold of 2 7V but only when the input voltage was greater than 4V as shown in figure 3 on its data sheet Other devices on the current market did not have such a low threshold or was over complicated for the system As a result a standard switch pulled high via a resistor was used to act as a manual reset button shown in Appendix A 1 6 1 Rx buffer As described in the hardw re and software chapters in this report the receiver module when used needs to be kept on throughout the usage duration For that reason it is essential to reduce the current consumption of the system to the mi
43. 700 8FF Z CODE SEG 100 FA2FF QSEG RAMRX SEG ROMRX 5 RAMSTANDBY at logical address 900 Z CODE SEG_RAMSTANDB Y 900 9FF Z CODE SEG_ROMSTANDB Y FA300 FA3FF QSEG_RAMSTANDBY SEG_ROMSTANDBY l Place SEG RAMTIMERAO at logical address A00 l Clement Y L Pang 64 Microcontroller based directional transducer for child location Appendix C Software Listing Z CODE SEG_RAMTIMERA0 A00 AFF Z CODE SEG_ROMTIMERA0 FA400 FA4FF QSEG_RAMTIMERA0 SEG_ROMTIMERAO Place SEG RAMDIAGNOSTICS at logical address BOO Z CODE SEG RAMDIAGNOSTIC B00 BFF Z CODE SEG ROMDIAGNOSTIC FA500 FASFF QSEG RAMDIAGNOSTIC SEG ROMDIAGNOSTIC Place SEG at logical address Z CODE SEG_RAMTIMERA 1 C00 C1F Z CODE SEG_ROMTIMERA 1 FA600 FA61F QSEG 1 5 ROMTIMERA I l Re locatable bit segment As BITVARS contains bit addresses the desired byte address has to be multiplied by 8 Set up user stack and interrupt stack Z NEAR CSTACK USER STACK SIZE NEAR RAM A
44. DDRESS Z NEAR ISTACK INTR STACK SIZE NEAR RAM ADDRESS Near far and huge data segments in RAM These are actually all placed in near RAM YY Z NEAR IDAT UDATA0 _NEAR_RAM_ADDRESS Z FAR JIDATAI UDATAI NEAR RAM ADDRESS Z HUGB IDATA2 UDATA2 NEAR RAM ADDRESS Initialisation data segments in ROM E Z FARCONST CCSTR CDATAO CDATA1 FAR ROM ADDRESS Z HUGECONST CDATA2 FAR ROM ADDRESS En GEER Z HUGECONSTJINTVEC1 FFFDC FFFFF META FE Clement Y L Pang 65 Microcontroller based directional transducer for child location Appendix C Software Listing printf sprintf scanf sscanf e_small_write _formatted_write e_medium_read _formatted_read EE RR E Constant segments in ROM Ea Z HUGECONST HUGE CONST FAR ROM ADDRESS 12 22 112 e End of file LNKM16CY XCL Clement Y L Pang 66 Microcontroller based directional transducer for child location Appendix C Software Listing Receiver Source Code define Chip_3062x For iom16c62 h M16C 62N include common FLASHOFF h include lt iom16c62 h gt include lt intrm16c h gt Global Variables signed char alarm buzzer low_battery unsigned int delay void diagnostic void void standby_mode void void rx_main void unsigned char invec tab 0 0 0 0
45. F2 SEG_ROMPRINTF2 Re locatable bit segment As BITVARS contains bit addresses the desired byte address has to be multiplied by 8 7 Z BIT BITVARS FIRST BITVAR LAST BITVAR AEA Set up user stack and interrupt stack Z NEAR CSTACK _USER_STACK_SIZE _NEAR_RAM_ADDRESS Z NEAR ISTACK INTR STACK SIZE NEAR RAM ADDRESS Near far and huge data segments in RAM These are actually all placed in near RAM Z NEAR IDAT A0 UDATAO0 NEAR RAM ADDRESS Z FAR JIDATAI UDATA1I NEAR RAM ADDRESS Z HUGB IDATA2 UDATA2 NEAR RAM ADDRESS Z FARCONSTJCCSTR CDATAO CDATA1 FAR ROM ADDRESS Z HUGECONST CDATA2 FAR ROM ADDRESS Z FARCONST CHECKSUM FAR ROM ADDRESS Clement Y L Pang 53 Microcontroller based directional transducer for child location Appendix C Software Listing CODE segment FN Set up the tiny func table l Z HUGECONST FLIST FFE00 FFFDA See configuration section concerning printf sprintf scanf sscanf l e_small_write _formatted_write e_medium_read _formatted_read Segments that has to be in RAM reachable for defa lt pointers SDT ARES 22
46. Microcontroller based directional transducer for child location UNIVERSITY OF HERTFORDSHIRE Faculty of Engineering amp Information Sciences BACHELOR OF ENGINEERING DEGREE WITH HONOURS IN ELECTRICAL AND ELECTRONIC ENGINEERING PR Project Report MICROCONTROLLER BASED DIRECTIONAL TRANSDUCER FOR CHILD LOCATION Clement Yuk Leen Pang April 2003 Microcontroller based directional transducer for child location Microcontroller based directional transducer for child location Abstract This report covers the complete stages of designing a radio wave s wireless based child locator from an initial concept to a working printed circuit board PCB solution Hardware software implementations have been aimed to produce a low cost portable system in particular the testing and evaluation of the final design is discussed in relation to the product specification outlined in the introduction Conclusively the report refers to the effectivenessyof the design and issues regarding future developments Clement Y L Pang i Microcontroller based directional transducer for child location Acknowledgement I would like to take this opportunity to thank Stuart Archer and his team in Mitsubishi Semiconductors for their support help and advice My thanks also go to my project supervisor Kate Williams for her consistent support and guidance throughout the project period and Tony Crook
47. The plain rectangul r copper fill located near the bottom right of PCB is the copper ground plane needed for th aerial red spiral like track on figure 10 to radiate 000000000 000 0000000 o 07100000 071 Figure 12 Rx PCB 65mm by 100mm Note The dimensions of the rec iver board are larger than that of the transmitter due to the physical size of the PP3 battery and LCD display Figure 13 Rx PCB in 3Dimensional view Clement Y L Pang 16 Microcontroller based directional transducer for child location Chapter 5 Software Development Note As mentioned in chapter 3 the aerial of the receiver is similar to that of the transmitter with its respective ground copper plane parallel to it If we considered using the original receiver and the lithium battery coin cell then the dimensional size would be reduced dramatically as shown in figure 14 0000000060 1 111111 20000000 0 0000606000 10000004 Figure 14 Rx 3V version 45mm by 90mm Note Again the same principle is used with the SMD components on the bottom layer and through hole devices on the top layer 42 impediment A great deal of time was spent on the PCB design and the positions of each component to achieve the desired dimensions and layout Majority of the delay came from the antenna track section as it had to be independent and isolated from other local links This was finally
48. V version with higher current consumption was implemented instead Fortunately both receivers have the exact same features and pin Therefore if the receiver were to replace the 5V version the hardware software of the module would still be fully functional and would further reduce the overall curr ntconsumption of the module The chosen data value sent in hexadecimal was used for the main transmission owing to two main reasons Dueto the characteristics of AM being extremely vulnerable to noise the data sent should preferably be as short as possible so that it limits the amount of noise it can pick up Clement Y L Pang 39 Microcontroller based directional transducer for child location Chapter 7 Conclusion As it is recommended that the data being sent should maintain a zero direct current DC component over a finite time so that the demodulator in the receiver can properly interpret the received data as either 0 or 1 hence improving its efficiency and reliability Encoding techniques for the RF data such as Manchester encoding and decoding could be used between the modules but this would require twice the communication bandwidth Due to this fact it was not considered for the transmission of the predefined signal even though it can easily be implemented into RS232 data more information about this in section 7 1 The data rate implemented within the modules is 1200
49. an the previously result obtained Clement Y L Pang 27 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase Figure 20 PCB with wire antenna signal In order to improve the signal strength an additional wire was used to act as the antenna as described previously The results were impressive with signal strengths of around 33 64dBm which in turn is 0 001mW Hence the resulting solution was to implement the additional wire onto the final design Figure 21 below illustrates the radiation pattern similar to that of the antenna implemented Figure 21 Radiation pattern 41 Clement Y L Pang 28 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase 62 Specification Comparison The following table illustrates the product specification compared to the actual results obtained from the system PHASE 1 Features Specification Actual Results Receiver Rx module lt SmA and lt 5V power supply 5 8mA and 9V supply Transmitter Tx 5mA and lt 5V power supply 248A 3V supply module RF range Min 15M and Max 25M Min to Max 30 MCU 20 100Pin 8 16 bit core Tx MI6C 62N MCU Flash memory Low power 30mA Rx M16C 62A MCU Low power Feature i e sleep mode wait mode lt 50uA Min 2 Timers A D channel Battery power supply Standard off the shelf 3 6 9V Alkaline Tx lithium coin cell Batte
50. ardware implementation throughout this project ran in parallel with the software programming as this allowed both aspects to be tested simultaneously A lot of time was spent in the software development stage inorder to produce a code structure with a maintainable layout These involved techniques such as creating separate functions for each feature allocating appropriate segments of random access memory RAM for read only memory ROM functions and writing efficient and readable code The first phase of the project was to design and develop the transmitter module which required simple links between the MCU and a standard off the shelf transmitter The original code written caused problems with thestransmission of data causing the module to transmit random signals In order to resolve this problem and capture the data that was being transmitted the module was connected 0 a PC Viarits serial port running Windows Hyper Terminal This helped to modify the universal asynchronous receiver and transmitter UART setup on the MCU correctly to produce the correct data which was clearly displayed on Hyper Terminal This method proved very beneficial as it clearly displays the data sent out of the Tx unit onto the computer screen Similarly the receiver module was also implemented in the same manner utilising Hyper Terminal Regarding the Rx module the original 3V receiver unit that was considered for this application had availability issues as a result a 5
51. ased directional transducer for child location Appendix C Software Listing FMR0 1 1 FMRI 3 0 1 FLASH memory power supply on FMR1 3 1 1 FLASH memory power supply off l Configure ports l 0x00 All port pins low PDO 0x07 Set all as inputs except bit0 amp 1 0 00 All port pins low PD1 0x00 Set as inputs P2 0 00 All segments off PD2 0x01 Set as inputs except 0x00 All port pins low PD3 0x00 Set as inputs P4 0 00 All port pins low 0x00 Set as inputs P6 0 00 Set port low PD6 0x00 Set as inputs 7 0 00 All segments off PD7 0x0C Set as inputs except bit2 amp 3 8 2 1 Set port8 2 high 8 3 1 Set port8 3 low 8 5 1 Set port 8 5 High NMI P8 6 0 When XCin is set port P8 bit 6 and 7 have to P8 7 0 be set low PD8 20xC3 Port 8 all outputs except b2 3 4 amp 5 0x04 Port9 write enabled PD9 0x00 Set as inputs P9 0 00 segments off P10 0 00 All segments off PD10 0x00 Set as inputs PURO OxFB Pull p resistors for Port0 1 4 7 2 and 3 PURI OxF9 Pull up other port4 5 6 amp 7 PUR2 0x3C Without Pull up for P8 0 P8 7 P9 10 pull u
52. baud This was considered as adequate communication speed between the modules since the time it took to transmit the signal and the receiver receiving the signal was practically instantaneous as mentioned in the testing phase Greater bandwidth in RF communication may not always improve the situation as these modules are usually more expensive and factors such as inter symbol interference may occur In order to produce a complete system both the transmitter and receivers were captured into schematic which were ported into a Printed Circuit As a third party provided the manufacturing process the main objective in this section was to design the layout of the transmitter and receiver board This involved either obtaining the footprint for each component or most commonly creating them from scratch Dueuto a limitation in size provided by the product specification created many of the components were surface mount device SMD formats In order to minimise the size of the modules devices were placed on both sides of the PCB where through hole components dominated the top layer and SMD components on the bottom layer The product specification required the PCBs to be encapsulated into a box due to protection and portability issues This was not complete due to the time restrictions of this project Current consumption can determine the commercial viability of the product therefore much investigation and techniques were imple
53. cimal 4 96 3 83 0 25 20 107 0 88 19 10 47 Therefore the digital threshold is 255 47 Clement L Pang 22 Microcontroller based directional transducer for child location Chapter 5 Software Development 208 0 5 3 4 Standby Function The standby function is similar to that of the sleep mode function used imthe transmitter source code Instead of setting the MCU into stop mode this function sets it into wait mode since the ISR used to wake the MCU up and check the signal does not have high enough priority in order to wake the MCU from stop mode The FLASH memory is again switched on prior to entering wait mode as the FLASH memory is automatically switched off once the MCU enters either wait or stop mode Main Function Provide vector table for ISR used Copy all ROM functions into RAM Call Rx_main function Rx_main Function Diagnostic Function Configure clock to main Perform ADC clk 8 250KHz operation Configure ports Test value against registers and interrupts threshold lt 0xD0 Disable FLASH memory Light LED if true Call Diagnostic function standby function Standby Function Set MCU to wait 4 Mode ISR configured to be Interrupt Service Routine called every 9ms Check for valid signal Signal stored in Rx buffer correct A1 ARTA Yes TimerA1 ISR Disable alarm hence cancel Sound 4KHz buzzer signal TimerA1
54. d Circuit Board From information provided in Chapter 3 Appendix A 1 shows the complete schematics for the transmitter and receiver circuit produced Protel99 SE One of Protel s powerful features is that it can transfer any complete schematics onto va PCB document provided that all the footprints for the components are present Once the schematics were complete footprints for each device were added with their respective electrical characteristics In order to minimise the overall layout of th transmitter and receiver module SMD components were mainly used and situated on the bottom layer of the PCB This proved successful as a space saving option as it allowed through hole components to dominate the top layer Regarding the 3 Diamonds board only the MCU was taken for the final PCB design as the other components were not necessary The PCB layout for both the transmitter and receiver are shown on figure 10 and 11 and figure 12 and 13 respectively Figure 10 Tx PCB 40mm by 70mm Note The red lines displayed on the PCB illustrate the connection lines on the top layer whereas the blue lines are that of the bottom layer The yellow boundaries show the component locations Clement Y L Pang 15 Microcontroller based directional transducer for child location Chapter 5 Software Development Note This 3 Dimensional view of the transmitter board clearly illustrates the main SMD components placed on the bottom layer of the PCB
55. d char __low_level_init void Select full speed operation 0 01 Unlock CM0 and 0 00 Single chip mode CMO 0x40 Disable divider set Fin 8 at low drive mode 0 00 Relock return 1 Force cstartup to initialise RAM etc void tx_main void unsigned char pause 2 1 Switch Sub clock ON and main clock OFF 0 01 Unlock Protect CMO 0 50 Set Xc generation PRCR 0x00 Relock Protect for pause 0xFF pause 0 pause Software wait to stabilise sub clock 0 01 Unlock protect 0 0 Set Xc as system clock OxFO Switch off the main clock Clement Y L Pang 56 Microcontroller based directional transducer for child location Appendix C Software Listing 0x00 Relock protect iw sr Fa Switch Flash memory off iw QA aa Set to CPU rewrite mode FMR0 1 0 FMR0 1 1 Set Flash reset bit to turn Flash off FMR0 3 0 FMR0 3 1 ww ass sss Configure ports iw s s s ya PO 0 02 All segments off except P0 1 PD0 0x07 Set all as inputs except bit0 1 amp 2 0 00 All segments off PD1 0x00 Set as inputs P2 0 00 All segments off PD2 0x03
56. d into the MCU so that the units to self test the modules can self diagnose themselves by running a to assure that the units routine which test the functions of each functioning correctly module and its RF link Clement Y L Pang 32 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase The threshold for the receiver was chosen to be 7V due to the characteristic of the 5V regulator used Figure 22 below indicates that as the supply voltage passes the threshold of 7V the regulated voltage becomes unstable hence resulting in an unregulated 5V output With the ADC function operating correctly other issues regarding the diagnostic feature were to make sure that the on board LED and the RF link worked Software was written within the ADC Operation to blink the LED to indicate that the LED was operational The RF link was left out as it was decided that it could easily be a simple procedure for the end user tostest each time they first turn on the system 10 Voltage relationship Output voltage e Voltage reg V Voltage at Vdivider all Figure 22 Voltage relationship diagram 6 5 Transmitter and Receiver data Hyper Terminal a standard software package that comes with Windows operating system was used in order to test the receiver and transmitter and its relevant code In order to prove that the transmitter was sending
57. d location Appendix C Software Listing Appendix C Software Listing The following pages contain the source code for each function used for the transmitter and receiver module This will also include the xcl linker file that has been modified from the original provided by the compiler Clement Y L Pang 51 Microcontroller based directional transducer for child location Appendix C Software Listing Transmitter XCL file LNKM16CY XCL Example file to be used with This file shows a set up for the near memory model where there is no ROM in the default near area Read farconst htm for more information on how on chip ROM can be used Usage XLINK your file s f Inkml16cy IMPORTANT Use a COPY of this file and if needed customize for your own purposes Id Inkm16cy xcl 1 10 2001 05 16 11 09 01 John Exp l Defines used by m16c xcl all values are in hex customize according to your specific derivative l Stack sizes D_USER_STACK_SIZE 200 D_INTR_STACK_SIZE 40 Change this to the starting address of ROM D FAR ROM ADDRESS FA000 First available RAM address D_NEAR_RAM_ADDRESS 400 Bit variables range D_FIRST_BITVAR 2000 8 400 hex D_LAST_BITVAR FFFF Create a 2 byte ch
58. d single supply voltage Originally the AM 8 433 receiver was chosen for this application due to its supply voltage and low current consumption 0 5mA but unfortunately due to availability and order quantity issues it was unable to be obtained Therefore AM HRR3 433 the 5V version was chosen instead However the design of the receiver module will be able to support the 3V version due to its main advantages described and the beneficial fact that both devices are pin compatible Ideally if production was to proceed then the device will be implemented The buffer U11 is connected to the receiver unit in the same fashion as it was with the transmitter unit hence providing the same technique for controlling the receiver s on and off status Clement Y L Pang 11 Microcontroller based directional transducer for child location Chapter 3 Hardware Implementation Figure 7 Receiver RX unit 3 2 2 Power supply The receiver unit requires typically 5V to operate therefore a standard 9V PP3 battery was used as the main power source To achieve a reliable and constant supply to the system a 5V regulator LE50CZ was used U2 in figure 8 Unlike the transmitter module it was necessary to incorporate this voltage regulator so that the supply voltage for the devices was regulated down to their appropriate operating voltage level supply or a regulated SV supply to the ADC monitoring channel of the MCU would not allow
59. e as expected 25 8 Table 7 Buzzer s effectiveness 6 8 Package dimensions Information and diagrams shown in chapter 5 and Appendix E 1 and E 2 illustrates that the final design concept has the following dimensions Modules Actual Dimensions mm Specified Max dimensions mm Transmitter module 40 70 depth 20 150 85 depth 60 Receiver module 65 100 depth 32 150 85 depth 60 3V receiver module 45 590 depth 22 150 85 depth 60 Table 8 Dimensions comparison From table 7 it clearly indicates that the resulting module sizes are within the maximum dimensions specified This is due to the majority of the devices used were SMD format and a lot of space_was saved by placing components on both sides of the PCB as described in chapter 5 It is also clear that if the 3V receiver was available than the overall size of the 3V receiver module would reduce dramatically as the 9V PP3 battery component takes up majority of the space on the PCB receiver board Clement Y L Pang 36 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase 6 9 Weight Using a standard kitchen weighing scale the following table table 8 illustrates that the weights of the complete Tx and Rx modules are well within the range specified in the product specification Module Specification weight Actual weight Tx module Max of 100g 256 Rx module Max of 100g 85g Table 9 Weight compari
60. e AM has the advantages of being low cost readily available and AM receivers simple to tune Even though their main disadvantage is in its efficiency and its vulnerability to noise its advantages out weigh the disadvantages which can be improved in software within this application hence suiting the requirements for this project Clement Y L Pang 6 Microcontroller based directional transducer for child location Chapter 3 Hardware Implementation Chapter 3 Hardware Implementation Chapter Contents 3 0 Chapter Overview 3 1 Transmitter Overview 3 1 1 Power supply 3 1 2 Voltage Reference 3 1 3 Serial Connector 3 1 4 Transmitter M16C 62N MCU 3 1 5 Buffer 3 1 6 Transmitter unit 3 1 7 Antenna 3 2 Receiver Overview 3 2 1 Receiver unit 3 2 2 Power supply 3 2 3 LCD 3 2 4 Receiver M16C 62A MCU 3 2 5 Buzzer 3 2 6 Serial Connector and Antenna 3 3 Additional Hardware notes 3 4 Hardware Implementation summary 3 0 Chapter Overview This chapter illustrates all the different devices used for both the transmitter Tx and receiver Rx circuit It describes and explains why certain devices were used and its relevance to the final design concept 3 1 Transmitter overview For simplicity Figure 1 illustrates the fundamental devices necessary for the transmitter unit The sections thereafter will explain each corresponding sections separately with its respective schematic diagram Power Antenna Voltage Transmitter f reference
61. e and within the specifications laid out in chapter 1 Hence the following sections below were evaluated Hardware modification System current consumption Battery monitor ADC Diagnostic feature Tx and Rx data RF range Buzzer Module dimensions Weight Power supply Clement Y L Pang 37 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase The results show that the modules designed were well within the specification outlined apart from the Rx module s current consumption with a value of 5 8mA it was 0 8mA greater than that specified If the Rx module utilised the 3V receiver and MCU then the current consumption would be reduced to 3 8mA in standby hence within the product specification The testing phase proved that the RF link achieved was extremely reliable up to distance of 17m Any distance greater than this was very much antenna position dependant At the right position for the antenna though distances of greater than 30m wasgachieved with 100 reliability Features such the battery monitor and diagnostic functions were all software based thus it was tested and debugged during the development stage Other aspects of the testing phase were straightforward procedures such as measuring and recording values Due to time limitations the original software LCD mentioned in the specification was not implemented The testing phase proved that the modul
62. e developed development board 34 Hardware implementation summary Many of the devices chosen for the project suited the original requirements that were necessary to meet the aims Since many of the devices had no shut down pins to help reduce the overall current consumption additional components and techniques were used to produce the same effect Due to availability issues regarding the receiver unit a 5V version was opted for the development of the receiver module This in turn resulted in utilising the M16C 62A device for the 5V operated receiver module The hardware of both Tx and Rx modules has been kept to the minimal so that it would reduce the overall cost and weight of the modules In order for the system to provide more functionality software solutions were opted as this would have no bearing on the overall hardware cost Clement Y L Pang 14 Microcontroller based directional transducer for child location Chapter 5 Software Development Chapter 4 Transmitter and Receiver Printed Circuit Board Chapter contents 4 0 Chapter Overview 4 1 Printed Circuit Board 4 2 impediment 4 3 summary 40 Chapter Overview With the prototype complete the next stage was to import the schematies of the modules onto PCB This chapter highlights the stages taken in order to produce the required PCB which was to be later encapsulated if time permitted to create the final product as outlined in the original aim 41 Printe
63. ecksum using crc16 This option requires that we fill unused so we fill with zero a J2 crc16 Z CODE SEG RAMTX 1000 11 DE Z CODE SEG ROMTX FAC22 FADFF QSEG RAMTX SEG ROMTX EE Place SEG RAMSLEEPMODE at logical address 900 i EE Z CODE SEG_RAMSLEEPMODE 900 9FF Z CODE SEG ROMSLEEPMODE FA500 FASFF QSEG RAMSLEEPMODE S EG ROMSLEEPMODE Place SEG RAMINTO at logical address A00 Clement Y L Pang 52 Microcontroller based directional transducer for child location Appendix C Software Listing Z CODE SEG_RAMINTOISR A00 AFF Z CODE SEG_ROMINTOISR FA600 FA6FF QSEG_RAMINTOISR SEG_ROMINTOISR Place SEG RAMDIAGNOSTIC at logical address BOO Z CODE SEG RAMDIAGNOSTIC B00 BFF Z CODE SEG_ROMDIAGNOSTIC FA700 FA7FF QSEG_RAMDIAGNOSTIC SEG_ROMDIAGNOSTIC Place SEG RAMHYPERTERMINAL at logical address Z CODE SEG_RAMHYPERTERMINAL C00 DFF Z CODE SEG_ROMHYPERTERMINAL FA800 FA AFF QSEG_RAMHYPERTERMINAL SEG_ROMHYPERTERMINAL Z CODE SEG_RAMPUTC E00 E20 Z CODE SEG ROMPUTC FAB00 FA B20 QSEG RAMPUTC SEG d hn SEL Place SEG RAMPRINTF at logical address D21 Z CODE SEG_RAMPRINTF2 E22 F21 Z CODE SEG_ROMPRINTF2 FAB22 FAC21 QSEG_RAMPRINT
64. ect P0 2 1 Switch Vref on P2 0 1 Light LED for pause 0xFF pause 0 pause P2 0 0 Disable LED J RRR Use measure battery status J nnn ADCONI1 5 1 Vref connected for pause 0xF pause 0 pause 1 Allow software pause for lus ADCONO 6 1 Start ADC conversion now while ADCONO 6 1 Poll for ADC to finish adcvalue ADOL Store value into local variable if adcvalue lt OxF7 Clement Y L Pang 59 Microcontroller based directional transducer for child location Appendix C Software Listing low battery ON Check if below threshold P2 0 1 else low_battery OFF P2 0 0 ADCONI1 5 0 Vref disconnected ADCONO 6 0 Disable ADC conversion P0 2 0 Switch Vref off Switch Sub clock ON and main clock OFF 2 0 01 Unlock Protect 0x58 Set Xc generation 0x00 Relock Protect for pause 0xFF pause 0 pause Software wait to stabilise sub clock 0 01 Unlock protect CMO 0xD8 Set Xc as system clock OxF8 Switch off the main clock OxF0 Set low drive capacity 0x00 Relock protect void hyper_termi
65. ee clad eee ie edens 37 611 58 iain ak onset han awed 37 6 12 Ch pter Sutmmaty 5 recette redet Shui u ia 37 Chapter 7 Conclusion nn aser onnhaasten Gi W sh PARRRRREPRUDE 39 7 0 Conclusioni epe e ect EE Pete tet ERR 39 7 1 Future Development y emerit ete B Ree etri RE e egt 41 7 1 1 Software LCD snos MESES 41 7 1 2 Tx and Rx s iiis teet reete tt dee lQ usu 42 7 1 3 Antenna alot es oes 42 7 1 4 Data Encryption i egeo reete eet e eee tentoria 42 7 1 5 Product Durability aree 42 Reference Tiston n m o tete e Nu 43 nte ere eee E ted Susa 44 Appendix A 1 Tx and Rx circuit diagram eese esee eene nennen nennen entente enn 45 Appendix A 2 Tx and Rx Development 1 48 Appendix B Component Listing and Cost desees 49 Appendix C Software Listing Ren ect rr e Hon eb dieto te bte 51 Transmitter XC Ly file y n Noo ree ot eis te de 52 Transmitter Source 2 222222 2 2 2 55 Common header fler We as Se ete AS Aaa 63 Receiver XCL ld M eee aaa 64 Receiver Source Code n u eee ote be oie e deleti oe
66. er Simple PP3 battery connectors to power the board Using the 3 Diamonds board as a target board for evaluating the MCU allowed the software written to be compiled debugged and stepped through Utilising the available wan header connectors allowed the development board to be easily linked together with external devices providing a means of a simple in circuit emulator where the circuit could be tested Figure 4 shows a simplified diagram of the M16C 62N 3 Diamonds Board Figure 4 Mitsubishi s M16C 3 Diamonds Board Information regarding the MCU and can be found in Appendix F 3 1 5 Buffer MCU header connector Swiches Battery Contacts Clement Y L Pang 9 Microcontroller based directional transducer for child location Chapter 3 Hardware Implementation The 74HC buffer U4C as illustrated below is a standard off the shelf component with six internal NOT gates The purpose for the buffer is to clean the signal from the MCU transmit pin before reaching the transmitter and antenna It also provides a means of isolation between the MCU and transmitter in case of any spurious errors that may occur Figure 5 shows how the buffer is connected to the MCU pin P0 1 via the PNP transistor s base The reason for this is to ensure that the buffer is not directly connected to the supply voltage Vcc hence acting as an open circuit i e no current flow Once the corresponding port pin goes low hence 0
67. erence voltage Vref for the ADC on the MCU therefore the onboard ADC would not be able to operate To compensate a 2 5V voltage reference device U8 was used for Vref This solution has its advantages over using a voltage regulator as it only requires ImA to provide a constant voltage that can be controlled on or off by the MCU high or low respectively hence obtaining better power efficiency More information regarding the ADC can be found in chapter 5 in the software section Figure 2 shows a simple voltage divider across the supply rail Vcc and ground GND The reason for this is so that the ADC monitoring port Port10 0 has approximately the same voltage level of Vref where it is used to monitor the status of the battery Below shows the calculations necessary in order to achieve 2 5V supply to P10 0 Using the voltage divider equation Vout 2 5V EET Vin 3V Equation 1 Vout Vin R R R Assume Rs 1K Implies that 2 5 3 1000 R 1000 3000 2500 2 5 Therefore 2000 Hence the preferred value of 2200 for was used to supply P10 0 with 2 56V Clement Y L Pang 8 Microcontroller based directional transducer for child location Chapter 3 Hardware Implementation 3 1 3 Serial Connector Figure 3 illustrated on the right shows the 10 pin connector used on the development board and PCB to allow programming and debugging of the MCU This hardware implementation enables the user
68. es were successfully within the specifications outlined which can provide a 100 reliable RF link within 30m Clement Y L Pang 38 Microcontroller based directional transducer for child location Chapter 7 Conclusion Chapter 7 Conclusion Chapter contents 7 0 Conclusion 7 1 Future Development 7 1 1 Software LCD 7 1 2 Tx and Rx MCU 7 1 3 Antenna Design 7 1 4 Data Encryption 7 1 5 Product durability 7 0 Conclusion The aim of the project was to design and develop a cost effective low power radio frequency RF based child locator from initial design to a manufactured product where the transmitter can send a predefined signal to the receiver which results in an audible tone This was achieved to a high standard by utilising the appropriate hardware feat res of the microcontroller MCU and additional software techniques When the transmitter module is switched on the unit remains in standby mode until a button is pressed Once action is detected the MCU wakes up and transmit the signal three times while blinking a light emitting diode LED to indicate to the user that the module is transmitting Similar to that of the transmitter the receiver is also in standby mode but is programmed to wake up every so often to check for valid signals If a valid signal is present the on board MCU on the receiveryactivates piezo transducer producing a 5 and 12 KHz tone any other signals that are not valid to the receiver are discarded The h
69. f com mar19 2 html 2 GPS operation http electronics howstuffworks com gps1 htm 3 ANTENNAS FOR LOW POWER APPLICATIONS By Kent Smith Page 1 4 ANTENNAS FOR LOW POWER APPLICATIONS By Kent Smith Page 4 Clement Y L Pang 43 Microcontroller based directional transducer for child location Bibliography http www infomicom mesc co jp indexe htm 16 62 Group User s manual e M16C 62A Data Sheet e M16C 62N Data Sheet 3 Diamonds Board User Manual e 3 Diamonds Board Schematic www iar com e Embedded workbench compiler e JAR user manual e linker and object files www pcb pool com e Third Party PCB manufacturer www protel com e Protel User manual and tutorial www radiometrix co uk www maxim ic com http mathforum org dr math http www rfsolutions co uk datasheets datasheets htm e Tx Data Sheet e Rx Data Sheet Clement Y L Pang Bibliography 44 Microcontroller based directional transducer for child location Appendix A 1 Tx and Rx circuit diagram Appendix A 1 Tx and Rx circuit diagram The following pages contain the full schematic diagrams fro the transmitter and receiver module produced in ProtelSE99 Clement Y L Pang 45 Microcontroller based directional transducer for child location Appendix A 1 Tx and Rx circuit diagram Tevewn 01 chee Ul for ducoupling purporar with
70. for his additional advice Finally I would like to thank all my family and friends Scott Mane and Jamie especially my parents and Cecilia who all have helped me throughout my years at Hertfordshire Clement Y L Pang 11 Microcontroller based directional transducer for child location Contents Chapter 1 Introduction eee neenon anten ete aa awaqa Q e d 1 L0 ade Wa aa aie Sek iain Au eee 1 1 1 Project aims and 1 12 Design limitations vasken Giang ccn 1 1 3 Initial product specification Pay YF 2 L4 JSUmmary iis kristin de nee RI _ JE 3 Chapter 2 Investigation and 2 0 5 23 4 2 0 Ch pter Overview s et uu PE Otter 4 2 1 Market potential aaa aha aa 4 2 2 Investigation in location devices Pl a rennen nennen ennt 4 22 1 GPS T Ar OE 4 2 2 2 Indoor location System oen u ethos pa Nba reete meet 5 2 2 3 Radar and Sonar epe iu sa 5 2 3 Required RE Distance eoe Peers 5 24 Investigation and research Summary a
71. gn of the receiver module but software was not written for the MCU to control it due to time constraints To produce an attractive system software for the LCD should be written so that it can display a menu system time and date calendar similar to those used on mobile phones Another important feature that was not implemented again due to time limitations was a simple text message one way communication from the transmitter to the receiver Originally it was planned that the transmitter module could be connected to a PC user could simply type a short message in Hyper Terminal to be sent to the receiver Once sent the receiver would store the information in a circular buffer and display the full message onto the LCD As shown below in figure 27 the software for storing the message in Hyper Terminal for the transmitter side was complete therefore only software coding is required at the receiving end s n Hyper CLocator HyperTerminal 5 File Edit View Call Transfer pig ala Test Demo for RF SMS Version 0 1 Final Year Project RF based Child locator Programmed by Clement V L Pang Supervisor Kate Williams Please enter 26 character message Come back home son_ Connected 00 01 48 1100 2008 SCROLL CAPS NUM Capture Print echo amp 508 amp 5 8 Hy RYG BEI Mon 31 Mar 2003 11 19 20 Figure 27 Hyper Terminal message setup Manc
72. h software one wait VCC 3V 5 AE 25 internal and 8 external intemupt sources 4 software interrupt sources 7 levels including key input interrupt Multifunction 16 bit timer 5 output timers 6 input timers lO eee 5 channels 3 for UART or clock synchronous 2 for clock synchro nous 2 channels trigger 24 sources converter oreet 10 bits X 8 channels Expandable up to 10 channels v BA sonverter aa 8 bits X 2 channels s CRC calculation circuit 1 circuit Watchdog 1 line Programmable WO 87 lines Input port asset 1 line P85 shared with NMI pin Memory expansion Available to a maximum of 1M bytes s Chip select 4 lines Clock generating circuit 2 built in clock generation circuits built in feedback resistor and extemal ceramic or quartz oscillator Applications Audio cameras office equipment communications equipment portable equipment Table of Contents Central Processing Unit CPU 4 4 1 78 1 108 Processor Mida roa A D 1 149 Clock Generating Circuit D A Ganvertar ua 1 159 Protectian u uum eee q CRC Calculation Circuit 1
73. hester encoding and decoding when transmitting the customised message should be implemented as the data to be sent will probably no longer consist of frequent transitions of 0 Clement Y L Pang 41 Microcontroller based directional transducer for child location Chapter 7 Conclusion and 1 s and a zero DC component As the UART has been set up to transmit the original signal Manchester encoding can be performed by splitting the original byte 8bits into two separate words 4bits and encoding each word into a byte hence resulting in two bytes of Manchester encoded data The following shows a simple example of how the implementation of Manchester Encoding in serial RS232 data would be performed Original Data 0x56 MSB 0101 0110 LSB Hex 56 is the letter V in ASCII MSB word 0101 Manchester Encoded 01100110 LSB word 0110 Manchester Encoded 01101001 Data to be sent First 01101001 0x69 Second 01100110 0x66 At the receiver side the data received should be maskedyaccording to the bits required and masked together to obtain the original data This example also shows why Manchester Encoding requires twice the original communication bandwidth 7 12 Tx and Rx MCU The MCU used for the transmitter and receiver is both 100 pin packages where for instance in the transmitter side many of the port pins were left unused If this system was to be commercially viable lower pin count MCU would be used in order to red
74. iagnostic void void standby mode void extern signed char alarm buzzer Definition for RAM copying define RAM RX MAIN SIZE 0 001 define RAM_RX_MAIN_START 0x00700 define ROM_RX_MAIN_START OxFA100 define RAM SLEEP MODE SIZE define RAM SLEEP MODE START 0 00900 define ROM SLEEP MODE START OxFA300 define RAM TAO ISR SIZE 0x000FF define RAM TAO ISR START 0x00A00 define ROM TAO ISR START OxFA400 define RAM DIAGNOSTIC SIZE 0x000FF define RAM DIAGNOSTIC START 0 00 00 define ROM DIAGNOSTIC START 500 define RAM 1 517 0x0001F define RAM TIMERAT START 0 00 00 define TIMERA1 START OxFA600 Declare timers interrupt 21 4 void timer a0 void interrupt 22 4 void timer al void interrupt 23 4 void timer a2 void interrupt 24 4 void timer a3 void Declare external functions void standby mode void Include global variables extern signed char alarm buzzer low_battery extern unsigned int delay extern unsigned int tone freq 12 lextern unsigned char freq ptr Clement Y L Pang 74 Microcontroller based directional transducer for child location Appendix D Gantt Chart Appendix D Gantt Chart Clement Y L Pang Microcontroller based directional transducer for child location Appendix D Gantt Chart Gantt Chart TASKS LRC and Internet Research Feasibility Report stud Submi
75. indows environment is Systems Ltd Embedded Workbench also known as EWM16C The full source code and program is designed and implemented within EWM16C where it is also compiled and edited to produce the object file These files are then linked with the required libraries to produce either the mot file used to program into the target or the ieee file used for the KD30 debugger Libraries such as Chip 3062x iom16c62 h intrm16c h are all specific files included in the compiler that allows various functions ports and interrupts to be configured and called The header file common FLASHOFF h is an additional file created with all the common and global variables and functions declared The linker file is also a modified version of the original to allow full RAM operation support as discussed below For more information regarding these files please refer to Appendix C 5 1 2 KD30 Debugger The next stage after completing the software code is to test and debug the program KD30 is another Windows based program that allows users to step through the code place software break points and view information such as memory addresses C variable information and the program counter 5 1 3 FLASH starter Clement Y L Pang 18 Microcontroller based directional transducer for child location Chapter 5 Software Development This program takes the mot file produced by the compiler and serially programs or flashes the code into the ta
76. ing the low power features asit provides operation of the code in RAM hence providing the option to switch the FLASH memory circuit off to reduce a large proportion of the current consumption please refer to the electrical characteristic section in the MCU data sheet Also in order for selected ISRs to operate correctly their addresses must also be allocated in a specific location in known as the intvec tab array which is declared as a global variable The code below demonstrates h w one of the functions is copied from ROM FLASH to RAM Copy the transmit function program into RAM for i 0 lt KRAM TX MAIN SIZE 1 Start copy from ROM to RAM char far RAM TX MAIN START 1 char far ROM TX MAIN START i Clement Y L Pang 20 Microcontroller based directional transducer for child location Chapter 5 Software Development Once all functions are copied the function tx_main in RAM is called where all operation from there onwards is solely in RAM 5 2 2 Tx main Function At the beginning of this function the software code written configures the clock operation circuit so that the main clock is switched off and all operations work under the 32 KHz sub clock which enables the current consumption to be reduced further Now that all the functions are copied into Ram the next stage is to switch the FLASH circuit supply off using register FMRO Port PO through to port P10 are then configured as either input
77. itch Sub clock OFF and main clock ON EE PRCR 0x01 Unlock Protect CMO 0 0 Set Xin generation PRCR 0x00 Relock Protect for pause 0xFF pausel 0 pause Software wait to stabilise sub clock PRCR 0x01 Unlock protect CMO 0 50 Set Xin as system clock CMO 0x40 Switch off the sub clock 0x48 Set high drive capacity PRCR 0x00 Relock protect 1 11 Check U rt receive buffer for data E if UORBL OxAA While UOR BL 0xA A See if there is any data in receive buffer OxAA Check if preamble detected for pause OxFF pause 0 pause Software wait 0X271 if alarm 0 Signal received to activate buzzer delay 0 Set delay variable P7 2 0 Initialise buzzer pin P7 3 0 Initialise buzzer pin Clement Y L Pang 72 Microcontroller based directional transducer for child location Appendix C Software Listing P7 2 1 P7 3 1 P7 OxF4 Set buzzer pin high TABSR 1 1 buzzer ON Set variable to indicate buzzer active alarm Increment status variable if alarm gt 2 Signal variable used to deactivate buzzer P7 amp OxF3 NOR buzzer pins to 0 TABSR 1 0 7 2 0 7 3 0 alarm 0 Reset alarm value buzzer OFF Variable to indicate variable disabled P2 0x00 hf UORBH 7
78. mented in order to reduce it to the minimal This involved utilising the MCU pins to provide a means of shut down to external components via either a simple NPN or PNP transistor Software techniques were used as mentioned previously to copy all the functional code from ROM to RAM This in effect allows the main FLASH memory to be switched off h nce reducing the current consumption of the MCU In addition the MCU on both the Tx and Rx module were set to their respective low power modes therefore further reducing the current consumed The testing phase of this report covered all the aspects required outlined in the product specification in chapter 1 This involved testing the current consumption of the Tx and Rx modules the reliability of the RF link between them their size weight and dimensions It was found that the current consumption for the Tx module was similar to what was expected with a value of 2 48mA4 By using the additional software technique where the functions were copied and operating in RAM it proved to be even more successful by reducing the minimum operating Voltage for the module to as low as 2V which is the requirement for the operation of the RAM This technique could not be utilised on the Rx module due to the 5V receiver unit and MCU implemented hence it was found that the current consumption was a much greater value of 5 8mA compared The antenna for the modules proved to be the main factor affecting the reliability of the
79. n the typical operational environment Clement Y L Pang 35 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase 67 5 amp 12 KHz signal Similar to the test for the transmitted and received signal two signals 5 and 12 KHz were used for the buzzer tone and ensured they were working correctlysby using the digital oscilloscope Figure 26 on the left indicates the 5 KHz signal captured Two gt different audible signals were used because it was found that when_a single signal was implemented the direction of the signal was difficult toArace This is due to the ear becoming comfortable with a single signal leading to difficulty in tracing it 2 00 V 10055 Chi Z 0 00 H SSeS Figure 26 5 KHz buzzer signal Hence another signal was utilised to counteract this property that made the results below possible In order to test if the implemented buzzer fits the description above a simple test was performed by blind folding a candidate and placing the receiver at different positions and distances to see whether the candidate could point out the direction of the receiver Table 6 shows the results obtained The results illustrates the success of the buzzer Distance m Accuracy range i m of target while using different signals instead of a single 5 lt 1 5 KHz tone 10 lt 1 15 3 It also shows that the accuracy deduces the 20 8 greater the distanc
80. nal void unsigned int pause char lcd char 26 lcd new char 1 test test 0 P2 0x01 l 4 Switch Sub clock OFF and main clock ON 1 0 01 Unlock Protect CMO 0 0 Set Xin generation 0x00 Relock Protect for pause 0xFF pause 0 pause Software wait to stabilise sub clock 0 01 Unlock protect CMO 0x50 Set Xin as system clock CMO 0x40 Switch off the sub clock CMO 0 48 Set high drive capacity PRCR 0x00 Relock protect 1 printf2 E 2J E HTest Demo for RF SMS Version 0 1 n n printf2 Final Year Project RF based Child locator n printf2 Programmed by Clement Y L Pang n printf2 Supervisor Kate Williams n n printf2 Please enter 26 character message n n while SW1 1 Clement Y L Pang 60 Microcontroller based directional transducer for child location Appendix C Software Listing if U1C1 3 0 amp amp 1 26 led new char UIRBL if Ilcd new char gt amp amp led new char lt Z while U1C1 1 0 Wait if the buffer is full U1TBL led new char Send the next character led char i led new char i if i gt 26 printf2 E 2J E HCOMPLETE READY TO SEND n for i 0 1 lt 2
81. nimal Operating at 5V Vcc the buffer component draws a total of which is more than any other component on the board As a result the buffer was removed from the module and new calculations were made for the overall current consumption illustrated in section 6 2 2 6 1 3 Tx and Rx Antenna Utilising the onboard PCB track as the antenna for the modules proved extremely unreliable at distances greater than 2 meters therefore a simple 17cm wire was implemented to provide the necessary reliability and range A Spectrum Analyser set to a frequency of 433 9 MHz was used to capture the signal strength for the transmitter and hence to prove which antenna was the most effective solution The following figures demonstrate the results taken from the spectrum Analyser for each solution Clement Y L Pang 26 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase a Figure 18 Prototype received signal Figure 18 shows the signal strength received by the spectrum analyser for the prototype board reached a value of 38 41dBm which in turn is approximately 0 1u W in power using a dBm to watts comparison table in Appendix G Figure 19 PCB Track antenna signal With the same test performed with the PCB track as an antenna figure 19 shows the results obtained It canybe seen that the signal strength of 58 51dBm 0 001u W is comparatively a lot smaller th
82. nt three times The software then checks if the button is still down and the LED creates effect Upon release the main clock is again switched off and the diagnostic function as called to check the battery status please refer to section 5 2 3 Once complete and returned to the INTO function the code returns to the sleep mode function awaiting the next button press to occur 5 3 Receiver Source code To help comprehend the code written for the receiver module the following block diagram figure 17 illustrates the full operation of the functions described below 5 3 1 Main Function Similar to the main function of the transmitter this main function also copies all the ROM functions into RAM including the interrupt vector table Once complete it calls the receiver main function located 5 3 2 Rx main function The operations within this function are again similar to that of the transmitter where all the relevant ports ISR are set and configured The main difference between the receiver and transitter source codeus the additional timer used to call the buzzer function 5 3 3 Diagnostic function The purpose ofauthis function is to detect the analogue voltage and to determine whether the battery status 15 classified as low by comparing it to a predefined value as calculated below When Vcc 7 Vieg 4 96 V divider 3 83V Each digital value 4 96 2 19mV Recommended digital threshold in de
83. ntf2 char extern char low battery Clement Y L Pang 63 Microcontroller based directional transducer for child location Appendix C Software Listing Receiver XCL file LNKMI6CY XCL Example file to be used with ICCMI6C This file shows a set up for the near memory model where there is no ROM in the default near area Read farconst htm for more information on how on chip ROM can be used Usage XLINK your file s f Inkml16cy IMPORTANT Use a COPY of this file and if needed customize for your own purposes Id Inkm16cy xcl 1 10 2001 05 16 11 09 01 John Exp l Defines used by m16c xcl all values are in hex customize according to your specific derivative Stack sizes D_USER_STACK_SIZE 200 D_INTR_STACK_SIZE 40 Change this to the starting address of your internal ROM D FAR ROM ADDRESS FA000 First available RAM address D_NEAR_RAM_ADDRESS 400 Bit variables range D_FIRST_BITVAR 2000 8 400 hex D_LAST_BITVAR FFFF Create a 2 byte checksunrusing crc16 This option requires that we fill unused code bytes so we fill with zero 5 1 J2 crc16 Place SEG RAMRX at logical address 700 5 Z CODE SEG RAMRX
84. of OxAA Stop Chi Period 2 496ms Coenai APOLLO LAGE AID D wass k 57101010101 SP ST Start Bit followed SP Stop Bit by LSB followed by MSB SE 200v A Chl 1 36V 19 Feb 2003 ijv 40 0000ys 18 53 21 Figure 24Transmitted 0xAA data Figure 25 shows the same set of datasbeing received from the receiver pin 14 on the Rx module There more transitions as the original signal above is sent 3 times consecutively from the Tx module stop 1 Coupling amp Impedance DC w w AC u p Chie 11 Freq 401 0 2 GND ST01010101 SP DIGITAL DATA 0 2 00 v M4 00ms 7 720mVv Q 05 80 0000ys 1M 50 Coupling Invert Bandwidth Fine Scale Position Offset Probe DC Off Full Hl 0 00div 0 000 V qve Figure 25 Received data Clement Y L Pang 34 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase 6 6 RF Range and reliability Transmitting the signal at various distances tested the RF range of the modules This was then compared against the reliability of the RF link at that distance Transmitting the signal ten times and recording the amount of times the receiver received the signal calculated the reliability of the system The time between transmitting the signal and the receiver receiving the
85. om the president of Wherify Wireless Inc The Wherify Personal Location System includes wristwatch sized device that combines SiRF s SiRFstarll GPS technology along with LSI Logic s Code Division Multiple Access CDMA technology which allows device communication through a national PCS network As a result subscribers of the Personal Location System will be able to quickly determine via a 24x7 location service center accessed through the Internet or by any phone the location of their children elderly parents or other at risk loved ones wearing the device 22 Investigation in location devices To achieve the knowledge Necessary to tackle the project aim a large scale of time was spent researching into the available location devices in the current market place 221 GPS Many current manufacturers have implemented GPS technology due to their major advantages such as its high efficiency to work under any weather conditions precision for object location anywhere in the world its 24 hours a day service with no subscription fees or set up charges The Global Positioning System GPS is actually a constellation of 27 Earth orbiting satellites 24 operation and three extras in case one fails The U S military developed and implemented this satellite network as a military navigation system but soon opened it up to everybody else Each of these 3 000 to 4 000 pound solar powered satellites circles the globe at about 12 000 miles 19
86. p ADCONI1 5 0 Set Vref no connect Set up hardware software interrupts Timers disable_interrupt set interrupt table 0x0640 Set interrupt table address 0x070A Configure ADC for battery monitor ADCON2 0 1 Set with sample and hold function ADCONO 0x80 Software One shot Fad 2 mode ADCONI 0x00 Set as 8bit resolution Configure UARTO UOMR 0x05 0000 0101 8N1 format 0x11 No handshaking f1 8 clock source UOC1 0x00 0000 xxxx Simple mode UOBRG CRYSTAL FREQUENCY 8 16 UARTO_BAUD_RATE 1 Set the baud rate Clement Y L Pang 69 Microcontroller based directional transducer for child location Appendix C Software Listing U0C1 0x04 000x x1x0 Disable transmission enable reception PD6 2 0 1 Set RxDO as an input Configure UART receive interrupt SORIC 0x00 Set Rx to 0 IPL SORIC 0x06 Set IPL to 6 SORIC OxOE Interrupt request enabled Configure Timer TAO TAOMR 0x40 Set TAO as timer mode with for Fe32 CPSRF 7 1 Set reset prescaler UDF 0 0 Timer to count down 2250 1 ISR to occur every 9 9ms 2250 for 2 7 8 TAOIC 6 Set interrupt priority level to 5 Configure Timer 1
87. pent during the project period Clement Y L Pang 1 Microcontroller based directional transducer for child location 1 3 Chapter 1 Initial product specification Introduction The table below Table 1 0 illustrates the product specification for the RF based child locator Features Receiver Rx module Transmitter Tx module RF range MCU Battery power supply Size Weight Speaker Low battery indicator Environmental and physical considerations Cost Multiple modules Diagnostic Test Clement Y L Pang Table 1 Product Specification PHASE 1 Description Low power operation Low power Operation It seems that parents or adults get concerned over their child when in or outdoors with separation of around 20M therefore the maximum range needed must balance the requirements based on the users opinion The pin range is large due to the fact that the system may need additional modules listed in phase 2 Flash memory is preferred asit allows the code in the MCU to be updated i e erased and reprogrammed Minimum of 2 timers maybe used to encode and decode the receiving signal Used in portable equipment such as remote controls lighters cameras etc Typical pocket calculator size except for the depth Minimal weight as the RF modules portable devices Loud audible sound so that it can be heard from max range of 25M without any hearing damage impairment to the child Used
88. r for child location Appendix F M16C User Manual Appendix F M16C User Manual Mitsubishi microcomputers M16C 62A Group Description SINGLE CHIP 16 BIT CMOS MICROCOMPUTER Description M16C 62A group of single chip microcomputers are built using the high performance silicon gate CMOS process using M16C 60 Series CPU core and are packaged a 100 plastic molded These single chip microcomputers operate using sophisticated instructions featuring a high level of instruc tion efficiency With 1M bytes of address space they are capable of executing instructions at high speed They also feature a built in multiplier and DMAC making them ideal for controlling office communications industrial equipment and other high speed processing applications The M16C 62A group includes a wide range of products with different internal memory types and sizes and various package types Features ROM See Figure 1 1 4 ROM Expansion RAM 3K to 20K bytes Shortest instruction execution time 62 5ns f XIN 16MHZ VCC 5V 100 5 THMHZ Vocz3V with software one wait Mask ROM flash memory 5V version s Supply voltage 42N to 55V FUN 16MHZ without software wat Mask ROM flash memory 5V version 2 7V to 55V 10MHZ with sofware Mask ROM flash memory 5V version Low power consumption 25 5mW f XIN 10MHZ wit
89. r friendly for the operator to see the relevant data such as module number diagnostic details power consumption time calendar hence resulting in a more attractive multi purpose device Can also be used to display a menu system for the user to navigate through the different types of functions 14 Summary The aim of designing a complete child locating device opens many doors to the available technologies that can be used to meet the requirements set Examing the objectives outlined the following report will illustrate the approaches taken in order to produce a system that will take advantage of the current technologies In addition it will provide an overall understanding in both the hardware and software implemented The summary listed below concludes the main objectives within this project Introduction 8 digit 14 segment alphanumeric display typically 36 pins Design and build a system that utilises a reliable wireless RF Link between the transmitter and receiver e Write source code for the microcontroller MCU to utilise the o low power features within the MCU o shutdown modes on external components i e transceiver ICs Memory etc e Buzzer circuit to produce an audible signal loud enough for the user to hear o This section will also include software programming e Develop build and test development board and design a Printed Circuit Board for the transmitter and receiver e Design box to encapsulate PCB Clement
90. rget MCU hence the software written allows the program to be fully tested on the development prototype and PCB 5 gt gt 6 software development environment 5 2 Transmit rce code To help understand the transmitter s software operation a block diagram figure 16 shown on the following pag strates each independent function and interrupt service routine ISR used in relation to in function main Clement L Pang 19 Microcontroller based directional transducer for child location Chapter 5 Software Development Main Function Provide vector table for ISR used Copy all ROM functions into RAM Call Tx main function Tx_main Function Diagnostic Function Configure clock to sub Configure clock to 32KHz gt main 2MHz Configure ports Perform ADC registers and interrupts operation Disable FLASH memory lt Test value against Call diagnostic function threshold lt 0xF7 Callsleep mode Light LED if true function Sleep Mode Function Set MCU to Stop Mode INTO Interrupt requested Key Input Interrupt INTO ISR Send data three times Call diagnostic function Figure 16 Transmitter source code block diagram 521 Main function The objective of th main function is to copy all relevant functions in the read only memory ROM to the random access memory RAM This is an important part of utilis
91. ry Rx 9V PP3 Replacement frequency aimed at min 6months Size Max dimensions of Tx 40mm 70mm 20mm 150mm 85mm 60mm Rx 65mm 100mm 32mm Weight Max of 100g Tx 25g Rx 85g Speaker Audible signal of 80dB 85d B from spec Low battery indicator Red flashing Light Emitting Diode LED Achieved in software Environmental and Water proof Shock proof Vibration proof Not encapsulated physical considerations Temp range 10 to 50C Cost Max 50 41 50 PHASE2 Multiple modules Encode signal with unique signature for Data encryption in future each unit Hence a different audible signal development used for each child Diagnostic Test Software based solution to self test the Achieved in software modules to assure that the units are functioning correctly LCD 890101 14 segment alphanumeric display Hardware implemented typically 36 pins limited software written Table 2 Product specification comparison table The following Sections here after will describe each of the specifications separately and how each value for the system is achieved 6 3 System current consumption For portable device it is important that the overall system current consumption can be kept to the minimum one of the most important features that need to be met in order for the system to be commercially viable To measure the current consumption of the transmitter and receiver a standard bench power supply was used to generate the appropriate voltage with a digital m
92. s PO4 D4 54 02 02 br 80 POt D1 e POD Do ame 10 20 13 ate 55 P105 ANG RT2 atte 20 P10s ANS ETT atm 01 P 104 AN A KTo aH P103 AN3 a P102 AN2 2408 48 84 M16C 62A Group 1 8 1 8 ROM Note 1 RAM Note 2 Multiplier 014 8 PCSO 15 ate 13 ate 752 47 tm P47V CS3 ___ 15 atm PSAWRLWR 45 aae P51 WRH BHE 44 ate P52 RD 43 at m P53 BCLK 12 ate P54 HLDA 11 44 38 P5s HOLD 40 ette PSG ALE gt P57 RDY CLKOUT 38 ae PGNCTSVRTSO 17 te 1 1 ate Poz RxDo 35 ae P63 TxD0 ___ 34 ut P64 CTS1FRTS1 CLKS1 33 ut 32 Pes RxD1 311 4 PG TXD1 zz G 54 5 SENKER HE 3343482 4 KAI HI HE EHE pg 2824 Q acto amp 99 T Clement Y L Pang 85 Microcontroller based directional transducer for child location Appendix F M16C User Manual Performance Outline Number of basic instructions 91 instructions Shortest instruction execution time 62 5ns f XIN 16MHz Vcc 5V 100ns 10 2 3 with software one wait Mask ROM flash memory 5V version Memory See the figure 1 1 4 ROM Expansion 3K to 20K bytes Multifunction 16 bits x 5 16 bits x6
93. se Allow software pause for lus ADCONO 6 1 Start ADC conversion now while ADCON0 6 1 Poll for ADC to finish tempvalue ADOL Store value into local variable if tempvalue OxF7 low_battery ON Check if below threshold 2 0 1 else low_battery OFF P2 0 0 Clement Y L Pang 21 Microcontroller based directional transducer for child location Chapter 5 Software Development ADCONI 5 0 Vref disconnected In order for the ADC to operate it requires the main clock therefore at the beginning of this function the main clock is resumed and switched off again at the end This function also provides a test by LED blinking on the board to indicate to the user that the LED is also working 5 2 4 Sleep Mode The sleep mode function is a very simple function that sets the MCU to stop mode by writing to the register CM1 As the MCU is set into stop mode the FLASH memory is automatically switched off and on once it has woken FLASH memory is switched on just before it enters stop mode and off again once it returns Stop mode is utilised to produce minimal current consumption as the MCU alone only draws pA at this state 5 2 5 INTO Interrupt INTO interrupt is configured as an external interrupt or switch press Hence this interrupt is only called when the user presses the switch Once called the main clock is resumed and the RS2322 serial data value 0xAA in hexadecimal is se
94. shaking FXin 8 clock source UOC1 0x00 0000 xxxx Simple mode UOBRG CRYSTAL FREQUENCY 8 16 UARTO BAUD RATE 1 Set the baud rate UOC 0x01 000x xOx1 Enable transmission disable reception 0x03 PD6 3 1 Set as an output Configure UARTO UI MR 0x05 0000 0101 8N1 format U1C0 Ox11 00x1 x100 No hardware handshaking f8 clock source U1C1 0x00 0000 xxxx Simple mode UIBRG CRYSTAL FREQUENCY 8 16 UARTI BAUD RATED 1 Set the baud rate U1C1 0x05 000x x1x1 Enable transmission and reception PD6 7 1 Set TXD1 as an output Configure ADC for battery monitor ADCON2 0 1 Set with sample and holdfunction ADCONO 0x80 Software One shot Fad 2 mode ADCONI 0x00 Set as 8bit resolution Configure Timer TAO OxCO Set TAO as timer mode with 0xC0 for Fc32 CPSRF 7 1 Set reset prescaler UDF 0 0 Count down flag on 1024 1 ISR to occur every second NTAOIC 5 Set interrupt priority level to 5 P2 0x01 enable interrupt diagnostic hyper terminal INTOIC 0x06 Enable INTO interrupt for sleep mode Call function to set MCU to stop mode Function to set MCU into stop mode void sleep mode void unsigned char pause Local variable 0 3 0 Return to normal operation FMRO 1 0 Return to normal mode for pause 0xF pause 0 pause
95. signal was negligible lt 1s therefore it was not of any concern Table 5 below illustrates the results obtained in outdoor open space environment Distance m Reliability 906 Distance continued Reliability continued 1 100 16 100 2 100 17 100 3 100 18 80 100 note 1 4 100 19 80 100 note 1 5 100 20 80 100 note 1 6 100 21 80 100 note 1 7 100 22 80 100 note 1 8 100 23 80 100 note 1 9 100 24 80 100 note 1 10 100 25 80 100 note 1 11 100 26 80 100 note 1 12 100 27 80 100 note 1 13 100 28 80 100 note 1 14 100 29 80 100 note 1 15 100 30 80 100 note 1 Table 6 RF range and reliability results Note 1 Rx was placed in one set p sition whereas Tx was placed in two different positions hence the two values shown on table 6 From distances greater than 17m the reliability of the system is very much dependent upon the Tx and Rx antenna position At the optimum position 100 reliability for the RF link can easily be achieved for distances greater than 30m Hence the results from this test illustrates that the RF link achieved is within the specified product specification Specification Condition Actual results RF range Min 15M and Max 25M Min Om to 30m Placing the Rx module room and transmitting the signal at adjacent rooms lower floor and upper floors were also performed with successful results Hence this proves that the system is capable of transmitting and receiving data i
96. son 6 10 Power Supply The original minimal voltage necessary for the transmitter MCU to operate was 2 4V as stated in the M16C 62N data sheet Taking the additional programming used to convert all the ROM functions into RAM has resulted in a better operating range for the Tx module as the minimum voltage necessary for the system to work now is 2V This is due to the RAM only requiring 2V for it to maintain constant operation therefore even though the battery supply falls below 2 5V the module can still fully function until it exceeds the 2V minimum operating voltage Comparing the actual values from the system resultsyand the initial specification proves that the Tx power supply requirement matches those specified If the Rx module were to contain the 3V devices then the power supply would be th same as the Tx module therefore within range as shown on table 9 Modules Initial specification Actual results Transmitter Tx lt 5V powers pply Range 2V 3 2V coin cell battery module Receiver Rx module lt 5V power supply 9V PP3 battery If using 3V devices then estimated to be Table 10 Power supply comparison 6 11 Cost Analysis Table 10 in section 7 1 summarises the total cost of the complete system which is within the budget range excluding the PCB manufacturing process costs 6 12 Chapter Summary A great deal of time was spent in the testing phase in order to realise whether the final design was feasibl
97. system the transmitter and receiver will be controlled via a microcontroller unit MCU which in turn controls the audible speaker unit and a liquid crystal display LCD With the emphasis of the project being cost effective low power and a complete product at the end of the project it has been essential to achieve a reliable RF communication link between the transmitter and receiver unit as early into the project as possible 1 2 Design limitations Like all portable systems the power consumption physical size and weight must be minimal in order to prolong the battery life and limit its overall weight In order to overcome these issues the required components were preferred to be in Surface Mount Device SMD format which would largely limit the size and weight of the unit Current consumption on the other hand was dealt with by setting the respective MCU and other devices into their low power or shut down modes With a project budget of only 50 cost limitation was the secondary restriction which meant precautions were taken in finding the most appropriate devices Finally the third restriction_was the time limit and in order to produce a satisfactory result at the end of this period good time planning was essential to any project of this scale A lot of time was spent planning ahead keeping to schedule and estimating any contingencies where possible Appendix D shows the initial Gantt chart produced compared with the actual time s
98. t In order to choose the most appropriate distance a simple survey was carried out regarding the distance thesparent and child was apart before they would become concern about their child The results were some what expected with the range around 15 to 30meters Knowing that the receiverysystem was to utilise a buzzer as the core signal for the parent to locate it was sensibl to limit the distance for communication to the boundaries between 10m min to 25m max 2 4 Investigation and research Summary The main aim of this project is to build and design a system to detect the location of a child while keeping the cost and power consumption to a minimum This would have been achieved by utilising aJow power microprocessor and form of wireless communication Knowing that the GPS receivers are extremely precise in outdoor locations while RF communications are efficient indoors it would be sensible to integrate both systems into one Unfortunately GPS receivers are extremely expensive usually around the price range of 63 therefore it would defy the objective of being low cost Consequently a singular simplex one way communication RF solution was implemented Clement Y L Pang 3 Microcontroller based directional transducer for child location Chapter 2 Investigation and Research The modulation scheme for the RF communication was chosen to be amplitude modulation AM and not frequency modulation FM The reason for this is becaus
99. t Final Feasibility Report Hardware Design Block diagram Order components Schmatics Build Tx circuit Build Rx circuit Intrgrate LCD and buzzer Test and evaluate Software programming Pseudo code Tx encoding Rx receiving Diagnostic Software LCD Test debugging and review System review Prototype build Test prototype PCB design Package design Send PCB to manufacture PCB production PCB co Test and evaluate ponent mounting Final boxed product Logbook Write Final project report OCTOBER 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Actual time spent Initial Estimation NOVEMBER 1 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 291 30 Clement Y L Pang Microcontroller based directional transducer for child location Appendix D Gantt Chart 11 12 13 18 19 20 21 22 23 24 25 26 27 28 29 Clement L Pang 77 Microcontroller based directional transducer for child location Appendix D Gantt Chart 2 3 4 5 6 8 FEBRUARY 9 10 11 12 13 14 15 16 17 18 20 21 22 23 24 25 26 27 28 1 2 3 7 8 9 10 11 12 13 14
100. t beso Den 67 Common Files x soos C PHP BARNS aie ae a Galilee 74 Appendix D Gantt Charte Wr ond oot getestet ebat ete dein eee 75 Appendix E 1 Rx and Ix PCB teneret nente nennen 80 Receiver PCB layout naa ete epe eee eb tis onte tel Doe Dd eee 81 Receiver 3 V PCB Aydin Ede EDS epa Ee ene e KRAN ne 82 Appendix E 2 PCB 83 Appendix E MIOC Manual n L hata depict ehe Del deena 84 Pin Configuration and block diagram of M16C 62 A and N device see 85 Performapite Outlifie acere Ue i ede dee ente be taqa 86 Appendix G dBm to watts conversion chart nete 87 Appendix MRNVEN NINE 222 nente teneor ente teen en ettet nnne 88 Clement Y L Pang iv Microcontroller based directional transducer for child location Table L Prod ct Specification aa dani Doo d bred Seek 2 Table 2 Product specification comparison table 29 Table 3 Transmitter module current consumption u nra 30 Table 4 Receiver module current consumption L a
101. the MCU to calculate a low battery indication as a 9V supply would damage the MCU and 5V constant voltage would produce no change in the analogue voltage Consequently a simple voltage divider was used which is the same technique implemented for the transmitter If we use equation 1 again for thisvapplication we get Equation 1 Vout Implies that 5V 9 10000 R 10000 R 90000 50000 5 Therefore 2 80000 or Figure 8 Receiver power supply Clement Y L Pang 12 Microcontroller based directional transducer for child location Chapter 3 Hardware Implementation 3 23 LCD The 36 pin LCD used on the receiver is a 14 segment 8 digit star burst display which means that it can easily display both numbers and alphabets The display is also 1 4 multiplexed with four common lines to control each segment The LCD is purely driven in software with no external drivers but only requires two resistors per common line shown in figure 9 By using the software driven LCD it would reduce the overall cost as no hardwaredriversyare needed would therefore reduce the current consumption The LCD was originally planned to display the following Menu Time Date Calendar Variable Message Figure 9 14 segment 8 digit LCD 3 2 4 Receiver M16C 62A MCU The MCU used for the receiver module is the M16C 62A another one of Mitsubishi s MI6C 3 Diamonds Board family device Similar to that of the M16C
102. the total battery Life is 280mAh 22 4mAh day 12 5 Days Even though the final result shows that the total battery duration is less than the 5V results the main battery supply is 600mA 280mA 320mA less Also the values shown would be the maximum current as the MCU would draw less current then that of the 5V MCU If the same 600mAh battery was used then the total battery life for the 3V system would be 600 22 4 27days over ten days more than that of the 5V system 6 4 Battery monitoring with ADC in Diagnostic feature Low battery indication is a necessity for portable devices as it warns the user when the power supply is low and a battery replacement is needed In order to ensure that the software written for the on board ADC was operating correctly a standard bench power supply was used to supply the modules with the appropriate Vcc The value of Vcc was then slowly reduced until it passed the ADC threshold Once the voltage dropped passed the respective threshold the LED lit up instantly giving the low battery warning This was successfully functional on both the transmitter and receiver boards at the thresholds of 2 5V and 7V respectively hence obtaining the battery indicator specification Low battery Used to warn the users that the unit needs a indicator battery replacement important feature Red flashing Light Emitting Diode LED Diagnostic Test This software based feature will be Software based solution programme
103. type for the application It also must be matched and tuned to the transmitter and receiver To get the best results a designer should have an idea about how the antenna works and what the important design considerations are 13 To reduce the overall size of the length of the antenna and keep an adequate performance level the system antenna was made by creating a track on the PCB whilst preserving the performance by calculating the length of the track using equation 2 below Equation 21 X2 C f 4 where C 230000em s 30000 433 9 4 f 433 9Hz 69 14 4 measured in cm 17 3cm 173mm It would be very difficult to produce a single straight track on the PCB while trying to minimise the module s size therefore the antenna was placed onthe PCB more like a spiral as shown in chapter 4 in figure 10 To improve the efficiency of the aerial it needs to radiate above a copper based ground plane therefore a PCB fill was used in parallel as shown in figure 11 3 2 Receiver Overview Antenna N Power 4 LCD Receiver MCU Serial Buffer Connector Figure 6 Receiver Module block diagram 3 21 Receiver unit Figure 6 shows the key devices implemented in the receiver unit The receiver implemented in the project is RF solutions AM HRR3 433 U4 as shown in figure 7 Similar to that of the transmitter the receiver has many features suitable for the project s specification such as its CMOS TTL output low power consumption an
104. uce size and cost In addition the 3V receiver and MCU should be implemented in order to reduce the size weight and current consumption of the Rx module Another option that can be considered is to use one time programmable OTP MCUs which would also reduce the cost of the system dramatically 7 1 3 Antenna Design The results on the simple antenna used indicated that even though the system can communicate over 30m in distance the reliability is very much dependent upon the antenna Hence further research and design on standard and PCB antenna is required 7 1 4 Data Encryption Providing a safe means of communication is essential therefore preferable software or hardware encryption should be implemented so that the sent data even though known by a third party would not be able to altersthe receiver alarm status as the signal transmitted is not always the same 7 1 5 Product Durability In order to facilitate increased durability of the system encapsulation would be required as discussed in the product specification Standard of the shelf boxes from companies such as Maplin electronics could be used in order to provide a means of protection for the individual modules This would therefore allow the modules to operate successfully under the different environmefts listed in table 1 Clement Y L Pang 42 Microcontroller based directional transducer for child location Reference List Reference List 1 SiRF Press release www sir
105. uctas outlined in the original aim Software Development The objectives of this chapter are to explain and describe the software code written in C for the transmitter and receiver MCU It will provide a guide for all the features implemented such as the low power features ADC battery monitor signal transmission and reception In order to appreciate the software developed an overview of the development environment will also be discussed Testing and specification comparison Phase Chapter 6 evaluates the full performance of the final design in relation to the project s aim and product specification outlined in chapter 1 Conclusion Chapter 7 provides a summary of the major findings of this report and discusses recommendations for further work and improvements that could be implemented to the existing system Clement Y L Pang vi Microcontroller based directional transducer for child location Glossary of terms Amplitude Modulation Analogue to digital converter Clock Complimentary Metal Oxide Semiconductor Direct Current Digital Multi Meter Frequency Modulation Full Scale Voltage Global Positioning System Ground Input Least Significant Bit Integrated Circuit Liquid Crystal Display Light Emitting Diode Interrupt Service Routine Inter Symbol Interference Microcontroller Unit Most Significant Bit Output Printed Circuit Board Radio Frequency Random Access Memory Read Only Memory Receiver Supply
106. ulti meter DMM placed in series to display the total current drawn Clement Y L Pang 29 Microcontroller based directional transducer for child location Chapter 6Testing and Specification comparison phase 6 3 1 Transmitter module Table 2 below indicates the results obtained from using the method described above Voltage Supply Current consumption Current consumption V Standby mode mA Transmit mode mA 3 0 2 48 8 2 8 2 18 7 2 2 6 2 6 5 2 4 1 87 5 6 2 2 1 71 4 9 2 0 1 55 4 3 Table 3 Transmitter module current consumption The following calculations illustrate the theoretical battery life for the complete transmitter unit if the module had a 5 hour on period used 5 times with a transmit duration of 5 seconds Capacity of 3V coin cell battery 280mAh Transmitter board when in standby draws 2 48 from table 2 Total average battery life using is Equation 3 Etotal Estanaby Esa Eor Where Estandby 5hours 2 48mA 12 4mAh Where Esena 5sec 5events 8mA 5sec 5events 8mA Ihour 3600sec 0 2 1 3600 0 056mAh Where 24day 5hour OmAh Therefore Eja s 12 4 0 056 0 12 456mAh 12 5mAh Hence the total battery Life is 280mAh 12 5mAh day 22 4 Days Assuming that the transmitter is switched on only when the user wants to transmit the signal then the average total battery life would be as follows From Equation 3 Estandby Esena Eo
107. ve position of the satellites at any given time Ideal satellite geometry exists when the satellites are located at wide angles relative to each other Poor geometry results when the satellites are located in a line or in a tight grouping 2 2 2 Indoor location system The first indoor location sensing system was the Active Badges developed by AT amp T Cambridge This system consisted of an infrared beacon worn by every person that was used to emit a globally unique identifier every 10seconds The signal is received by an IR receiver which in turn transmits the data to a central server where the information is converted into useful data Therefore this solution is purely for indoor purposes only 2 2 3 Radar and Sonar Other wireless solutions for object location include Radar and Sonar These solutions are not appropriate for detecting the location of child as Radar is unable to detect the exact location of an object but only its radial speed factor hence its commercial use is in motorway speed cameras Sonar on the other hand is mainly used to detect objects underwater such as submarines vessels etc Sonar works byssending sound energy through a medium i e water and if an object is detected the signal is then reflected back to the transducer hence providing the range information through additional calculations 2 3 Required RF Distance The maximum distance that a pair of RF modules can communicate is different from product to produc
108. w software pause for lus ADCONO 6 21 Start ADC conversion now while ADCONO 6 1 Poll for ADC to finish tempvalue ADOL Store value into local variable if tempvalue OxDO battery ON Check if below threshold 2 0 1 else low_battery OFF Clement Y L Pang 71 Microcontroller based directional transducer for child location Appendix C Software Listing P2 0 0 if low battery ON P2 0 1 ww Switch Sub clock ON and main clock OFF PRCR 0x01 Unlock Protect 0x58 Set Xc generation 0x00 Relock Protect for pause 0xFF pause 0 pause Software wait to stabilisessub clock 0 01 Unlock protect 0xD8 Set Xc as system clock CMO OxF8 Switch off the main clock OxF0 Set low drive capacity 0x00 Relock protect ADCONI1 5 0 Vref disconnected ADCONO 6 0 Disable ADC conversion 24 Timer TAO interrupt to handle receiving data l sa interrupt 21 4 void timer a0 void unsigned int pause 1 1 Declare local variables P0 0 1 Set port high to turn Rx on forGi 0 1 lt OxFF i Set delay for Rx turn on time s a Sw
Download Pdf Manuals
Related Search
Related Contents
"取扱説明書" 64 COMITÉ DE PROYECTOS DE GRADO Acta A Nº.: LÍNEA: 1 Samsung KFRD-72LW/ASF 用户手册 MANUAL DO UTILIZADOR esTUfAs A peLLeTs 取扱説明書 タイヤチェンジスタンド タイヤチェンジスタンド ご使用前に必ず TLB890 folleto - Terex Corporation DH1011 - o Copyright © All rights reserved.
Failed to retrieve file