Hello.
I am writing a simple program for the EZUSB FX2 board, when I compile, I have no errors and no warnings but when I try to debug (my interrupt function is not working) then I get the following :
"error 22 No Code Memory At Address 0045" "error 22 No Code Memory At Address 0055"
I checked this page but it did not help, http://www.keil.com/support/man/docs/mon51/mon51_22.htm
I have run the debugger in some other programs and the configuration was the same and it worked (am I doing a mistake here?), so, anyone can help me? Also, can anyone tell me why my interrupt is not working?
This is the code.
#include "fx2.h" #include "fx2regs.h"
unsigned char num ; bit flag ; BYTE xdata Digit[] = { 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, 0x88, 0x83, 0xc6, 0xa1, 0x86, 0x8e };
#define BTN_ADDR 0x20 #define LED_ADDR 0x21
void inter( void ) interrupt INT0_VECT { num ++ ; if( num > 15 ) num = 0 ; flag = 1 ; }
main( ) { BYTE xdata buttons; flag = 0 ;
EZUSB_InitI2C(); // Initialize EZ-USB I2C controller
num = 0 ; EX0 = 1 ; IT0 = 1 ; EA = 1 ;
EZUSB_ReadI2C(BTN_ADDR,0x01,&buttons); EZUSB_WriteI2C(LED_ADDR, 0x01, &(Digit[1])); //So far, the code is running, I see the number 1 on the seven segment display. EZUSB_WaitForEEPROMWrite(LED_ADDR);
while( 1 ) { if( flag == 1 ) { flag = 0 ; EZUSB_WriteI2C(LED_ADDR, 0x01, &(Digit[num])); EZUSB_WaitForEEPROMWrite(LED_ADDR); EA = 0 ; EZUSB_Delay( 333 ) ; EA = 1 ; } } }
Thank you very much.
Hello again and thank you for the reply.
First, let me tell you, that a small program I made for checking the INT0 pin for low level with polling is working fine.
I am working in the Cypress dev board, I have the INT0 pin connected to 3.3 Volts through a 4.7 KOhm resistor and a wire that is connected to the ground, when I connect the wire with the interrupt pin, I see the seven segment goes '0' and when I am disconnecting it, it goes '1'.
This is not happening in the interrupt case.
In simulation the interrupt is triggering fine.
In emulation it is not working at all.
Sometimes, the emulator is crashing. I don't know why.
Thanks again for your help.
Anyone?
I am stack here...