CC2541 Bluetooth Learning-peripheral I/O

Source: Internet
Author: User

Learning Goals: I/O port configuration, master I/O peripheral function and position distribution , register "percfg", "P2sel" and "p2dir".

Front CC2541 bluetooth learning--I/O introduced CC2541 has 21 I/O pins that can be used as general-purpose I/O pins, and can also be used as peripheral I/O pins for ADC, serial, timer and Debug Interfaces . When set to peripheral I/O, it is necessary to place the corresponding register bit Pxsel 1, each peripheral unit corresponds to two sets of selectable I/O pins, namely "peripheral location 1" and "Peripheral location 2" as shown in the following table.


from the table we can see that the entire P0 port can be used as an ADC , so you can use up to 8 ADC input pins, but only one pin ADC at a time, and the P0 PIN must be configured as an ADC input. The apcfg register can be configured with one of the pins of the P0 as an ADC input (analog input function), the corresponding position 1 is the ADC input function, the default value of this register select port 0 pin is non-ADC input, that is, digital input/output; Both serial USART0 and USART1 have two modes: asynchronous UART mode and synchronous SPI mode , and the corresponding peripheral pin has two positions in each mode;  Timer 1 has 5 capture/compare channels; Timer 3 and timer 4 each have 2 capture/compare channels; The ports P2.1 and P2.2 can be used for debugging data and clock signals respectively , and when in debug mode, the debug interface controls the direction of these pins and disables the pull-up and pull-down on those pins. The selection of peripheral I/O locations is controlled using register percfg , and the PERCFG register is defined as the following table. The location of the peripheral can be selected according to the PIN resource allocation of the specific circuit, e.g. setting the serial port USART0 to position 1percfg &= ~0x01; we can see from the distribution of I/O peripheral locations that some of the I/O locations overlap, and we can set the priority by register P2sel and P2dir , which are described earlier as the I/O function for selecting port 2 pins (general-purpose I/O or peripheral i/ O) and direction (as input or output), because the P2 port has only 5 pins, the remaining register bits have been fully utilized, it seems really not wasted ah! The P2sel Register is primarily used to prioritize port 1 peripherals, the P2DIR register primarily sets the priority of the port 0 peripheral and does not have a priority setting register for Port 2 because the PIN function of port 2 is relatively single. The two registers are defined as follows.  

CC2541 Bluetooth Learning-peripheral I/O

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.