Easy Program for light blinking!?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Easy Program for light blinking!?

830 Views
CIA_MAN275
Contributor III

Hello!

 

I need a program for my DEMO9S12XEP100 Board. I want, that a light is flashing. PA3 for example.

 

Can you please give me such an easy program? I want to learn with this program, how my board works.

 

Thank you very much!

 

Best regards!

Labels (1)
0 Kudos
Reply
3 Replies

593 Views
vishaka_maithil
Contributor I

hi,

 it is very easy and if u hv  a demokit with u ,  u can get the demo program that has light (LED) blinking . You did not even mention the delay for blinking the led. Anyhw, below is the program with a small delay that will on and off ur led connected to portA.

 

#include <hidef.h>

#include "derivative.h"

 

void delay(void);

 

void delay(void)

{

unsigned int i;

for(i=0;i<40000;i++);          

}

 

void main(void)

{

DDRA= 0x0F;  //to make lower nibble of PORTA as output

a:

PORTA_PA0=1;

delay();

PORTA_PA0=0;

delay();

goto a;

}/*end of main*/

 

All the best!

0 Kudos
Reply

593 Views
CIA_MAN275
Contributor III

Thank you a lot! It works great! Now I have a little bit more knowledge on how my new microcontroller works! :smileywink:

 

Before this one I had the HC12.

 

THX!!!

 

0 Kudos
Reply

593 Views
vishaka_maithil
Contributor I

Fine. All the best!!!!

0 Kudos
Reply