Configure multiple I/O pins in same port by PE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configure multiple I/O pins in same port by PE

713 Views
rabbit
Contributor III


In my project, the pins in one port require different function, for example:

PTA2 --- Input, will causing interrupt at falling edge.

PTA3 --- Input, will causing interrupt at rising edge.

PTA5 -- Input, require capture pulse width (This require Timer)

PTA8 -- Input, only for sampling H/L.

PTA10 ---Output, Do PWM (This maybe require Timer)

PTA12 --Output, H/L for control only.

I this case, how to use PE to configure?

There are lots of I/O pins in my project, it will be very mess if I use PE to configure one pin each time.

Regards

Sam

0 Kudos
2 Replies

231 Views
BlackNight
NXP Employee
NXP Employee

Hi Sam,

I recommend that you use BitIO. Even if you think this is not what you want.

Well, you have other options too:

- there is BitsIO (or BitsIO_LDD) to configure multiple pins

- there is init_GPIO which just initializes the pins.

Regards,

Erich

231 Views
Petr_H
NXP Employee
NXP Employee

Hi Sam,

In the current versions of Processor Expert, the selection of component depends on the MCU family.

On Kinetis and new 56800 DSC's like MCF56F827xx  it's recommended to use LDD - Logical Device Drivers, which is a latest generation of components. These components have more possibilities are more optimized. On older families like HCS08 and HCS12 these are not available so you'd use  components called "high level", e.g. BitIO / BitsIO. The BitIO is available also on the Kinetis platform for compatibility purpose.

So, regarding your example if you are using Kinetis:

For PTA2,3,8,12  you can use one GPIO_LDD where you elect PTA as a device. You can define individual pin groups with one or more pins.  This component also allows interrupt event selection for each pin. The interrupt code calls OnPortEvent event callback function where you can write your code and don't have to care for interrupt flags.

If you prefer simple individual bit access, you can also use BitIO_LDD components for each of the bits.

For capturing pulse width, there is CaptureLDD component.

For PWM there is PWM_LDD component available.

Let me know if my assumption is correct or you are using different platform than Kinetis.

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos