#define data gpio_pdor<<17 is not working ,can any body know other method
Hi sreenath,
please, what do you want to exactly do with the macro?
Access to read, write, toggle??
Thank you,
Best Regards,
Iva
i need to read and write to the port pin .
You didn't mention what part you're using so I don't know which physical pin you're trying to control, but as an example:
GPIOA_PDDR |= (1 << 17) //makes the pin an output by setting bit 17 of the data direction register
GPIOA_PDOR |= (1 << 17) //drives bit 17 high
GPIOA_PDOR &= ~(1 << 17) drives bit 17 low
If you're using it as an input:
GPIOA_PIDR &= ~(1 << 17) //enables input
if(GPIOA_PDIR & (1 << 17))
{
/*do something if bit 17 is high
}
Is PortE within GPIOA on the processor in question?
Earl,
small error. Just replace port A to port E.
So:
GPIOE_PDDR |= (1 << 17) //makes the pin an output by setting bit 17 of the data direction register
GPIOE_PDOR |= (1 << 17) //drives bit 17 high
GPIOE_PDOR &= ~(1 << 17) drives bit 17 low
If you're using it as an input:
GPIOE_PIDR &= ~(1 << 17) //enables input
if(GPIOE_PDIR & (1 << 17))
{
/*do something if bit 17 is high
}
Best Regards,
Iva
I only asked because I found out in the last question(!) that some Kinetis parts renamed port access so that 8-bit-ports DBCA are in GPIOA, HGFE in GPIOB (etc.). The original request actually mentions PIN 17 (on some unspecified package), and maybe that is what they meant, not Bit 17 (although the <<17 led us all to that belief!).
Hello Earl,
yes, you probably think this article. There is difference for KE family.
You can also find it useful the thread about blinking LED for K40
But sreenathreddy does not tell us what MCU is using.
Best Regards,
Iva
Yes, definitely correct.
Best Regards,
Iva