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.

Using Timer_A for Reference Frequency Measurement

Other Parts Discussed in Thread: MSP430F157

Hi, because of the fact that i am new on the MSP430 ultra low power microcontroller, is anyone who can help me solve the above?

Initially i am trying using the IAR to write on the MSP430F157 microcontroller a capture Interrupt service routine for external 50Hz reference frequency. The programe is: 

HCCR2   PUSH     R5
        MOV      CCR2,R5
        SUB      VZC_LASTCAP,R5
        MOV      VZC_DELTA,VZC_2DELTA
        ADD      R5,VZC_2DELTA
        MOV      R5,VZC_DELTA
        MOV      CCR2,VZC_LASTCAP
CAP2_END POP   R5
        RETI
        JMP $    

Why the IAR doesnt recognise the VZC_DELTA, VZC_2DELTA and VZC_LASTCAP,2?

Is it something which should be Defined before starting writing the program?

Thanks in advance, if someone knows please reply.

  • You probably did not declare those variables. Or, the declarations are "out of scope".

     

  • Thansk  a lot, but i am trying to declare them without any possitive result. Do you know the method how?

     

     

  • #include "msp430x15x.h"

                    ORG     0200h
    ; other variables in RAM
    VZC_LASTCAP     ds      2
    VZC_DELTA       ds      2
    VZC_2DELTA      ds      2
    ; other variables in RAM

                    ORG     8000h
    ; other code/counstant in FLASH
    main            mov     #5A80h,&WDTCTL
    ; ... the rest of main ...

    ; other code/counstant in FLASH
    TAISR           bic     #CCIFG,&CCTL2
    HCCR2           PUSH    R5
                    MOV     CCR2,R5
                    SUB     VZC_LASTCAP,R5
                    MOV     VZC_DELTA,VZC_2DELTA
                    ADD     R5,VZC_2DELTA
                    MOV     R5,VZC_DELTA
                    MOV     CCR2,VZC_LASTCAP
    CAP2_END        POP     R5
                    RETI
    ; other code/constant in FLASH

                    ORG     0FFEAh
                    dw      TAISR

                    ORG     0FFFEh
                    dw      main

                    end

     

  • Thanks a lot  old_cow_yellow , i will try it.

     Iam appreciating for your interest.

    Nikolas.

**Attention** This is a public forum