The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.
Shifting Data out at 32kHz - neptunetg - Aug 21 9:32:47 2009
I'm having difficulty with my app shifting out data on pin 2, of port 3.
Here is the code I am using.
DlyTA PUSH.W &TAR ; Get current TA Count DlyTAn8
ADD.W R5,0(SP) ; Interrupt in {R5 x 30.5} us.
POP.W &CCR1 ; Set CCR1
MOV.W #CCIE,&CCTL1 ; Enable the interrupt
; Wait until the transmission is completed.
Dly_Wait BIT.W #CCIE,&CCTL1 ; Wait for delay completion
JNZ Dly_Wait
XOR.B #BIT2,&P3OUT
RET
Right now I am just trying to toggle #BIT2,&P3OUT, but ultimately I would like to point to
a byte array to shift out. Is this a good way to accomplish this? Should I be using the
capture/compare functionality? This is on a MSP430F2274 if that helps.
Thanks for looks and replies.
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: Shifting Data out at 32kHz - tintronic - Aug 21 10:01:40 2009
Please explain what your were trying to do, just posting the code is not enought. I've no
idea what you are trying to accomplish with the Interrupt Enable bit, nor do I see that
you are servicing this interrupt, but it might be my limited understanding of the MSP
assembler code.
But if you want to output a stream of data at a constant speed, SPI is in my opinion the
best way to go. Look for the SPI chapter of the UART or USCI module and read it from top
to bottom.
Regards,
Michael K.
--- In m...@yahoogroups.com, "neptunetg"
wrote:
>
> I'm having difficulty with my app shifting out data on pin 2, of port 3.
> Here is the code I am using.
>
> DlyTA PUSH.W &TAR ; Get current TA Count DlyTAn8
> ADD.W R5,0(SP) ; Interrupt in {R5 x 30.5} us.
> POP.W &CCR1 ; Set CCR1
> MOV.W #CCIE,&CCTL1 ; Enable the interrupt
>
> ; Wait until the transmission is completed.
>
> Dly_Wait BIT.W #CCIE,&CCTL1 ; Wait for delay completion
> JNZ Dly_Wait
> XOR.B #BIT2,&P3OUT
> RET
>
> Right now I am just trying to toggle #BIT2,&P3OUT, but ultimately I would like to point
to a byte array to shift out. Is this a good way to accomplish this? Should I be using
the capture/compare functionality? This is on a MSP430F2274 if that helps.
>
> Thanks for looks and replies.
>
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )Re: Shifting Data out at 32kHz - neptunetg - Aug 21 10:34:36 2009
I would like to shift 10 bytes out port 3 pin 2 at a 32KHz rate.
DlyTA PUSH.W &TAR
Here I get the current value in TimerA clock and put it on the stack.
ADD.W R5,0(SP) ; Interrupt in {R5 x 30.5} us.
Here I add the number stored in R5 (which is a 1) to the current value of Timer A clock.
POP.W &CCR1 ; Set CCR1
I pop that value on the stack into CCR1 so that I will interrupt in 30.5 uS.
MOV.W #CCIE,&CCTL1 ; Enable the interrupt
I enable the interrupt here.
I wait until the transmission is completed. The interrupt is handled in the ISR where the
bit CCIE of CCTL1 is cleared. I exit out of the loop and toggle my LED (or shift one bit
out)
Dly_Wait BIT.W #CCIE,&CCTL1 ; Wait for delay completion
JNZ Dly_Wait
XOR.B #BIT2,&P3OUT
RET
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.
(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: Shifting Data out at 32kHz - old_cow_yellow - Aug 21 10:36:42 2009
copy of TAR is in 2(SP), not in 0(SP)
clear CCIFG, do not set CCIE
pull CCIFG, not CCIE
--- In m...@yahoogroups.com, "neptunetg"
wrote:
>
> I'm having difficulty with my app shifting out data on pin 2, of port 3.
> Here is the code I am using.
>
> DlyTA PUSH.W &TAR ; Get current TA Count DlyTAn8
> ADD.W R5,0(SP) ; Interrupt in {R5 x 30.5} us.
> POP.W &CCR1 ; Set CCR1
> MOV.W #CCIE,&CCTL1 ; Enable the interrupt
>
> ; Wait until the transmission is completed.
>
> Dly_Wait BIT.W #CCIE,&CCTL1 ; Wait for delay completion
> JNZ Dly_Wait
> XOR.B #BIT2,&P3OUT
> RET
>
> Right now I am just trying to toggle #BIT2,&P3OUT, but ultimately I would like to point
to a byte array to shift out. Is this a good way to accomplish this? Should I be using
the capture/compare functionality? This is on a MSP430F2274 if that helps.
>
> Thanks for looks and replies.
>
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )