From: Muhammad F. F. <m_f...@ho...> - 2000-12-25 06:44:31
|
thanks Michael, i tried the "critical" option but STILL the respond is not as i expected. i guess i call functions from inside function that is called by my ISR, and i haven't make all the functions related to be "critical", or should i ? do you have any solution besides "critical" options ? maybe this will help you to picture the situation: 1. mcu AT89C51, code max: 4Kbytes 2. command line : SDCC --model-small --code-loc 0xc000 :) i use my own evaluation board, it runs well before using any interrupt routines 3. the code: ... code unsigned char *LOGO1 = "logo 1"; code unsigned char *LOGO2 = "logo 2"; code unsigned char *INCOMING = "incoming"; volatile unsigned int DELAY; // Global delaytime ... void main(void) { init_mcu(); lcd_clear(); // clear display lcd_puts(4, 0, LOGO1); // displays "logo 1" lcd_puts(0, 1, LOGO2); // displays "logo 2" while (1); } void External0_ISR(void) interrupt 0 // lo-to-hi transition triggered { lcd_clear(); lcd_puts(4, 0, INCOMING); // display "incoming" while(!RD1); // detect if the pin that generates // int_0 is still low } void Timer0_ISR(void) interrupt 1 { ET0 = 0; // Disable Timer0-interrupt if ( DELAY > 0 ) DELAY--; // Timebase ticks for delay-routine ET0 = 1; // Enable Timer0-interrupt } void delay(unsigned int timer_base) // using timer_0 interrupt { if ( timer_base == 0 ) return; DELAY = timer_base; while ( DELAY > 0 ) _asm nop _endasm; } void lcd_clear(void) // Display Clear { // unsigned char d = 0x01; send_command(0x01); delay(20); #ifdef DATA_LENGTH_4 send_command(0x10); delay(20); #endif } void lcd_puts(unsigned char X, // column position 0 - 15 bit Y, // row position 0 - 1 unsigned char *KAL) // string { lcd_gotoxy(X,Y); while(*KAL) lcd_putch(*KAL++); } void send_command(unsigned char CMD) { IREG = CMD; // CMD is sent to xdata delay(2); } ... 4. that's all, any help is appreciated. regards, fahmy _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. |