A serial port Bluetooth
A radio communication system
zigbee, wifi, infrared, RFID, Bluetooth ....
Bluetooth serial port, for example, we buy the serial port Bluetooth module, Bluetooth module only need to connect to the on-chip serial interfaces
The data in the form of a Bluetooth module and required to exchange data through the serial port and a Bluetooth module, a Bluetooth module will communicate data to the external via Bluetooth and other Bluetooth devices in accordance with your settings
Bluetooth module through the serial port, Bluetooth communication transmission becomes a serial data transmission
2. Bluetooth module and development board
3. Bluetooth manual
(1) characteristics
(2) configure
Bluetooth module default baud rate is 9600bps
Bluetooth module configuration using the AT command set, a Bluetooth module only when it is not connected to the receiving AT commands
All AT commands to "\ r \ n" end
(3) AT command set
When the Bluetooth module and other Bluetooth devices, Bluetooth module enters the transparent mode no longer receives any AT commands
Bluetooth module receives data will be sent out via the serial port, serial port to send the data on to be sent via Bluetooth
4. The communication between the two Bluetooth module
(1) Set the master mode wherein a Bluetooth module
Send AT command: AT + ROLE1
Module returns: OK
(2) the main mode of the Bluetooth module can go to search for other Bluetooth devices
Send AT command: AT + INQ
Module returns:
(3) connect to the specified number of modules
Send AT command: AT + CONN0 ------------ connector module number 0
Module returns:
(4) after establishing a connection enters the transparent mode, two Bluetooth module can communicate
II. Watchdog
1. Background
In the single-chip embedded system consisting of, due to the uncertain environment in which to work, it is possible to receive external electromagnetic interference / extreme temperature and humidity. Causing various registers internal processor / memory data corruption,
Resulting in microcontroller program execution error, let the program run or fly into an infinite loop. Embedded system does not work, the entire system to a standstill, resulting in unpredictable consequences.
The watchdog is used it must above problems. The watchdog is essentially a timer, can periodically view the work of the chips, once an error occurs sends a signal to restart (reset) to the chip,
By restarting the system back to normal
Is a watchdog timer circuit, an input signal is generally called the dogs, the role of the timer count is reset, a reset signal is output when the timer expires, sending a reset signal
When the device is working properly, you need to periodically feed the dog within the watchdog timeout period, to prevent the watchdog timer expires, the watchdog generates a reset signal to prevent
Once the SCM program exception (infinite loop / runaway), watchdog not receive the dogs signal, timeout after transmitting a reset signal causes the system to reboot
2.stm32 watchdog
Stm32407 independent internal watchdog, the clock is separate RC oscillator clock, the reigning system clock when the system clock anomalies can still work
3. The independent watchdog programming steps
(1) close the register write protection
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
(2) the watchdog prescale value and the initial count
void IWDG_SetPrescaler(uint8_t IWDG_Prescaler)
void IWDG_SetReload(uint16_t Reload)
(3) an initial count value into the counter (DOG)
IWDG_ReloadCounter();
(4) to start the watchdog
IWDG_Enable();
(5) in the dogs require periodic watchdog period
IWDG_ReloadCounter();
4. Window Watchdog
Watchdog window control program for a specified period of time to perform an action. It is essentially a timer,
Ordinary watchdog can feed the dog at any one point in time within the timeout period, the watchdog can only feed the dog in the window within the specified time
Smoke sensor
The sensor may detect a combustible gas, four feet (power supply (5V) to level output port (DO) analog output (AO))
DO default port high, when the concentration exceeds the limit value, to be low (sensitivity adjusting rheostat), the alarm LED lights
AO analog voltage output port, a voltage value varies with varying concentrations