3, CC2541 Chip Intermediate tutorial-osal operating System (ADC Photoresistors and modified serial port baud rate)

Source: Internet
Author: User

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 .


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,
Modified into
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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.