AnsweredAssumed Answered

How to read a pin on S12XE eval board

Question asked by Tomas Lukac on May 16, 2017
Latest reply on May 18, 2017 by Tomas Lukac

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)








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