Dear 文星 马,
I´m not sure what you exactly mean.
GPIO signal Descriptions is described in following table, page 678
If you mean GPIO/FGPIO register bits assignment, please go to Reference Manual for KE06, page 679
I hope the information help you,
Hello fan xy,
please, try it by this way:
GPIOB_PDDR |= GPIO_PDDR_PDD(1<<1); //PTB1 as output
GPIOB_PCOR |= GPIO_PCOR_PTCO(1<<1); //set PTB1 to log0
You can also invite drivers and examples (for gpio), which can help you.
I hope it helps you,
Thank for your reply !
Maybe i did not say clearly.
I know this two instruction is to configure the gpio direction and data. While i want to know how to configure the pin to GPIO fuction.
For example "PTB1" pin, this pin can be used to "UART0_TX" "ADC0_SE5" or "GPIO" function,
and how to configure it to "GPIO" or "UARTO_TX" .
Well, now we're showing my general lack of familiarity with the KE06 in particular. But downloading the manual MKE06P80M48SF0RM.pdf, section 10.2.1 details which 'alternate zero thru seven' will select for a pin, the first paragraph of which has this statement:
The Port Control Module is responsible for selecting which ALT functionality is available on each pin.
I assumed that was TRUE, and hence my prior suggestions.
That being said, I SEE YOUR POINT -- chapter 11, Port Control, makes NO mention of such Port Control Registers (as I use in the 'K' family).
It appears that for this family SOME control is REALLY in the SIM_PINSELx registers (12.2.4&5). But I'm afraid I have to agree with you on this one! It is NOT obvious how this works. In the table on page 141, PTB1 can serve as PTB1, KB0_P9, UART0_TX, and ADC0_SE5 (default). So I can see how UART0PS can move UART0 'away' from PortB (although i DON'T see how you keep UART0 from taking ANY I/O pins, maybe if it is not 'clock enabled'?), but that can't POSSIBLY be the whole story!
SO, I have to 'bow out' on being ANY HELP AT ALL (SORRY!), and we need to find someone more familiar with KE to help!
The pins usually default to GPIO functionality. In the example you give where you have UART and ADC pins shared with GPIO, turning on the UART transmit enable or receive enable bits then use the pins that are assigned for that purpose. In the case of the ADC, turning on the ADC channel enable bits assign those pins to the ADC. I'm not sure who wins if you have more than one function turned on, but having experienced the ADC taking control of a pin used for a SPI clock, all I can say is watch out for conflicts with pin functions.
Do NOT |= to PCOR. Read always returns zero, so read-modify-write (to 'or in') is a waste of code&time.
But more to the apparent question, pin function is configured in the pin-mux control, so Port Control needs to select GPIO function, generally Alternative #1:
PORTB_PCR1 = PORT_PCR_MUX(0x1); //Select PTB1 as GPIO, might also add any OTHER configuration options for this pin!