Oops, I should also point out that TA0 and TB0 have their own INT vector.
Multiple interrupts come from TA1-2 or TB1-TB6. These are the ones where you
need to read IVR,
TBIVR in your case for TB1.
Also, your vectors are wrong - you need separate 4 handlers for TA0, TA1-2, TB0,
TB1-6...
Best Regards,
Kris
-----Original Message-----
From: m... [mailto:m...] On Behalf Of Microbit
Sent: Tuesday, 19 June 2007 2:37 AM
To: m...
Subject: RE: [msp430] Re: Serial communication
When general interrupts are enabled it is not sufficient to have an
empty interrupt handler to clear the two timer interrupts that handle
multiple timer interrupt flags. >>>>>>
Correct, to clear the timer interrupt you need to read TAIVR/TBIVR.
Just having a NOP in ISR will result in endless timer interrupts.
Best Regards,
Kris
-----Original Message-----
From: m... [mailto:m...] On Behalf Of John Heenan
Sent: Tuesday, 19 June 2007 2:27 AM
To: m...
Subject: [msp430] Re: Serial communication
Hello Ermias
You need to enable general interrupts. EINT in assembler for example.
Otherwise R10 will never get updated.
When general interrupts are enabled it is not sufficient to have an
empty interrupt handler to clear the two timer interrupts that handle
multiple timer interrupt flags.
John Heenan
--- In m..., ermias gebre wrote: >
> Hello.
> Sorry for disturbing, but I wanted to ask one question that has been bothering me.if you could please help me, i would really
appreciate it. > i have a board with msp430f149. the outputs from
the board are timer B1 and A0. The board also has a serial connection with > the URXD1. what i want to do is control the
frequency and pulsewidth of the timerA and timer B frequency from my computer > i.e i want to develop a GUI to set the frequency. I
wrote an assembler program for this and i couldn't receive any number from
> the buffer, i know the hardware serial port and
everyting is working fine but i couldn't figure what is wrong and i am stuck. > Could you please look at my code and give me your
inputs.
>
> Thank you and Thank you again.
> Ermias
> #include "msp430x14x.h"
> #define Flash_start 01100h
> #define RAM_end 00200h
>
> ;------------------------------- ------------ > ORG Flash_start ;
Progam Start (1K Flash device) > ;0FC00h
> ;------------------------------- ------------ > RESET mov.w #RAM_end,SP ;
00A00h Set stackpointer (128B RAM device) > StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ;
Stop watchdog timer > clr.b &P1OUT
> clr.b &P2OUT
> clr.b &P3OUT
> clr.b &P4OUT
> clr.b &P5OUT
> clr.b &P6OUT
> ;eint
> ;BIS.B #RSEL2+RSEL1+RSEL0,&BCSCTL1
> ;BIS.B #DCO0+DCO1+DCO2,&DCOCTL ; Set max DCO frequency > BIS.B #DIVM1+DIVM0,&BCSCTL2
> BIS.B #DIVS1+DIVS0,&BCSCTL2
> BIS.B #BIT7,&P4DIR
> BIS #TBCLR,&TBCTL
> MOV #TBSSEL1+ID1+ID0+TBIE,&TBCTL
> MOV #OUTMOD_7+CCIE,&TBCCTL1
> MOV #120,&TBCCR0
> MOV #85,&TBCCR1
> BIS #MC0,&TBCTL
>
> BIS #TACLR,&TACTL
> MOV #TASSEL1+ID1+ID0+TAIE,&TACTL ; Define new state > MOV #OUTMOD2+CCIE,&TACCTL0 ;
CCR0: toggle TA0
> MOV #189,&TACCR0 ; fccr0 = 20kHz
> BIS #MC0,&TACTL ;Start init. timer. Up Mode >
> TAO BIS.B #BIT5,&P1SEL
> BIS.B #BIT5,&P1DIR
> TB1 BIS.B #BIT1,&P4SEL
> BIS.B #BIT1,&P4DIR
> MCLK BIS.B #BIT4,&P5SEL
> mov.b #BIT4,&P5DIR
> SMCLK BIS.B #BIT5,&P5SEL
> BIS.B #BIT5,&P5DIR
> ACLK BIS.B #BIT6,&P5SEL
> BIS.B #BIT6,&P5DIR
> BIS.B #BIT7,&P3SEL
>
> */
> ;------
> BIS.B #SWRST,&U1CTL
> BIS.B #CHAR+MM,&U1CTL
> BIC.B #SYNC,&U1CTL
> BIS.B #SSEL1,&U1TCTL
> MOV.B #03h,&U1BR0
> MOV.B #00h,&U1BR1
> CLR.B &U1MCTL
> BIS.B #URXE1,&ME2
> BIC.B #SWRST,U1CTL
> BIS.B #URXIE1,&IE2
> ;------------------------------- ------------ >
> Main
> ;BIS.B #LPM0,0(SP)
> XOR.B #BIT7,&P4OUT
> JMP Main
> ;------------------------------- ------------ > SPI1R CLR R10
> MOV.B &U1RXBUF,R10
> BIC.B #URXIE1,IE2
> reti
> ;------------------------------- ------------ > ;Timer NOP
> ; reti
> ;------------------------------- ------------ > ; Interrupt Vectors
> ;------------------------------- ------------ > RSEG INTVEC ;
Interrupt Vector Startadress > DW RESET ; 0,
0FFE0h - Basic Timer - lowest priority > DW RESET ; 1,
0FFE2h - I/O Port P2 (eight flags) > DW RESET ; 2,
0FFE4h - USART1 Transmit, UTXIFG1 > DW SPI1R ; 3,
0FFE6h - USART1 Receive, URXIFG1 > DW RESET ; 4,
0FFE8h - I/O Port P1 (eight flags) > DW Timer ; 5,
0FFEAh - Timer_A3 CCIFG1, CCIFG2, TAIFG > DW Timer ; 6,
0FFECh - Timer_A3 CCIFG0 > DW RESET ; 7,
0FFEEh - ADC, ADCIFG > DW RESET ; 8,
0FFF0h - USART0 Transmit, UTXIFG0 > DW RESET ; 9,
0FFF2h - USART0 Receive, URXIFG0 > DW RESET ; 10,
0FFF4h - Watchdog Timer - WDTIFG > DW RESET ; 11,
0FFF6h - Comparator_A - CAIFG > DW Timer ; 12,
0FFF8h - Timer_B7, CCIFG1 to CCIFG6, TBIFG > DW Timer ; 13,
0FFFAh - Timer_B7, CCIFG0 > DW RESET ; 14,
0FFFCh - NMIIFG - OFIFG - ACCVIFG > DW RESET ; 15,
0FFFEh - Reset - highest priority > ;----------------------------- ------------------------------ > END ; End of
program
> ;------------------------------- ---------------------------- >
>
> ---------------------------------
> Pinpoint customers who are looking for what you sell.
>
>
>
When general interrupts are enabled it is not sufficient to have an
empty interrupt handler to clear the two timer interrupts that handle
multiple timer interrupt flags. >>>>>>
Correct, to clear the timer interrupt you need to read TAIVR/TBIVR.
Just having a NOP in ISR will result in endless timer interrupts.
Best Regards,
Kris
-----Original Message-----
From: m... [mailto:m...] On Behalf Of John Heenan
Sent: Tuesday, 19 June 2007 2:27 AM
To: m...
Subject: [msp430] Re: Serial communication
Hello Ermias
You need to enable general interrupts. EINT in assembler for example.
Otherwise R10 will never get updated.
When general interrupts are enabled it is not sufficient to have an
empty interrupt handler to clear the two timer interrupts that handle
multiple timer interrupt flags.
John Heenan
--- In m..., ermias gebre wrote: >
> Hello.
> Sorry for disturbing, but I wanted to ask one question that has been bothering me.if you could please help me, i would really
appreciate it. > i have a board with msp430f149. the outputs from
the board are timer B1 and A0. The board also has a serial connection with > the URXD1. what i want to do is control the
frequency and pulsewidth of the timerA and timer B frequency from my computer > i.e i want to develop a GUI to set the frequency. I
wrote an assembler program for this and i couldn't receive any number from
> the buffer, i know the hardware serial port and
everyting is working fine but i couldn't figure what is wrong and i am stuck. > Could you please look at my code and give me your
inputs.
>
> Thank you and Thank you again.
> Ermias
> #include "msp430x14x.h"
> #define Flash_start 01100h
> #define RAM_end 00200h
>
> ;------------------------------- ------------ > ORG Flash_start ;
Progam Start (1K Flash device) > ;0FC00h
> ;------------------------------- ------------ > RESET mov.w #RAM_end,SP ;
00A00h Set stackpointer (128B RAM device) > StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ;
Stop watchdog timer > clr.b &P1OUT
> clr.b &P2OUT
> clr.b &P3OUT
> clr.b &P4OUT
> clr.b &P5OUT
> clr.b &P6OUT
> ;eint
> ;BIS.B #RSEL2+RSEL1+RSEL0,&BCSCTL1
> ;BIS.B #DCO0+DCO1+DCO2,&DCOCTL ; Set max DCO frequency > BIS.B #DIVM1+DIVM0,&BCSCTL2
> BIS.B #DIVS1+DIVS0,&BCSCTL2
> BIS.B #BIT7,&P4DIR
> BIS #TBCLR,&TBCTL
> MOV #TBSSEL1+ID1+ID0+TBIE,&TBCTL
> MOV #OUTMOD_7+CCIE,&TBCCTL1
> MOV #120,&TBCCR0
> MOV #85,&TBCCR1
> BIS #MC0,&TBCTL
>
> BIS #TACLR,&TACTL
> MOV #TASSEL1+ID1+ID0+TAIE,&TACTL ; Define new state > MOV #OUTMOD2+CCIE,&TACCTL0 ;
CCR0: toggle TA0
> MOV #189,&TACCR0 ; fccr0 = 20kHz
> BIS #MC0,&TACTL ;Start init. timer. Up Mode >
> TAO BIS.B #BIT5,&P1SEL
> BIS.B #BIT5,&P1DIR
> TB1 BIS.B #BIT1,&P4SEL
> BIS.B #BIT1,&P4DIR
> MCLK BIS.B #BIT4,&P5SEL
> mov.b #BIT4,&P5DIR
> SMCLK BIS.B #BIT5,&P5SEL
> BIS.B #BIT5,&P5DIR
> ACLK BIS.B #BIT6,&P5SEL
> BIS.B #BIT6,&P5DIR
> BIS.B #BIT7,&P3SEL
>
> */
> ;------
> BIS.B #SWRST,&U1CTL
> BIS.B #CHAR+MM,&U1CTL
> BIC.B #SYNC,&U1CTL
> BIS.B #SSEL1,&U1TCTL
> MOV.B #03h,&U1BR0
> MOV.B #00h,&U1BR1
> CLR.B &U1MCTL
> BIS.B #URXE1,&ME2
> BIC.B #SWRST,U1CTL
> BIS.B #URXIE1,&IE2
> ;------------------------------- ------------ >
> Main
> ;BIS.B #LPM0,0(SP)
> XOR.B #BIT7,&P4OUT
> JMP Main
> ;------------------------------- ------------ > SPI1R CLR R10
> MOV.B &U1RXBUF,R10
> BIC.B #URXIE1,IE2
> reti
> ;------------------------------- ------------ > ;Timer NOP
> ; reti
> ;------------------------------- ------------ > ; Interrupt Vectors
> ;------------------------------- ------------ > RSEG INTVEC ;
Interrupt Vector Startadress > DW RESET ; 0,
0FFE0h - Basic Timer - lowest priority > DW RESET ; 1,
0FFE2h - I/O Port P2 (eight flags) > DW RESET ; 2,
0FFE4h - USART1 Transmit, UTXIFG1 > DW SPI1R ; 3,
0FFE6h - USART1 Receive, URXIFG1 > DW RESET ; 4,
0FFE8h - I/O Port P1 (eight flags) > DW Timer ; 5,
0FFEAh - Timer_A3 CCIFG1, CCIFG2, TAIFG > DW Timer ; 6,
0FFECh - Timer_A3 CCIFG0 > DW RESET ; 7,
0FFEEh - ADC, ADCIFG > DW RESET ; 8,
0FFF0h - USART0 Transmit, UTXIFG0 > DW RESET ; 9,
0FFF2h - USART0 Receive, URXIFG0 > DW RESET ; 10,
0FFF4h - Watchdog Timer - WDTIFG > DW RESET ; 11,
0FFF6h - Comparator_A - CAIFG > DW Timer ; 12,
0FFF8h - Timer_B7, CCIFG1 to CCIFG6, TBIFG > DW Timer ; 13,
0FFFAh - Timer_B7, CCIFG0 > DW RESET ; 14,
0FFFCh - NMIIFG - OFIFG - ACCVIFG > DW RESET ; 15,
0FFFEh - Reset - highest priority > ;----------------------------- ------------------------------ > END ; End of
program
> ;------------------------------- ---------------------------- >
>
> ---------------------------------
> Pinpoint customers who are looking for what you sell.
>
>
>
Yahoo! Groups Links
Reply by John Heenan●June 18, 20072007-06-18
Hello Ermias
You need to enable general interrupts. EINT in assembler for example.
Otherwise R10 will never get updated.
When general interrupts are enabled it is not sufficient to have an
empty interrupt handler to clear the two timer interrupts that handle
multiple timer interrupt flags.
John Heenan
--- In m..., ermias gebre wrote: >
> Hello.
> Sorry for disturbing, but I wanted to ask one question that has been bothering me.if you could please help me, i would really
appreciate it. > i have a board with msp430f149. the outputs from
the board are timer B1 and A0. The board also has a serial connection with > the URXD1. what i want to do is control the
frequency and pulsewidth of the timerA and timer B frequency from my computer > i.e i want to develop a GUI to set the frequency. I
wrote an assembler program for this and i couldn't receive any number from
> the buffer, i know the hardware serial port and
everyting is working fine but i couldn't figure what is wrong and i am stuck. > Could you please look at my code and give me your
inputs.
>
> Thank you and Thank you again.
> Ermias
> #include "msp430x14x.h"
> #define Flash_start 01100h
> #define RAM_end 00200h
>
> ;------------------------------- ------------ > ORG Flash_start ;
Progam Start (1K Flash device) > ;0FC00h
> ;------------------------------- ------------ > RESET mov.w #RAM_end,SP ;
00A00h Set stackpointer (128B RAM device) > StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ;
Stop watchdog timer > clr.b &P1OUT
> clr.b &P2OUT
> clr.b &P3OUT
> clr.b &P4OUT
> clr.b &P5OUT
> clr.b &P6OUT
> ;eint
> ;BIS.B #RSEL2+RSEL1+RSEL0,&BCSCTL1
> ;BIS.B #DCO0+DCO1+DCO2,&DCOCTL ; Set max DCO frequency > BIS.B #DIVM1+DIVM0,&BCSCTL2
> BIS.B #DIVS1+DIVS0,&BCSCTL2
> BIS.B #BIT7,&P4DIR
> BIS #TBCLR,&TBCTL
> MOV #TBSSEL1+ID1+ID0+TBIE,&TBCTL
> MOV #OUTMOD_7+CCIE,&TBCCTL1
> MOV #120,&TBCCR0
> MOV #85,&TBCCR1
> BIS #MC0,&TBCTL
>
> BIS #TACLR,&TACTL
> MOV #TASSEL1+ID1+ID0+TAIE,&TACTL ; Define new state > MOV #OUTMOD2+CCIE,&TACCTL0 ;
CCR0: toggle TA0
> MOV #189,&TACCR0 ; fccr0 = 20kHz
> BIS #MC0,&TACTL ;Start init. timer. Up Mode >
> TAO BIS.B #BIT5,&P1SEL
> BIS.B #BIT5,&P1DIR
> TB1 BIS.B #BIT1,&P4SEL
> BIS.B #BIT1,&P4DIR
> MCLK BIS.B #BIT4,&P5SEL
> mov.b #BIT4,&P5DIR
> SMCLK BIS.B #BIT5,&P5SEL
> BIS.B #BIT5,&P5DIR
> ACLK BIS.B #BIT6,&P5SEL
> BIS.B #BIT6,&P5DIR
> BIS.B #BIT7,&P3SEL
>
> */
> ;------
> BIS.B #SWRST,&U1CTL
> BIS.B #CHAR+MM,&U1CTL
> BIC.B #SYNC,&U1CTL
> BIS.B #SSEL1,&U1TCTL
> MOV.B #03h,&U1BR0
> MOV.B #00h,&U1BR1
> CLR.B &U1MCTL
> BIS.B #URXE1,&ME2
> BIC.B #SWRST,U1CTL
> BIS.B #URXIE1,&IE2
> ;------------------------------- ------------ >
> Main
> ;BIS.B #LPM0,0(SP)
> XOR.B #BIT7,&P4OUT
> JMP Main
> ;------------------------------- ------------ > SPI1R CLR R10
> MOV.B &U1RXBUF,R10
> BIC.B #URXIE1,IE2
> reti
> ;------------------------------- ------------ > ;Timer NOP
> ; reti
> ;------------------------------- ------------ > ; Interrupt Vectors
> ;------------------------------- ------------ > RSEG INTVEC ;
Interrupt Vector Startadress > DW RESET ; 0,
0FFE0h - Basic Timer - lowest priority > DW RESET ; 1,
0FFE2h - I/O Port P2 (eight flags) > DW RESET ; 2,
0FFE4h - USART1 Transmit, UTXIFG1 > DW SPI1R ; 3,
0FFE6h - USART1 Receive, URXIFG1 > DW RESET ; 4,
0FFE8h - I/O Port P1 (eight flags) > DW Timer ; 5,
0FFEAh - Timer_A3 CCIFG1, CCIFG2, TAIFG > DW Timer ; 6,
0FFECh - Timer_A3 CCIFG0 > DW RESET ; 7,
0FFEEh - ADC, ADCIFG > DW RESET ; 8,
0FFF0h - USART0 Transmit, UTXIFG0 > DW RESET ; 9,
0FFF2h - USART0 Receive, URXIFG0 > DW RESET ; 10,
0FFF4h - Watchdog Timer - WDTIFG > DW RESET ; 11,
0FFF6h - Comparator_A - CAIFG > DW Timer ; 12,
0FFF8h - Timer_B7, CCIFG1 to CCIFG6, TBIFG > DW Timer ; 13,
0FFFAh - Timer_B7, CCIFG0 > DW RESET ; 14,
0FFFCh - NMIIFG - OFIFG - ACCVIFG > DW RESET ; 15,
0FFFEh - Reset - highest priority > ;----------------------------- ------------------------------ > END ; End of
program
> ;------------------------------- ---------------------------- >
>
> ---------------------------------
> Pinpoint customers who are looking for what you sell.
>
>
>
Reply by ermias gebre●June 18, 20072007-06-18
Hello.
Sorry for disturbing, but I wanted to ask one question that has been bothering
me.if you could please help me, i would really appreciate it.
i have a board with msp430f149. the outputs from the board are timer B1 and
A0. The board also has a serial connection with
the URXD1. what i want to do is control the frequency and pulsewidth of the
timerA and timer B frequency from my computer
i.e i want to develop a GUI to set the frequency. I wrote an assembler program
for this and i couldn't receive any number from
the buffer, i know the hardware serial port and everyting is working fine but
i couldn't figure what is wrong and i am stuck.
Could you please look at my code and give me your inputs.
Thank you and Thank you again.
Ermias
#include "msp430x14x.h"
#define Flash_start 01100h
#define RAM_end 00200h