| Electronic Components Datasheet Search |
|
MAC7200 Datasheet(PDF) 926 Page - Freescale Semiconductor, Inc |
|
|
|||||||||||||||||||||||||||||
MAC7200 Datasheet(HTML) 926 Page - Freescale Semiconductor, Inc |
|
926 / 976 page ![]() Initialization/Application Information MAC7200 Microcontroller Family Reference Manual, Rev. 2 848 Freescale Semiconductor volatile unsigned short *CONFIG_B6 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x004C); volatile unsigned short *CONFIG_B7 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x004E); volatile unsigned short *CONFIG_B8 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x0050); volatile unsigned short *CONFIG_B9 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x0052); volatile unsigned short *CONFIG_B10 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x0054); volatile unsigned short *CONFIG_B11 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x0056); volatile unsigned short *CONFIG_B12 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x0058); volatile unsigned short *CONFIG_B13 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x005A); volatile unsigned short *CONFIG_B14 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x005C); volatile unsigned short *CONFIG_B15 = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x005E); volatile unsigned short *PORTDATA_B = (volatile unsigned short *) (PIM_BASE_ADDRESS+0x0060); In File main.c: #include "registers.h" : : /* Initialize Port B */ *CONFIG_B0 = 0x0080;/* Peripheral Mode */ *CONFIG_B1 = 0x0080;/* Peripheral Mode */ *CONFIG_B2 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B3 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B4 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B5 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B6 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B7 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B8 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B9 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B10 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B11 = 0x0040;/* GPIO Mode: Output */ *CONFIG_B12 = 0x0000;/* GPIO Mode: Input, No interrupt */ *CONFIG_B13 = 0x0000;/* GPIO Mode: Input, No interrupt */ *CONFIG_B14 = 0x0000;/* GPIO Mode: Input, No interrupt */ *CONFIG_B15 = 0x0000;/* GPIO Mode: Input, No interrupt */ /* Technically speaking, the above four lines of code are not necessary because the reset value of all CONFIG registers is 0x0000. They are shown here for the purposes of illustration. */ /* Sample the 4 input pins */ unsigned int value; /* Mask out bits 0-11 and shift into bit positions 0-4. It is necessary to mask bits 0-11 because a read from PORTDATA on output ports will return the value of the bit in the PORTDATA register */ value = (*PORTDATA_B & 0xF000) >> 11; /* drive the 10 output pins */ /* Shift our desired value ’0x3FF’ into bit positions 2-11. It is not necessary to mask out any other bits (i.e.-bits 0-1 and 12-15) because writes to pins in GPIO Input or Peripheral Mode have no effect. However, these writes do change the value in the PORTDATA register, and therefore will be reflected in the next read of the PORTDATA register. */ *PORTDATA_B = 0x3FF < 2; 34.8.2.2.2 Driving/Sampling Individual Pins As can be seen from the above example, when using the PORTDATA register, it becomes necessary to perform mask and shift operations when sampling or driving data. For smaller numbers of pins, this can |
|
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 |