This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTC interrupt

Hi,

I have made a small project that can print the date + time using the RTC registers like this 25.03.10,20:04:02

Now I want to print this every second. Timer interrupt every second has been used in the audio filter example and I tried to learn from that. These are the things I included in main to enable interrupt.

    InitSystem();
    ConfigPort();
    SYS_GlobalIntEnable();
    reset_RTC();
    IER1 = 0x0004;
    enable_rtc_second_int();

 

The SYS_GlobalIntEnable(); is giving error

Invalid instructionsyntax, Xmem or Ymem expected
     BIT (ST1, #ST1_INTM) = #0

There is a file lpva.inc in the audio filter project that has ST1 defined. I added that file in my project, but including that from my main.c is giving a lot of compilation errors.

Can anyone help me with the minimum things required to do to enable second interrupt? I am trying to learn.

 

Thanks in advance,

Riju


  • I added the following in register_cpu.h

    #define ST1            *(volatile unsigned *)0x03

    I need to set the bit 11 INTM of ST1 as 0.

     

    void SYS_GlobalIntEnable(void)
    {
        asm(" BIT (ST1, #ST1_INTM) = #0");
    }

    does exactly that but I am getting build errors if I use it. What do I need to do to include the above function in my main.c so that no build errors come?

     

    Thanks,

    Riju

  • I have attached my project folder.  The "Hi" rom RTC_Isr is never printed i.e. the second interrupt doesn't occur. Let me know where I am going wrong.

    Thanks,

    Riju

  • Hi Riju,


    which errors do you precisely get? Please post the exact error messages. As a first guess: Built errors with assembly code often have to do with the difference between mnemonic assembly and algebraic assembly (add R1,R2,R3 is mnemonic assembly, R3=R1+R2 is algebraic assembly). You can change these porperties if you right-click on a file, select properties, select C/C++-Build and then select the Runtime Model Options. The checkboxes "Codegen outputs algebraic assembly" and "select assembly source language" need to be set properly.

    Regards,

    Michael