My Logo & Home Link Answers Coding Examples
Help in Engineering
IT logo & Link

   
 

#include <reg51.h> int index = 0; /*declare and set an index to 0*/ char name[] = "Tobias Mole"; /*Declare and set an array of chars to name*/ main (void){ /*Initialise timer and interupts*/ TMOD = 0x20; TH1 = 243; SM0 = 0; SM1 = 1; TR1 = 1; TI = 1; ES = 1; EA = 1; while (1){ /*loop forever: 1 is true, 0 is false. */ } } void serialPortISR (void) interrupt 4{ if (name[index] != 0){ SBUF = name[index]; index++; } TI = 0; }
 

Valid XHTML 1.0 Transitional