Hi, I'm new with Keil software , but however I have experience in writing software for the 8051/8052 in assembly. My problem: I'm making changes in firmware for the FX1 of Cypress. I want to add a timer0 interrupt and searched through the forum and application notes. Appnote 105 and 126 were usefull, and I created this: Global: BYTE xdata I2CPOS=0; main() : // timer 0 interrupt TMOD &= ~0x0F; TMOD |= 0x01; TH0=0xFF; TL0=0x00; PT0 = 0; ET0 = 0; TR0 = 1; // enable interrupts EA = 1; routine: void timer0_isr(void) interrupt TMR0_VECT { TH0=0xFF; TL0=0x00; I2CPOS=0; } The timer0_isr is never called, what do I forget. Is the timer0_isr(void) automaticly added to the vector table or has this to be done manually? The FX1 uses autovectoring for the usb interrupts does this affect the standard interrupts?
ET0 = 0;
Eh yes, ET was at first 1 , but I disabled it for debug purpose. As soon as ET=1 , enumeration will fail, this is probably caused by an non-existing interrupt routine.
The head of the main list says: #pragma NOIV // Do not generate interrupt vectors As far as I understand this will inhibit the default vector table and an alternative table will be used. How can I use both the alternative table and the standard table?
The key question above is: 'How do I use both the standard interrupt table as well as the alternate table?' Answer: you must modify the alternate table USBJmpTb.a51 to include the standard vectors. Here are snippets from my modified USBJmpTb.a51 file. . . . NAME USBJmpTbl extrn code (TIMER0OF, TIMER2OF, UART0IRQ, UART1IRQ) /* This line is added to handle the standard 8051 INTs. Names refer to my INT handler functions located elswhere. */ extrn code (ISR_Sudav, ISR_Sof, etc... as provided in the unmodified USBJmpTb.a51 file...) ;------------------ ; Interrupt Vectors ;------------------ /* The following four CSEG sections put the proper jumps at the proper addresses to handle the four standard 8051 interrupt sources that I am using in my project. */ CSEG AT 0BH ljmp TIMER0OF CSEG AT 23H ljmp UART0IRQ CSEG AT 2BH ljmp TIMER2OF CSEG AT 3BH ljmp UART1IRQ ; The rest of the USBJmpTb.a51 file is 'stock.' CSEG AT 43H USB_Int2AutoVector equ $ + 2 ljmp USB_Jump_Table ; Autovector will replace byte 45 . . . Good luck all! Del