| ??? 05/11/07 22:42 Read: times |
#139090 - Serial port and Int0 solutions Responding to: ???'s previous message |
Hello Ahmet,
Below is corrected code which will allow your program to run. There were a couple of errors. Download Using the Free SDCC C Compiler to Develop Firmware for the DS89C420/430/440/450 Family of Microcontrollers application note use http://www.google.com/advanced_search?hl=en to find it It will help you understand how to program the DS89C430 IC. Regards, Charles Bannister
#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)
{
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)
{
SBUF0 = x;
while (TI_0 = 0);
TI_0=0;
}
|
| Topic | Author | Date |
| 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 |



