| Electronic Components Datasheet Search |
|
MAC7200 Datasheet(PDF) 927 Page - Freescale Semiconductor, Inc |
|
|
|||||||||||||||||||||||||||||
MAC7200 Datasheet(HTML) 927 Page - Freescale Semiconductor, Inc |
|
927 / 976 page ![]() Initialization/Application Information MAC7200 Microcontroller Family Reference Manual, Rev. 2 Freescale Semiconductor 849 be rather inefficient, and can not easily be programmed into a DMA. The next example illustrates how to use the Pin Data Register (PINDATAxx) to overcome these two disadvantages. NOTE The PINDATAxx register is simply a "mirror" of the corresponding bit in the PORTDATA register. Therefore writes to the PORTDATA register will change the read value of a PINDATAxx register, and vice-versa. Example 34-4. Disable the IIC and use its two pins as general purpose inputs In File registers.h: #define PIM_BASE_ADDRESS 0xFC0E8000/* Example only ! */ /* Following example assumes ’char’ is 8-bits and ’short’ is 16-bits */ volatile unsigned short *CONFIG_B0 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x0040); volatile unsigned short *CONFIG_B1 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x0042); : : volatile unsigned char *PINDATA_B0 = (volatile unsigned char *) (PIM_BASE_ADDRESS+0x0064); volatile unsigned char *PINDATA_B1 = (volatile unsigned char *) (PIM_BASE_ADDRESS+0x0065); In File main.c: #include "registers.h" : : /* Initialize Port B */ *CONFIG_B0 = 0x0000;/* GPIO Mode: Input, No interrupt */ *CONFIG_B1 = 0x0000;/* GPIO Mode: Input, No interrupt */ /* Sample Ports B0 & B1 */ unsigned char value_B0; unsigned char value_B1; value_B0 = *PINDATA_B0;/* Equivalent to (*PORTDATA_B & 0xF001) >> 0 */ value_B1 = *PINDATA_B1;/* Equivalent to (*PORTDATA_B & 0x0002) >> 1 */ Like the PORTDATA register, writes to the PINDATA registers for input pins have no effect (other than to set the corresponding bit in the PORTDATA register). Therefore, it is possible to use a DMA to drive multiple pins, even though the pins may not be contiguous (i.e.-Pins B0-B3 and B5-B8). Conversely, reads from the PINDATA registers for output pins will simply return the value of the corresponding bit in the PORTDATA register. The next section illustrates how to use a DMA with trigger capability to implement periodic protocols (such as PWM) on the GPIO ports. 34.8.2.2.3 Using a DMA As seen in the previous section, it is relatively easy to drive or sample multiple pins without the need for mask or shift operations, using the PINDATAxx registers. This allows the use of a DMA to copy entire tables of data from/to several pins at a time. In addition to standard DMA operations, the Port Integration Module also supports the use of DMA triggers to perform periodic copies of data, allowing you to easily implement protocols such as Pulse Width Modulation. For more details on how to setup and configure DMA triggers, please refer to the section covering the DMA Channel Mux. In general, the procedure is as follows: 1. Configure the Port Integration Module 2. Configure the DMA to copy tables of data from memory to the Port Integration Module |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |