Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/12/07 00:04
Read: times


 
#139094 - formatted
Responding to: ???'s previous message
Some Formatting Plus my 2 cents

#include <DS89C4xx.h> 
#include <stdio.h> 

void send(unsigned char x); 
//void msdelay(unsigned int itime);      <== NOT NEEDED

bit flag = 0; 

//	Interrupt Name Interrupt Vector Interrupt Number
//	External Interrupt 0 0x03 0
//	Timer 0 Overflow 0x0B 1

//void ex0_isr (void) interrupt 1 <== ERROR 

void ex0_isr (void) interrupt 0 
{ 
   flag = 1; 
} 

void main() 
{ 

   TMOD = 0x20; 
   TH1 = 0xFD; 
   SCON0 =0x50; 
   TR1=1; 
   IE0 = 1;            <==== ADDED
   EX0 = 1;            <==== ADDED 
   EA = 1;             <==== ADDED 
   IT0 = 1;            <==== ADDED 

 
   while(1)   //Main Loop
   { 

      if (flag == 1)
      {  
         flag = 0;               //<== LEFT OUT IN YOUR PROGRAM
         send('A'); 
      } 
   } 
} 

//	void msdelay(unsigned int itime)      NOT NEEDED
//	{ 
//	signed int i, j; 
//	for (i=0; i<itime; i++) 
//	for(j=0; j<1275; j++); 
//	} 

void send(unsigned char x) 
{ 
   TI_0 = 0;            // I would put it Here, unless it is
                        // initialized up top 
   SBUF0 = x; 
   while (TI_0 != 0);   // missing the "!"

} 


List of 5 messages in thread
TopicAuthorDate
serial port and interrupt problem            01/01/70 00:00      
   you did not enable the interrupt            01/01/70 00:00      
   from first looking            01/01/70 00:00      
   Serial port and Int0 solutions            01/01/70 00:00      
      formatted            01/01/70 00:00      

Back to Subject List