This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ez-usb FX & timer0 interrupt (keil newbie)

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?

Parents
  • 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

Reply
  • 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

Children
No data