How to read a pin on S12XE eval board

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

How to read a pin on S12XE eval board

跳至解决方案
1,474 次查看
tomaslukac
Contributor I

Hey folks, I am a little bit struggling trying to read an input pin digital value on evaluation board with MC9S12XEP100 mcu.

I am trying to switch from simple Atmegas to this, but I am really not familiar with using CodeWarrior. Also, The difference between ATmega32 and MC9S12XEP100 is really huge, so that is making learning how to program these even harder.

So, if anyone could help me out, I would really appreciate it. I am not even really familiar with the C code, I am really learning, the only thing I can do right now is some math operations, simple PWM, setting some bits and also some kind of writing stuff on LCD (like, making a simple voltmeter etc.), I do not know how to properly use an interrupt, so please try to explain me this a little bit "primitively". In AtmelStudio, while configuring the pins on my ATmega32, I simply put DDRB (lets use this port because I want use the PORTB on the evaluation board from NXP too). I have chosen pin PB0 as an input (HW button), and pin PB1 as an output (HW LED). By writing a simple code, containing one if, I am simply able to light up that LED by a button on the PB0. So I put in    

if (PINB&(1<<PB0)

    {

      PORTB=0x02;

      }

else

   {

      PORTB=0x00;

   }

and it works. And so please can someone write me, how does the equivalent code for S12XE board MCU look?

Thanks alot.

P.S. I am using CodeWarrior IDE version 5.9.0 which is recommended for this board

标记 (2)
1 解答
1,342 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Tomas,

I recommend you create project with Processor expert on CodeWarrior,

pastedImage_1.png

then  add the component of "BitIO" , then you can refer to the example of "Typical Usage ".

About the detail steps please check the video of attachment .

Hope it can helps


Have a great day,
TIC

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

在原帖中查看解决方案

2 回复数
1,343 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Tomas,

I recommend you create project with Processor expert on CodeWarrior,

pastedImage_1.png

then  add the component of "BitIO" , then you can refer to the example of "Typical Usage ".

About the detail steps please check the video of attachment .

Hope it can helps


Have a great day,
TIC

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

1,342 次查看
tomaslukac
Contributor I

Dear Alice, I must say a big THANKS, because you helped me to understand how the whole processor expert works (like, I mean, the whole concept of which parameters are the used name etc.), so now I can educate myself a lot faster and better I think. 

Again, Thank you very much!

Regards, 

Tomas Lukac

0 项奖励
回复