How to use Port C and D as general purpose I/O

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to use Port C and D as general purpose I/O

跳至解决方案
1,934 次查看
adonisk
Contributor I

Hi, I'v very new on freescale, now I'm using S12X chip and I want use port c and d to control some LED.

 

but port C and D in S12X is using for EBI in default.

It's said: When not used with the alternative function, these pins can be used as general purpose I/O.

 

My question is: how to disable EBI and use port C D as general I/O?

 

Please show me code if possible.

 

Thank you for you reply.

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,748 次查看
RadekS
NXP Employee
NXP Employee

Hi Adonis,

External bus is 2nd Functionality (See Table 1-9. Pin-Out Summary).

When pins are not used with the any of alternative functions, these pins can be used as general purpose I/O.

So, you can use Port C/D as GPIO until you enable XEBI module. XEBI module could be used (is enabled) only in expended or emulated modes.

So, if you will use your MCU in normal or special single chip mode (MODA=MODB=0), you can use Port C/D only as GPIO.

For direction of port C/D, please use DDRC/DDRD registers. You can read/write value trough PORTC/PORTD registers.

Unfortunately ports C and D do not provide such high flexibility as other ports. You can just enable pull-ups (pull-down is not possible) and these pull-ups could be enabled only for whole port (we cannot choose which pins will have pull-ups). For more details, please check PUCR register.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,748 次查看
adonisk
Contributor I

I'm using XEP100 by the way.

It's said like this on Reference Manual:

2.4.3.3 Port C, D

Port C pins PC[7:0] and Port D pins PD[7:0] can be used for either general-purpose I/O with the external

bus interface. In this case Port C and Port D are associated with the external data bus inputs/outputs

DATA15-DATA8 and DATA7-DATA0, respectively.

These pins are configured for reduced input threshold in certain operating modes (refer to S12X_EBI

section).

But I never found any information how to config it as general-purpose I/O within chapter S12X_EBI.

0 项奖励
回复
1,749 次查看
RadekS
NXP Employee
NXP Employee

Hi Adonis,

External bus is 2nd Functionality (See Table 1-9. Pin-Out Summary).

When pins are not used with the any of alternative functions, these pins can be used as general purpose I/O.

So, you can use Port C/D as GPIO until you enable XEBI module. XEBI module could be used (is enabled) only in expended or emulated modes.

So, if you will use your MCU in normal or special single chip mode (MODA=MODB=0), you can use Port C/D only as GPIO.

For direction of port C/D, please use DDRC/DDRD registers. You can read/write value trough PORTC/PORTD registers.

Unfortunately ports C and D do not provide such high flexibility as other ports. You can just enable pull-ups (pull-down is not possible) and these pull-ups could be enabled only for whole port (we cannot choose which pins will have pull-ups). For more details, please check PUCR register.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
1,748 次查看
adonisk
Contributor I

You are correct!

Thank you RadekS, you did great help, I do appreciate for you.

0 项奖励
回复