This article is based on a week CC2541 notes summary
Suitable for overview and quick index of knowledge--
All Links:
Intermediate Tutorial-osal Operating system \osal operating system-a preliminary study of experimental osal
"Insert" sourceinsight-Engineering Establishment method
Intermediate Tutorial-osal Operating System (Osal System solution basic routines)
Intermediate Tutorial-osal Operating system (learn more about-oled && normal keys and 5-directional buttons-interrupts!!!) This system drive layer is not the same as the application layer ~
Intermediate Tutorial-osal Operating system (adc-photoresistors)
Osal Operating System-experiment 16 serial port baud rate extension
Osal operating system-experimental at command preliminary
Osal operating System-experimental 20 simulated IIC communication + hardware IIC (Mpu6050)
Osal operating system-experimental PWM output (change duty duty)
Osal Operating System-Lab 24 watchdog Wachdog
Osal operating System-experimental SNV internal flash data Read and write
Osal Operating System-experimental 29 system sleep level study
Osal Operating System-experiment 31 slave broadcast power modification
First, adc-photoresistors
- Light Dark time resistance value of up to 500K, measured P07 terminal voltage of about 0.5V;
- Light is very bright is the resistance value of only more than 1k, measured P07 terminal voltage of about 3.0V.
Photoresistors ADC Sampling
Simplebletest.c167 line, set AVDD as the reference voltage, that is, 3.3V.
168 lines, 12-bit ADC sampling for AIN7 (i.e., P0.7).
178~185 Line, the sampled data to the linear conversion operation, converted to a voltage value, and displayed.
Second, serial port baud rate expansion (16)
There are only a few baud rates after the stack is installed , which is not used in post-write applications, and this section implements the baud rate extension to support more baud rates.
In the Hal_uart.h
Inside the red box is our added baud rate macro definition .
In the _HAL_UART_DMA.C
512~514 line, add judgment , according to the following (see CC254X Data Sheet p167 page):
How to use new baud rate?
In the Npi.h:
87 lines, modify the macro definition in the red box, you can use the new baud rate, for example,
hal_uart_br_115200
Modified into
hal_uart_br_1200
Then, the system will use a baud rate of 1200, so the serial assistant also needs to be set to 1200 baud rate.
not finished ~ Follow my cc2541 categories
3, CC2541 Chip Intermediate tutorial-osal operating System (ADC Photoresistors and modified serial port baud rate)