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.
Please read the forum guidelines on posting formatted code.
You need to configure the appropriate pin as INT0 via a write to PORTACFG. The default function is a port pin.
The addresses 0x45 and 0x55 are auto-vector locations which are replaced depending on which interrupt is being taken.
The error message that you are getting is a verify error from the Keil ROM monitor. I would not be concerned about verify errors at these specific locations. I would not expect that you would be able to read what you wrote at these locations when auto-vectoring is enabled.
Hello again and thank you for your reply.
I add the line needed but still I cannot generate an interrupt.
num = 0 ; PORTACFG |= 0x01 ; EX0 = 1 ; IT0 = 1 ; EA = 1 ;
Another problem I have with the debugger is that when I press the Peripherals->Interrupt, it is not showing me the interrupts as in the simulation mode, therefore I cannot trigger my interrupt, instead it is showing me interrupts that are not correct, for example, there is an A/D interrupt in there located in vector 0x0043.
I would like to know a) Why my code is not working and b) Why is this happening with my debugger?
Thank you very much for your time.
Assuming that you are bringing the correct pin low for the required minimum number of cycles then I don't see any problem with what you have now. Maybe somebody else has an idea?
it is not showing me the interrupts as in the simulation mode, therefore I cannot trigger my interrupt
How exactly have you tried generating the interrupt on your board again? You are asserting the INT0 pin, aren't you?
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...