【正文】
The main control MCU choose HCS08series of low power, high performance microprocessor MC9S08GB60. The processor has a 60Application of KB programmable Flash 、 4 KB RAM,10 ADC,8 channel2 asynchronous serial munication interface ( SCI ),1 synchronous serial interface ( SPI ) and I2C bus module, can fully meet the requirement of vehicle gateway and node processor requirements. MCl3192and MC9S08GB60hardware connection MC13192and MC9S08GB60 hardware connection diagram as shown in figure 2. The MC13192control and data transmission on 4 wire serial peripheral interface ( SPI ) is pleted, the4interface signals were MOSI, MISO, SPICLK. The main control MCU through the control signal exiting sleep mode or hibernation mode, through to reset the transceiver, through the RXTXEN to control the data sending and receiving, or force the transceiver into idle mode. The sensor output analog signal through MCU 8 Channel10 bit ADC conversion input to MCU. MCU via SPI MC13192to read and write operation, and the sensor to collect the signal processed by MC13192launch out. The MC13192 interrupt IRQ interrupt register through the pins and to judge the type of interrupt. MC908GB60 pin to control the MC13192 into a different mode of operation .Control of the sensor signal from the MC13192receiving antenna in, transmitted via SPI to MCU, after MCU judgment after processing through the GPIO port is transmitted to the sensor, plete control of the sensor. At the same time, MCU MC13192transceiver control and the MAC layer operation. The 3system software design overall software design The software design is the design of the core, the key lies in the overall framework of software and data structure design. An important factor to consider is a efficiency, another is to design the clarity. System software consists of the gateway node and the sensor node is posed of two parts, the two parts are needed to plete the SMAC protocol transplantation, and according to the different needs for the upper munication applications with API interface function. Because the SMAC protocol stack programming model using hierarchical design, only the underlying PHY and MAC program level and related hardware, and work layer and application layer procedures is not affected by hardware effects. SMAC in different hardware platform transplantation only need to modify the PHY and MAC layer, each layer can shield the hardware differences directly run. As shown in Figure 3, the design of the software for system platform layer, protocol layer and application layer 3layer. At the same time, defines 3API interface: system layer interface, protocol layer and application layer interface. System level interface defines a hardware register mapping, so C language to be able to directly access the hardware registers to control hardware. System platform based on realtime operating system μC/II protocol layer, to provide system services Hardware driving module provides the hardware driver, all of the hardware control through the module to provide services. Platform layer protocol layer interface protocol layer to provide services. Protocol layer is based on the IEEE physical layer and link layer based on the ZigBee work layer protocol. Application layer through the application layer interface to invoke services provided by the protocol layer, work management and data transfer tasks. Application of configuration module can call protocol layer to provide work services, will direct the system configuration and query, it is mainly through the AT mands to achieve, so the module calls the application layer interface and protocol layer interface to provide services. node software design Based on the longterm use of the functional requirements, sensor nodes in the software design is the key to achieve the required functions, and can minimize the energy consumption of the sensor nodes. It was found, ZigBee module and the energy consumption is much larger than the central processor and the energy consumption of sensor module. Therefore, the sensor node design of application software to try to make each module in a dormant state, and minimizing wakes ZigBee module number. Therefore, the sens