Adrian Tutaj

Programming MC9S12NE64

Discussion created by Adrian Tutaj on Jan 12, 2009
Latest reply on Feb 5, 2009 by Daniel Lundin
Hi, I need some help with transferring code which was written for Boarduino to my freescale MC9S12NE64. This code lights up a diode when 'M' is send to microcontroller and doesn't when 'N' is being send. I send it with python script via USB. My diode is connected to PL0, PL1 and PL2 outputs and it is RGB diode. Here is the code that I am talking about: int outPin = 12; // Output connected to digital pin 12 int mail = LOW; // Is there new mail? int val; // Value read from the serial port void setup() { pinMode(outPin, OUTPUT); // sets the digital pin as output Serial.begin(9600); Serial.flush(); } void loop() { // Read from serial port if (Serial.available()) { val = Serial.read(); Serial.println(val); if (val == 'M') mail = HIGH; else if (val == 'N') mail = LOW; } // Set the status of the output pin digitalWrite(outPin, mail); } Pleas help me quick. I know that is silly task for some of you but for me in this moment is quite difficult. Thank you in advance for answer.

Outcomes