Input port MC9S12XHZ512

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

Input port MC9S12XHZ512

555 次查看
kdn
Contributor III

I have connected two switch at PP3 and PP2 port of MC9S12XHZ512 microcontroller , I want to read both independently, Can any one provide me code for that using processor expert .

标签 (1)
标记 (3)
0 项奖励
回复
1 回复

444 次查看
lama
NXP TechSupport
NXP TechSupport

Go to Component Library window.

Select Port I/O

Select InputPin

The Component Inspector InpB1:Input pin will appear.

in the roll down menu for Component Inspector select pin you want to use as input: for example PP3_PWM3

In the ProcessorExpert Tab of the project window you will find InpB1.c and InpB1.h (in the generated modules->component modules) which says:

  c file says:        This method is implemented as a macro. See InpB1.h file.

making the file we can see InpB1.h in the InpB1.c file (icon on left top) which presents:

#define InpB1_GetVal() ( \

(bool)((getReg8(PTIP) & 0x08U)) /* Evaluate to port raw data */ \

  )

So when I want to use it and get the value of the pin I will write into a code:

x = InpB1_GetVal(); // get PP3 pin

pastedImage_3.png

Best Regards, Ladislav

0 项奖励
回复