The research purpose of intelligent adult diaper.paper-based incontinence supplies equipment is to conduct a series of analysis behaviors through the collected data to regularly detect the user's physical condition. Therefore, as an embedded device, the product must rely on wireless data transmission in order to be convenient to use, which brings a question to developers: how to design the program?
In the communication of the microprocessor, in addition to the above-mentioned SPI communication, the UART also often outputs data to the host computer to observe and process the data. In ADUC834, the working mode of UART is mainly selected through the SCON register, and the sending and receiving of the serial port can be controlled by writing the corresponding code. In this design, mode 1 is selected, that is, an 8-bit data frame, and the baud rate is variable. It should be noted that the external crystal vibration of the microprocessor is 32.768kHz, which can only be used by multiplying the frequency to 12.58mHz through the PLLCON register.
Among them, SMOD is the multiplication of the baud rate, which is set in the register PCON. The setting of the baud rate is mainly to calculate the values of TH and TL in Timer1 through the above formula. The Wi-Fi module is connected to ADUC834 through the serial port. The serial port needs to be initialized before data wireless transmission. The initialization steps of the serial port are as follows:
(1) Determine the working mode and set the TMOD register value;
(2) Calculate the initial value of the timer and load TH.TL;
(3) Turn on the total interrupt. open serial port interrupt;
(4) Start the timer.
After completing the serial port initialization, the serial port sending function needs to be used to complete the data transmission, mainly the read and write buffer SBUF. The program mainly displays the UartsendString function. Using this function, the microprocessor can transmit the AT command set to the Wi-Fi wireless module, complete the initialization setting of the wireless module, and send the detection result to the smartphone terminal by wireless transmission. Command AT+CWMODE= is used to set the Wi-Fi application mode. There are 1.2.3 options for mode, which correspond to Station.AP.AP and Station modes, where AP mode is equivalent to the server providing Wi-Fi hotspots. Smartphones, computers, and other wireless Internet-capable devices can connect to other wireless networks. At this time, the Wi-Fi hotspot is a local area network and does not have the ability to connect with external networks. For example, a commonly used wireless router is an AP; Station mode means that a device with a Wi-Fi module can connect to other wireless networks as a client. In Design, select AP mode.
Command AT+CIPMUX=1 enables multiple connections, allowing multiple devices to connect to the Wi-Fi module; AT+CIPSERVER=1, 1001> command configures the Wi-Fi module as a server, and the port is 1001. In addition, Wi-Fi name and password can be set for convenient client connection and data security. First, the microprocessor serial port is initialized, and the instructions required by the Wi-Fi module are set through the program; after the mobile phone searches for the wireless signal, input the password to complete the LAN connection, and wait for the data of the detection device.
The use of intelligent adult diaper.paper-based incontinence supplies, I believe that with the continuous optimization of software and hardware, the function will continue to increase. It can even reduce healthcare related processes in the form of data.