Hi everybody, I'm a newbee on MSP 430. Can anybody debug my code and tell me why this ain't working? MSP 430 F1232 P1.2 Rx from PC P1.3 Tx to PC LFXTCLK 4,00000 MHz #include <msp430x12x2.h> #define RXD 0x04 // RXD on P1.2 #define TXD 0x08 // TXD on P1.3 ******************************** // Conditions for 9600 Baud HW/SW UART, ACLK = 3.579545MHz #define Bitime_5 0x0BA // ~ 0.5 bit length #define Bitime 0x175 // 104 us ~ 9596 baud unsigned int RXTXData; unsigned char BitCnt; void TX_Byte (void); void RX_Ready (void); void main(void) { unsigned int i; WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFF; i > 0; i--); // Time for flag to set } while (IFG1 & OFIFG); // OSCFault flag still set? BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe) CCTL0 = OUT; // TXD Idle as Mark TACTL = TASSEL_1+MC_1; // ACLK, continous mode ******************* P1SEL = TXD; // P1.1/TA0 for TXD function P1DIR = TXD; // TXD output on P1 P1SEL = RXD; // P2.2/TA0 as RXD input ******************** // Mainloop for (;;) { RX_Ready(); // UART ready to RX one Byte _BIS_SR(CPUOFF+GIE); // Enter LPM0 Until character RXed TX_Byte(); // TX Back RXed Byte Received } } // Function Transmits Character from RXTXData Buffer void TX_Byte(void) { BitCnt = 0xA; // Load Bit counter, 8data + ST/SP CCR0 = TAR; // Current state of TA counter CCR0 += Bitime; // Some time till first bit RXTXData |= 0x100; // Add mark stop bit to RXTXData RXTXData = RXTXData << 1; // Add space start bit CCTL0 = OUTMOD0+CCIE; // TXD = mark = idle while (CCTL0 & CCIE); // Wait for TX completion } // Function Readies UART to Receive Character into RXTXData Buffer void RX_Ready(void) { BitCnt = 0x8; // Load Bit counter CCTL0 = SCS+CCIS0+OUTMOD0+CM1+CAP+CCIE; // Sync, Neg Edge, Capture } // Timer A0 interrupt service routine interrupt [TIMERA0_VECTOR] void Timer_A (void) //************************ { CCR0 += Bitime; // Add Offset to CCR0 // RX if (CCTL0 & CCIS0) // RX on CCI0B? { if( CCTL0 & CAP ) // Capture mode = start bit edge { CCTL0 &= ~ CAP; // Switch from capture to compare mode CCR0 += Bitime_5; } else { RXTXData = RXTXData >> 1; if (CCTL0 & SCCI) // Get bit waiting in receive latch RXTXData |= 0x80; BitCnt --; // All bits RXed? if ( BitCnt == 0) //>>>>>>>>>> Decode of Received Byte Here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< { CCTL0 &= ~ CCIE; // All bits RXed, disable interrupt _BIC_SR_IRQ(CPUOFF); // Clear LPM0 bits from 0(SR) } //>>>>>>>>>> Decode of Received Byte Here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< } } // TX else { if ( BitCnt == 0) CCTL0 &= ~ CCIE; // All bits TXed, disable interrupt else { CCTL0 |= OUTMOD2; // TX Space if (RXTXData & 0x01) CCTL0 &= ~ OUTMOD2; // TX Mark RXTXData = RXTXData >> 1; BitCnt --; } } }
Please debug Timer_A UART on MSP430F1232 P1.2 RX P1.3 TX
Started by ●February 7, 2005
Reply by ●February 7, 20052005-02-07
What isn't working?
What isn't it doing?
Is it compiling?
Is it receiving?
Is it transmitting?
Is it not doing anything?
What is it supposed to do?
On Monday 07 February 2005 02:13 pm, andrei_lucec
wrote:
> Hi everybody,
> I'm a newbee on MSP 430. Can anybody debug my code and tell me why
> this ain't working?
>
> MSP 430 F1232
> P1.2 Rx from PC
> P1.3 Tx to PC
> LFXTCLK 4,00000 MHz
>
>
> #include <msp430x12x2.h>
>
> #define RXD 0x04 // RXD on P1.2
> #define TXD 0x08 // TXD on P1.3
> ********************************
>
> // Conditions for 9600 Baud HW/SW UART, ACLK = 3.579545MHz
>
> #define Bitime_5 0x0BA // ~ 0.5 bit length
> #define Bitime 0x175 // 104 us ~ 9596 baud
>
> unsigned int RXTXData;
> unsigned char BitCnt;
>
> void TX_Byte (void);
> void RX_Ready (void);
>
> void main(void)
> {
> unsigned int i;
> WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
>
> BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL
>
> do
> {
> IFG1 &= ~OFIFG; // Clear OSCFault flag
> for (i = 0xFF; i > 0; i--); // Time for flag to set
> }
> while (IFG1 & OFIFG); // OSCFault flag still
> set?
>
> BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe)
>
> CCTL0 = OUT; // TXD Idle as Mark
> TACTL = TASSEL_1+MC_1; // ACLK, continous mode
> *******************
> P1SEL = TXD; // P1.1/TA0 for TXD function
> P1DIR = TXD; // TXD output on P1
> P1SEL = RXD; // P2.2/TA0 as RXD input
> ********************
>
> // Mainloop
> for (;;)
> {
> RX_Ready(); // UART ready to RX one Byte
> _BIS_SR(CPUOFF+GIE); // Enter LPM0 Until
> character RXed
> TX_Byte(); // TX Back RXed Byte Received
> }
>
> }
>
> // Function Transmits Character from RXTXData Buffer
> void TX_Byte(void)
> {
> BitCnt = 0xA; // Load Bit counter, 8data +
> ST/SP
> CCR0 = TAR; // Current state of TA
> counter
> CCR0 += Bitime; // Some time till first bit
> RXTXData |= 0x100; // Add mark stop bit to
> RXTXData
> RXTXData = RXTXData << 1; // Add space start bit
> CCTL0 = OUTMOD0+CCIE; // TXD = mark = idle
> while (CCTL0 & CCIE); // Wait for TX completion
> }
>
> // Function Readies UART to Receive Character into RXTXData Buffer
> void RX_Ready(void)
> {
> BitCnt = 0x8; // Load Bit counter
> CCTL0 = SCS+CCIS0+OUTMOD0+CM1+CAP+CCIE; // Sync,
Neg Edge,
> Capture
> }
>
> // Timer A0 interrupt service routine
> interrupt [TIMERA0_VECTOR] void Timer_A
> (void) //************************
> {
> CCR0 += Bitime; // Add Offset to CCR0
>
> // RX
> if (CCTL0 & CCIS0) // RX on CCI0B?
> {
> if( CCTL0 & CAP ) // Capture mode = start bit
> edge
> {
> CCTL0 &= ~ CAP; // Switch from capture to
> compare mode
> CCR0 += Bitime_5;
> }
> else
> {
> RXTXData = RXTXData >> 1;
> if (CCTL0 & SCCI) // Get bit waiting in
> receive latch
> RXTXData |= 0x80;
> BitCnt --; // All bits RXed?
> if ( BitCnt == 0)
> //>>>>>>>>>> Decode of Received Byte Here
>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> {
> CCTL0 &= ~ CCIE; // All bits RXed, disable
> interrupt
> _BIC_SR_IRQ(CPUOFF); // Clear LPM0 bits from 0(SR)
> }
> //>>>>>>>>>> Decode of Received Byte Here
>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> }
> }
> // TX
> else
> {
> if ( BitCnt == 0)
> CCTL0 &= ~ CCIE; // All bits TXed, disable
> interrupt
> else
> {
> CCTL0 |= OUTMOD2; // TX Space
> if (RXTXData & 0x01)
> CCTL0 &= ~ OUTMOD2; // TX Mark
> RXTXData = RXTXData >> 1;
> BitCnt --;
> }
> }
> }
>
>
>
>
>
>
>
>
> .
>
>
>
>
>
>
>
>
>
>
>
>
>
> .
Reply by ●February 8, 20052005-02-08
As Micah said, I think you should be more specific, Andrei, otherwise no
one can help you. Hasn't the F1232 a USART module? Why don't you use
it? I think it would be much simpler.
Regards,
Adriano.
andrei_lucec wrote:
>
>
> Hi everybody,
> I'm a newbee on MSP 430. Can anybody debug my code and tell me why
> this ain't working?
>
> MSP 430 F1232
> P1.2 Rx from PC
> P1.3 Tx to PC
> LFXTCLK 4,00000 MHz
>
>
> #include <msp430x12x2.h>
>
> #define RXD 0x04 // RXD on P1.2
> #define TXD 0x08 // TXD on P1.3
> ********************************
>
> // Conditions for 9600 Baud HW/SW UART, ACLK = 3.579545MHz
>
> #define Bitime_5 0x0BA // ~ 0.5 bit length
> #define Bitime 0x175 // 104 us ~ 9596 baud
>
> unsigned int RXTXData;
> unsigned char BitCnt;
>
> void TX_Byte (void);
> void RX_Ready (void);
>
> void main(void)
> {
> unsigned int i;
> WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
>
> BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL
>
> do
> {
> IFG1 &= ~OFIFG; // Clear OSCFault flag
> for (i = 0xFF; i > 0; i--); // Time for flag to set
> }
> while (IFG1 & OFIFG); // OSCFault flag still
> set?
>
> BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe)
>
> CCTL0 = OUT; // TXD Idle as Mark
> TACTL = TASSEL_1+MC_1; // ACLK, continous mode
> *******************
> P1SEL = TXD; // P1.1/TA0 for TXD function
> P1DIR = TXD; // TXD output on P1
> P1SEL = RXD; // P2.2/TA0 as RXD input
> ********************
>
> // Mainloop
> for (;;)
> {
> RX_Ready(); // UART ready to RX one Byte
> _BIS_SR(CPUOFF+GIE); // Enter LPM0 Until
> character RXed
> TX_Byte(); // TX Back RXed Byte Received
> }
>
> }
>
> // Function Transmits Character from RXTXData Buffer
> void TX_Byte(void)
> {
> BitCnt = 0xA; // Load Bit counter, 8data +
> ST/SP
> CCR0 = TAR; // Current state of TA
> counter
> CCR0 += Bitime; // Some time till first bit
> RXTXData |= 0x100; // Add mark stop bit to
> RXTXData
> RXTXData = RXTXData << 1; // Add space start bit
> CCTL0 = OUTMOD0+CCIE; // TXD = mark = idle
> while (CCTL0 & CCIE); // Wait for TX completion
> }
>
> // Function Readies UART to Receive Character into RXTXData Buffer
> void RX_Ready(void)
> {
> BitCnt = 0x8; // Load Bit counter
> CCTL0 = SCS+CCIS0+OUTMOD0+CM1+CAP+CCIE; // Sync,
Neg Edge,
> Capture
> }
>
> // Timer A0 interrupt service routine
> interrupt [TIMERA0_VECTOR] void Timer_A
> (void) //************************
> {
> CCR0 += Bitime; // Add Offset to CCR0
>
> // RX
> if (CCTL0 & CCIS0) // RX on CCI0B?
> {
> if( CCTL0 & CAP ) // Capture mode = start bit
> edge
> {
> CCTL0 &= ~ CAP; // Switch from capture to
> compare mode
> CCR0 += Bitime_5;
> }
> else
> {
> RXTXData = RXTXData >> 1;
> if (CCTL0 & SCCI) // Get bit waiting in
> receive latch
> RXTXData |= 0x80;
> BitCnt --; // All bits RXed?
> if ( BitCnt == 0)
> //>>>>>>>>>> Decode of Received Byte Here
>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> {
> CCTL0 &= ~ CCIE; // All bits RXed, disable
> interrupt
> _BIC_SR_IRQ(CPUOFF); // Clear LPM0 bits from 0(SR)
> }
> //>>>>>>>>>> Decode of Received Byte Here
>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> }
> }
> // TX
> else
> {
> if ( BitCnt == 0)
> CCTL0 &= ~ CCIE; // All bits TXed, disable
> interrupt
> else
> {
> CCTL0 |= OUTMOD2; // TX Space
> if (RXTXData & 0x01)
> CCTL0 &= ~ OUTMOD2; // TX Mark
> RXTXData = RXTXData >> 1;
> BitCnt --;
> }
> }
> }
>
>
>
>
>
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
Reply by ●February 8, 20052005-02-08
Yes, it has.
The problem is that we are supposed to manage 2 UARTs.
One embedded in the processor (P3.4/5 UTXD0 / URXDO)
and
another one developped with Timer_A
thanks
>From: Adriano <adriano@adri...>
>Reply-To: msp430@msp4...
>To: msp430@msp4...
>Subject: Re: [msp430] Please debug Timer_A UART on MSP430F1232 P1.2 RX
>P1.3 TX
>Date: Tue, 08 Feb 2005 10:41:07 -0200
>
>
>As Micah said, I think you should be more specific, Andrei, otherwise no
> one can help you. Hasn't the F1232 a USART module? Why don't
you use
>it? I think it would be much simpler.
>
>Regards,
>Adriano.
>
>andrei_lucec wrote:
> >
> >
> > Hi everybody,
> > I'm a newbee on MSP 430. Can anybody debug my code and tell me
why
> > this ain't working?
> >
> > MSP 430 F1232
> > P1.2 Rx from PC
> > P1.3 Tx to PC
> > LFXTCLK 4,00000 MHz
> >
> >
> > #include <msp430x12x2.h>
> >
> > #define RXD 0x04 // RXD on P1.2
> > #define TXD 0x08 // TXD on P1.3
> > ********************************
> >
> > // Conditions for 9600 Baud HW/SW UART, ACLK = 3.579545MHz
> >
> > #define Bitime_5 0x0BA // ~ 0.5 bit length
> > #define Bitime 0x175 // 104 us ~ 9596 baud
> >
> > unsigned int RXTXData;
> > unsigned char BitCnt;
> >
> > void TX_Byte (void);
> > void RX_Ready (void);
> >
> > void main(void)
> > {
> > unsigned int i;
> > WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
> >
> > BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL
> >
> > do
> > {
> > IFG1 &= ~OFIFG; // Clear OSCFault flag
> > for (i = 0xFF; i > 0; i--); // Time for flag to set
> > }
> > while (IFG1 & OFIFG); // OSCFault flag still
> > set?
> >
> > BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe)
> >
> > CCTL0 = OUT; // TXD Idle as Mark
> > TACTL = TASSEL_1+MC_1; // ACLK, continous mode
> > *******************
> > P1SEL = TXD; // P1.1/TA0 for TXD function
> > P1DIR = TXD; // TXD output on P1
> > P1SEL = RXD; // P2.2/TA0 as RXD input
> > ********************
> >
> > // Mainloop
> > for (;;)
> > {
> > RX_Ready(); // UART ready to RX one Byte
> > _BIS_SR(CPUOFF+GIE); // Enter LPM0 Until
> > character RXed
> > TX_Byte(); // TX Back RXed Byte Received
> > }
> >
> > }
> >
> > // Function Transmits Character from RXTXData Buffer
> > void TX_Byte(void)
> > {
> > BitCnt = 0xA; // Load Bit counter, 8data +
> > ST/SP
> > CCR0 = TAR; // Current state of TA
> > counter
> > CCR0 += Bitime; // Some time till first bit
> > RXTXData |= 0x100; // Add mark stop bit to
> > RXTXData
> > RXTXData = RXTXData << 1; // Add space start bit
> > CCTL0 = OUTMOD0+CCIE; // TXD = mark = idle
> > while (CCTL0 & CCIE); // Wait for TX completion
> > }
> >
> > // Function Readies UART to Receive Character into RXTXData Buffer
> > void RX_Ready(void)
> > {
> > BitCnt = 0x8; // Load Bit counter
> > CCTL0 = SCS+CCIS0+OUTMOD0+CM1+CAP+CCIE; //
Sync, Neg Edge,
> > Capture
> > }
> >
> > // Timer A0 interrupt service routine
> > interrupt [TIMERA0_VECTOR] void Timer_A
> > (void) //************************
> > {
> > CCR0 += Bitime; // Add Offset to CCR0
> >
> > // RX
> > if (CCTL0 & CCIS0) // RX on CCI0B?
> > {
> > if( CCTL0 & CAP ) // Capture mode = start
bit
> > edge
> > {
> > CCTL0 &= ~ CAP; // Switch from capture to
> > compare mode
> > CCR0 += Bitime_5;
> > }
> > else
> > {
> > RXTXData = RXTXData >> 1;
> > if (CCTL0 & SCCI) // Get bit waiting in
> > receive latch
> > RXTXData |= 0x80;
> > BitCnt --; // All bits RXed?
> > if ( BitCnt == 0)
> > //>>>>>>>>>> Decode of Received Byte
Here
> >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > {
> > CCTL0 &= ~ CCIE; // All bits RXed, disable
> > interrupt
> > _BIC_SR_IRQ(CPUOFF); // Clear LPM0 bits from 0(SR)
> > }
> > //>>>>>>>>>> Decode of Received Byte
Here
> >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > }
> > }
> > // TX
> > else
> > {
> > if ( BitCnt == 0)
> > CCTL0 &= ~ CCIE; // All bits TXed, disable
> > interrupt
> > else
> > {
> > CCTL0 |= OUTMOD2; // TX Space
> > if (RXTXData & 0x01)
> > CCTL0 &= ~ OUTMOD2; // TX Mark
> > RXTXData = RXTXData >> 1;
> > BitCnt --;
> > }
> > }
> > }
> >
> >
> >
> >
> >
> >
> >
> >
> > .
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
Reply by ●February 8, 20052005-02-08
It's not working means that it' s not resending the received data. RX >> TX thanks --- In msp430@msp4..., Micah Stevens <micah@9...> wrote: > > What isn't working? > What isn't it doing? > Is it compiling? > Is it receiving? > Is it transmitting? > Is it not doing anything? > What is it supposed to do? > > > > > > > On Monday 07 February 2005 02:13 pm, andrei_lucec wrote: > > Hi everybody, > > I'm a newbee on MSP 430. Can anybody debug my code and tell me why > > this ain't working? > > > > MSP 430 F1232 > > P1.2 Rx from PC > > P1.3 Tx to PC > > LFXTCLK 4,00000 MHz > > > > > > #include <msp430x12x2.h> > > > > #define RXD 0x04 // RXD on P1.2 > > #define TXD 0x08 // TXD on P1.3 > > ******************************** > > > > // Conditions for 9600 Baud HW/SW UART, ACLK = 3.579545MHz > > > > #define Bitime_5 0x0BA // ~ 0.5 bit length > > #define Bitime 0x175 // 104 us ~ 9596 baud > > > > unsigned int RXTXData; > > unsigned char BitCnt; > > > > void TX_Byte (void); > > void RX_Ready (void); > > > > void main(void) > > { > > unsigned int i; > > WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer > > > > BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL > > > > do > > { > > IFG1 &= ~OFIFG; // Clear OSCFault flag > > for (i = 0xFF; i > 0; i--); // Time for flag to set > > } > > while (IFG1 & OFIFG); // OSCFault flag still > > set? > > > > BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe) > > > > CCTL0 = OUT; // TXD Idle as Mark > > TACTL = TASSEL_1+MC_1; // ACLK, continous mode > > ******************* > > P1SEL = TXD; // P1.1/TA0 for TXD function > > P1DIR = TXD; // TXD output on P1 > > P1SEL = RXD; // P2.2/TA0 as RXD input > > ******************** > > > > // Mainloop > > for (;;) > > { > > RX_Ready(); // UART ready to RX one Byte > > _BIS_SR(CPUOFF+GIE); // Enter LPM0 Until > > character RXed > > TX_Byte(); // TX Back RXed Byte Received > > } > > > > } > > > > // Function Transmits Character from RXTXData Buffer > > void TX_Byte(void) > > { > > BitCnt = 0xA; // Load Bit counter, 8data + > > ST/SP > > CCR0 = TAR; // Current state of TA > > counter > > CCR0 += Bitime; // Some time till first bit > > RXTXData |= 0x100; // Add mark stop bit to > > RXTXData > > RXTXData = RXTXData << 1; // Add space start bit > > CCTL0 = OUTMOD0+CCIE; // TXD = mark = idle > > while (CCTL0 & CCIE); // Wait for TX completion > > } > > > > // Function Readies UART to Receive Character into RXTXData Buffer > > void RX_Ready(void) > > { > > BitCnt = 0x8; // Load Bit counter > > CCTL0 = SCS+CCIS0+OUTMOD0+CM1+CAP+CCIE; // Sync, Neg Edge, > > Capture > > } > > > > // Timer A0 interrupt service routine > > interrupt [TIMERA0_VECTOR] void Timer_A > > (void) //************************ > > { > > CCR0 += Bitime; // Add Offset to CCR0 > > > > // RX > > if (CCTL0 & CCIS0) // RX on CCI0B? > > { > > if( CCTL0 & CAP ) // Capture mode = start bit > > edge > > { > > CCTL0 &= ~ CAP; // Switch from capture to > > compare mode > > CCR0 += Bitime_5; > > } > > else > > { > > RXTXData = RXTXData >> 1; > > if (CCTL0 & SCCI) // Get bit waiting in > > receive latch > > RXTXData |= 0x80; > > BitCnt --; // All bits RXed? > > if ( BitCnt == 0) > > //>>>>>>>>>> Decode of Received Byte Here > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > { > > CCTL0 &= ~ CCIE; // All bits RXed, disable > > interrupt > > _BIC_SR_IRQ(CPUOFF); // Clear LPM0 bits from 0(SR) > > } > > //>>>>>>>>>> Decode of Received Byte Here > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > } > > } > > // TX > > else > > { > > if ( BitCnt == 0) > > CCTL0 &= ~ CCIE; // All bits TXed, disable > > interrupt > > else > > { > > CCTL0 |= OUTMOD2; // TX Space > > if (RXTXData & 0x01) > > CCTL0 &= ~ OUTMOD2; // TX Mark > > RXTXData = RXTXData >> 1; > > BitCnt --; > > } > > } > > } > > > > > > > > > > > > > > > > > > . > > > > > > > > > > > > > > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > To visit your group on the web, go to: > > http://groups.yahoo.com/group/msp430/ > > > > . > > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Reply by ●February 8, 20052005-02-08
Where is the data stopping? I have had great success in using printf()
statements in debug mode to echo data out the jtag to help me figure out
where something is failing.
You didn't answer hardly any of my questions, which were more meant to help
than just be rude. Sorry if it seemed that way. But you haven't even given
us
enough information to know if we should be looking for syntax errors, or
what. I assume by the way you talk about it it at least compiles, but you
never stated this so I could be wrong.
I've never seen compiled software that doesn't do anything. It's
at least
doing something, troubleshooting involves figuring what it IS doing, and why
it's not doing everything you want it to.
Does is Receive data properly? If so, then it's half way there. If not, you
need to look in the receive side. Did you hook a scope up to the uart to see
if the signal is getting at least that far? how about on the TX side, is is
failing somewhere in the signal path outside the chip?
Once you narrow it down to something that is specific, I'm sure
there's plenty
of people on this list that would love to help you out with it. Just my two
cents.. :)
-Micah
On Tuesday 08 February 2005 07:55 am, andrei_lucec
wrote:
> It's not working means that it' s not resending the received
data.
>
> RX >> TX
>
> thanks
>
> --- In msp430@msp4..., Micah Stevens <micah@9...> wrote:
> > What isn't working?
> > What isn't it doing?
> > Is it compiling?
> > Is it receiving?
> > Is it transmitting?
> > Is it not doing anything?
> > What is it supposed to do?
> >
> > On Monday 07 February 2005 02:13 pm, andrei_lucec wrote:
> > > Hi everybody,
> > > I'm a newbee on MSP 430. Can anybody debug my code and
tell me
>
> why
>
> > > this ain't working?
> > >
> > > MSP 430 F1232
> > > P1.2 Rx from PC
> > > P1.3 Tx to PC
> > > LFXTCLK 4,00000 MHz
> > >
> > >
> > > #include <msp430x12x2.h>
> > >
> > > #define RXD 0x04 // RXD on P1.2
> > > #define TXD 0x08 // TXD on P1.3
> > > ********************************
> > >
> > > // Conditions for 9600 Baud HW/SW UART, ACLK = 3.579545MHz
> > >
> > > #define Bitime_5 0x0BA // ~ 0.5 bit length
> > > #define Bitime 0x175 // 104 us ~ 9596 baud
> > >
> > > unsigned int RXTXData;
> > > unsigned char BitCnt;
> > >
> > > void TX_Byte (void);
> > > void RX_Ready (void);
> > >
> > > void main(void)
> > > {
> > > unsigned int i;
> > > WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
> > >
> > > BCSCTL1 |= XTS; // ACLK = LFXT1 = HF
>
> XTAL
>
> > > do
> > > {
> > > IFG1 &= ~OFIFG; // Clear OSCFault
flag
> > > for (i = 0xFF; i > 0; i--); // Time for flag to
set
> > > }
> > > while (IFG1 & OFIFG); // OSCFault flag
still
> > > set?
> > >
> > > BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1
(safe)
> > >
> > > CCTL0 = OUT; // TXD Idle as Mark
> > > TACTL = TASSEL_1+MC_1; // ACLK,
continous
>
> mode
>
> > > *******************
> > > P1SEL = TXD; // P1.1/TA0 for TXD
>
> function
>
> > > P1DIR = TXD; // TXD output on P1
> > > P1SEL = RXD; // P2.2/TA0 as RXD
input
> > > ********************
> > >
> > > // Mainloop
> > > for (;;)
> > > {
> > > RX_Ready(); // UART ready to RX one
>
> Byte
>
> > > _BIS_SR(CPUOFF+GIE); // Enter LPM0 Until
> > > character RXed
> > > TX_Byte(); // TX Back RXed Byte
>
> Received
>
> > > }
> > >
> > > }
> > >
> > > // Function Transmits Character from RXTXData Buffer
> > > void TX_Byte(void)
> > > {
> > > BitCnt = 0xA; // Load Bit counter,
>
> 8data +
>
> > > ST/SP
> > > CCR0 = TAR; // Current state of TA
> > > counter
> > > CCR0 += Bitime; // Some time till first
>
> bit
>
> > > RXTXData |= 0x100; // Add mark stop bit to
> > > RXTXData
> > > RXTXData = RXTXData << 1; // Add space
start bit
> > > CCTL0 = OUTMOD0+CCIE; // TXD = mark =
idle
> > > while (CCTL0 & CCIE); // Wait for TX
>
> completion
>
> > > }
> > >
> > > // Function Readies UART to Receive Character into RXTXData
>
> Buffer
>
> > > void RX_Ready(void)
> > > {
> > > BitCnt = 0x8; // Load Bit counter
> > > CCTL0 = SCS+CCIS0+OUTMOD0+CM1+CAP+CCIE;
// Sync, Neg Edge,
> > > Capture
> > > }
> > >
> > > // Timer A0 interrupt service routine
> > > interrupt [TIMERA0_VECTOR] void Timer_A
> > > (void) //************************
> > > {
> > > CCR0 += Bitime; // Add Offset to CCR0
> > >
> > > // RX
> > > if (CCTL0 & CCIS0) // RX on CCI0B?
> > > {
> > > if( CCTL0 & CAP ) // Capture mode =
start
>
> bit
>
> > > edge
> > > {
> > > CCTL0 &= ~ CAP; // Switch from
capture
>
> to
>
> > > compare mode
> > > CCR0 += Bitime_5;
> > > }
> > > else
> > > {
> > > RXTXData = RXTXData >> 1;
> > > if (CCTL0 & SCCI) // Get bit waiting
in
> > > receive latch
> > > RXTXData |= 0x80;
> > > BitCnt --; // All bits RXed?
> > > if ( BitCnt == 0)
> > > //>>>>>>>>>> Decode of Received
Byte Here
> > >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > > {
> > > CCTL0 &= ~ CCIE; // All bits RXed,
>
> disable
>
> > > interrupt
> > > _BIC_SR_IRQ(CPUOFF); // Clear LPM0 bits from
>
> 0(SR)
>
> > > }
> > > //>>>>>>>>>> Decode of Received
Byte Here
> > >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > > }
> > > }
> > > // TX
> > > else
> > > {
> > > if ( BitCnt == 0)
> > > CCTL0 &= ~ CCIE; // All bits TXed,
>
> disable
>
> > > interrupt
> > > else
> > > {
> > > CCTL0 |= OUTMOD2; // TX Space
> > > if (RXTXData & 0x01)
> > > CCTL0 &= ~ OUTMOD2; // TX Mark
> > > RXTXData = RXTXData >> 1;
> > > BitCnt --;
> > > }
> > > }
> > > }
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > .
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > .
Reply by ●February 8, 20052005-02-08
Hi,
If you writed this code after the assembler example
after the SLAA078A Application report you forget to
enable interrupts after the do-while loop.
Regards,
Boby
--- andrei_lucec <andreilucec@andr...> wrote:
>
> It's not working means that it' s not resending the
> received data.
>
> RX >> TX
>
> thanks
>
> --- In msp430@msp4..., Micah Stevens
> <micah@9...> wrote:
> >
> > What isn't working?
> > What isn't it doing?
> > Is it compiling?
> > Is it receiving?
> > Is it transmitting?
> > Is it not doing anything?
> > What is it supposed to do?
> >
> >
> >
> >
> >
> >
> > On Monday 07 February 2005 02:13 pm, andrei_lucec
> wrote:
> > > Hi everybody,
> > > I'm a newbee on MSP 430. Can anybody debug my
> code and tell me
> why
> > > this ain't working?
> > >
> > > MSP 430 F1232
> > > P1.2 Rx from PC
> > > P1.3 Tx to PC
> > > LFXTCLK 4,00000 MHz
> > >
> > >
> > > #include <msp430x12x2.h>
> > >
> > > #define RXD 0x04 // RXD
> on P1.2
> > > #define TXD 0x08 // TXD
> on P1.3
> > > ********************************
> > >
> > > // Conditions for 9600 Baud HW/SW UART, ACLK > 3.579545MHz
> > >
> > > #define Bitime_5 0x0BA // ~
> 0.5 bit length
> > > #define Bitime 0x175 // 104
> us ~ 9596 baud
> > >
> > > unsigned int RXTXData;
> > > unsigned char BitCnt;
> > >
> > > void TX_Byte (void);
> > > void RX_Ready (void);
> > >
> > > void main(void)
> > > {
> > > unsigned int i;
> > > WDTCTL = WDTPW + WDTHOLD; // Stop
> watchdog timer
> > >
> > > BCSCTL1 |= XTS; // ACLK
> = LFXT1 = HF
> XTAL
> > >
> > > do
> > > {
> > > IFG1 &= ~OFIFG; //
> Clear OSCFault flag
> > > for (i = 0xFF; i > 0; i--); // Time
> for flag to set
> > > }
> > > while (IFG1 & OFIFG); //
> OSCFault flag still
> > > set?
> > >
> > > BCSCTL2 |= SELM1+SELM0; // MCLK
> = LFXT1 (safe)
> > >
> > > CCTL0 = OUT; // TXD
> Idle as Mark
> > > TACTL = TASSEL_1+MC_1; //
> ACLK, continous
> mode
> > > *******************
> > > P1SEL = TXD; //
> P1.1/TA0 for TXD
> function
> > > P1DIR = TXD; // TXD
> output on P1
> > > P1SEL = RXD; //
> P2.2/TA0 as RXD input
> > > ********************
> > >
> > > // Mainloop
> > > for (;;)
> > > {
> > > RX_Ready(); // UART
> ready to RX one
> Byte
> > > _BIS_SR(CPUOFF+GIE); //
> Enter LPM0 Until
> > > character RXed
> > > TX_Byte(); // TX
> Back RXed Byte
> Received
> > > }
> > >
> > > }
> > >
> > > // Function Transmits Character from RXTXData
> Buffer
> > > void TX_Byte(void)
> > > {
> > > BitCnt = 0xA; // Load
> Bit counter,
> 8data +
> > > ST/SP
> > > CCR0 = TAR; //
> Current state of TA
> > > counter
> > > CCR0 += Bitime; // Some
> time till first
> bit
> > > RXTXData |= 0x100; // Add
> mark stop bit to
> > > RXTXData
> > > RXTXData = RXTXData << 1; // Add
> space start bit
> > > CCTL0 = OUTMOD0+CCIE; // TXD
> = mark = idle
> > > while (CCTL0 & CCIE); // Wait
> for TX
> completion
> > > }
> > >
> > > // Function Readies UART to Receive Character
> into RXTXData
> Buffer
> > > void RX_Ready(void)
> > > {
> > > BitCnt = 0x8; // Load
> Bit counter
> > > CCTL0 = SCS+CCIS0+OUTMOD0+CM1+CAP+CCIE;
//
> Sync, Neg Edge,
> > > Capture
> > > }
> > >
> > > // Timer A0 interrupt service routine
> > > interrupt [TIMERA0_VECTOR] void Timer_A
> > > (void) //************************
> > > {
> > > CCR0 += Bitime; // Add
> Offset to CCR0
> > >
> > > // RX
> > > if (CCTL0 & CCIS0) // RX
> on CCI0B?
> > > {
> > > if( CCTL0 & CAP ) //
> Capture mode = start
> bit
> > > edge
> > > {
> > > CCTL0 &= ~ CAP; //
> Switch from capture
> to
> > > compare mode
> > > CCR0 += Bitime_5;
> > > }
> > > else
> > > {
> > > RXTXData = RXTXData >> 1;
> > > if (CCTL0 & SCCI) // Get
> bit waiting in
> > > receive latch
> > > RXTXData |= 0x80;
> > > BitCnt --; // All
> bits RXed?
> > > if ( BitCnt == 0)
> > > //>>>>>>>>>> Decode of Received
Byte Here
> > >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > > {
> > > CCTL0 &= ~ CCIE; // All
> bits RXed,
> disable
> > > interrupt
> > > _BIC_SR_IRQ(CPUOFF); //
> Clear LPM0 bits from
> 0(SR)
> > > }
> > > //>>>>>>>>>> Decode of Received
Byte Here
> > >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > > }
> > > }
> > > // TX
>
=== message truncated ==
__________________________________
Reply by ●February 8, 20052005-02-08
Haha.. I'm trying to make a point and you just ruin it for me.
:)
On Tuesday 08 February 2005 08:34 am, Robert Bacs
wrote:
> Hi,
>
> If you writed this code after the assembler example
> after the SLAA078A Application report you forget to
> enable interrupts after the do-while loop.
>
> Regards,
> Boby
>
> --- andrei_lucec <andreilucec@andr...> wrote:
> > It's not working means that it' s not resending the
> > received data.
> >
> > RX >> TX
> >
> > thanks
> >
> > --- In msp430@msp4..., Micah Stevens
> >
> > <micah@9...> wrote:
> > > What isn't working?
> > > What isn't it doing?
> > > Is it compiling?
> > > Is it receiving?
> > > Is it transmitting?
> > > Is it not doing anything?
> > > What is it supposed to do?
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Monday 07 February 2005 02:13 pm, andrei_lucec
> >
> > wrote:
> > > > Hi everybody,
> > > > I'm a newbee on MSP 430. Can anybody debug my
> >
> > code and tell me
> > why
> >
> > > > this ain't working?
> > > >
> > > > MSP 430 F1232
> > > > P1.2 Rx from PC
> > > > P1.3 Tx to PC
> > > > LFXTCLK 4,00000 MHz
> > > >
> > > >
> > > > #include <msp430x12x2.h>
> > > >
> > > > #define RXD 0x04 // RXD
> >
> > on P1.2
> >
> > > > #define TXD 0x08 // TXD
> >
> > on P1.3
> >
> > > > ********************************
> > > >
> > > > // Conditions for 9600 Baud HW/SW UART, ACLK > >
> > 3.579545MHz
> >
> > > > #define Bitime_5 0x0BA // ~
> >
> > 0.5 bit length
> >
> > > > #define Bitime 0x175 // 104
> >
> > us ~ 9596 baud
> >
> > > > unsigned int RXTXData;
> > > > unsigned char BitCnt;
> > > >
> > > > void TX_Byte (void);
> > > > void RX_Ready (void);
> > > >
> > > > void main(void)
> > > > {
> > > > unsigned int i;
> > > > WDTCTL = WDTPW + WDTHOLD; // Stop
> >
> > watchdog timer
> >
> > > > BCSCTL1 |= XTS; // ACLK
> >
> > = LFXT1 = HF
> > XTAL
> >
> > > > do
> > > > {
> > > > IFG1 &= ~OFIFG; //
> >
> > Clear OSCFault flag
> >
> > > > for (i = 0xFF; i > 0; i--); // Time
> >
> > for flag to set
> >
> > > > }
> > > > while (IFG1 & OFIFG); //
> >
> > OSCFault flag still
> >
> > > > set?
> > > >
> > > > BCSCTL2 |= SELM1+SELM0; // MCLK
> >
> > = LFXT1 (safe)
> >
> > > > CCTL0 = OUT; // TXD
> >
> > Idle as Mark
> >
> > > > TACTL = TASSEL_1+MC_1; //
> >
> > ACLK, continous
> > mode
> >
> > > > *******************
> > > > P1SEL = TXD; //
> >
> > P1.1/TA0 for TXD
> > function
> >
> > > > P1DIR = TXD; // TXD
> >
> > output on P1
> >
> > > > P1SEL = RXD; //
> >
> > P2.2/TA0 as RXD input
> >
> > > > ********************
> > > >
> > > > // Mainloop
> > > > for (;;)
> > > > {
> > > > RX_Ready(); // UART
> >
> > ready to RX one
> > Byte
> >
> > > > _BIS_SR(CPUOFF+GIE); //
> >
> > Enter LPM0 Until
> >
> > > > character RXed
> > > > TX_Byte(); // TX
> >
> > Back RXed Byte
> > Received
> >
> > > > }
> > > >
> > > > }
> > > >
> > > > // Function Transmits Character from RXTXData
> >
> > Buffer
> >
> > > > void TX_Byte(void)
> > > > {
> > > > BitCnt = 0xA; // Load
> >
> > Bit counter,
> > 8data +
> >
> > > > ST/SP
> > > > CCR0 = TAR; //
> >
> > Current state of TA
> >
> > > > counter
> > > > CCR0 += Bitime; // Some
> >
> > time till first
> > bit
> >
> > > > RXTXData |= 0x100; // Add
> >
> > mark stop bit to
> >
> > > > RXTXData
> > > > RXTXData = RXTXData << 1; // Add
> >
> > space start bit
> >
> > > > CCTL0 = OUTMOD0+CCIE; // TXD
> >
> > = mark = idle
> >
> > > > while (CCTL0 & CCIE); // Wait
> >
> > for TX
> > completion
> >
> > > > }
> > > >
> > > > // Function Readies UART to Receive Character
> >
> > into RXTXData
> > Buffer
> >
> > > > void RX_Ready(void)
> > > > {
> > > > BitCnt = 0x8; // Load
> >
> > Bit counter
> >
> > > > CCTL0 =
SCS+CCIS0+OUTMOD0+CM1+CAP+CCIE; //
> >
> > Sync, Neg Edge,
> >
> > > > Capture
> > > > }
> > > >
> > > > // Timer A0 interrupt service routine
> > > > interrupt [TIMERA0_VECTOR] void Timer_A
> > > > (void) //************************
> > > > {
> > > > CCR0 += Bitime; // Add
> >
> > Offset to CCR0
> >
> > > > // RX
> > > > if (CCTL0 & CCIS0) // RX
> >
> > on CCI0B?
> >
> > > > {
> > > > if( CCTL0 & CAP ) //
> >
> > Capture mode = start
> > bit
> >
> > > > edge
> > > > {
> > > > CCTL0 &= ~ CAP; //
> >
> > Switch from capture
> > to
> >
> > > > compare mode
> > > > CCR0 += Bitime_5;
> > > > }
> > > > else
> > > > {
> > > > RXTXData = RXTXData >> 1;
> > > > if (CCTL0 & SCCI) // Get
> >
> > bit waiting in
> >
> > > > receive latch
> > > > RXTXData |= 0x80;
> > > > BitCnt --; // All
> >
> > bits RXed?
> >
> > > > if ( BitCnt == 0)
> > > > //>>>>>>>>>> Decode of
Received Byte Here
> > > >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > > > {
> > > > CCTL0 &= ~ CCIE; // All
> >
> > bits RXed,
> > disable
> >
> > > > interrupt
> > > > _BIC_SR_IRQ(CPUOFF); //
> >
> > Clear LPM0 bits from
> > 0(SR)
> >
> > > > }
> > > > //>>>>>>>>>> Decode of
Received Byte Here
> > > >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > > > }
> > > > }
> > > > // TX
>
> === message truncated ==>
>
>
>
> __________________________________
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
Reply by ●February 8, 20052005-02-08
Ok, Andrei, and have you thought on using an MSP with 2 UARTs, like the
'F149, or is it not possible in your case?
Are you sure you are receiving a byte correctly? I would put a brekpoint
in my code right after receiving it, so it's possible to compare the
byte transferred to what was received.
I have also looked something that doesn't seem good in your code, when
you configure port 1. You do:
P1SEL = TXD; // P1.1/TA0 for TXD function
P1DIR = TXD; // TXD output on P1
P1SEL = RXD; // P2.2/TA0 as RXD input
If you really want to configure P1.2 and P1.3 as peripheral function,
you have to do something like:
P1SEL = TXD + RXD;
Otherwise, pin P1.3 will remain as I/O function, and maybe this is why
you're not managing to transmit back the byte received.
Regards,
Adriano.
Andrei Lucec wrote:
> Yes, it has.
>
> The problem is that we are supposed to manage 2 UARTs.
>
> One embedded in the processor (P3.4/5 UTXD0 / URXDO)
> and
> another one developped with Timer_A
>
> thanks
>
>
>
>>From: Adriano <adriano@adri...>
>>Reply-To: msp430@msp4...
>>To: msp430@msp4...
>>Subject: Re: [msp430] Please debug Timer_A UART on MSP430F1232 P1.2 RX
>>P1.3 TX
>>Date: Tue, 08 Feb 2005 10:41:07 -0200
>>
>>
>>As Micah said, I think you should be more specific, Andrei, otherwise no
>> one can help you. Hasn't the F1232 a USART module? Why don't
you use
>>it? I think it would be much simpler.
>>
>>Regards,
>>Adriano.
>>
>>andrei_lucec wrote:
>>
>>>
>>> Hi everybody,
>>>I'm a newbee on MSP 430. Can anybody debug my code and tell me
why
>>>this ain't working?
>>>
>>>MSP 430 F1232
>>>P1.2 Rx from PC
>>>P1.3 Tx to PC
>>>LFXTCLK 4,00000 MHz
>>>
>>>
>>>#include <msp430x12x2.h>
>>>
>>>#define RXD 0x04 // RXD on P1.2
>>>#define TXD 0x08 // TXD on P1.3
>>>********************************
>>>
>>>// Conditions for 9600 Baud HW/SW UART, ACLK = 3.579545MHz
>>>
>>>#define Bitime_5 0x0BA // ~ 0.5 bit length
>>>#define Bitime 0x175 // 104 us ~ 9596 baud
>>>
>>>unsigned int RXTXData;
>>>unsigned char BitCnt;
>>>
>>>void TX_Byte (void);
>>>void RX_Ready (void);
>>>
>>>void main(void)
>>>{
>>> unsigned int i;
>>> WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
>>>
>>> BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL
>>>
>>> do
>>> {
>>> IFG1 &= ~OFIFG; // Clear OSCFault flag
>>> for (i = 0xFF; i > 0; i--); // Time for flag to set
>>> }
>>> while (IFG1 & OFIFG); // OSCFault flag still
>>>set?
>>>
>>> BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe)
>>>
>>> CCTL0 = OUT; // TXD Idle as Mark
>>> TACTL = TASSEL_1+MC_1; // ACLK, continous
mode
>>>*******************
>>> P1SEL = TXD; // P1.1/TA0 for TXD function
>>> P1DIR = TXD; // TXD output on P1
>>> P1SEL = RXD; // P2.2/TA0 as RXD input
>>>********************
>>>
>>>// Mainloop
>>> for (;;)
>>> {
>>> RX_Ready(); // UART ready to RX one Byte
>>> _BIS_SR(CPUOFF+GIE); // Enter LPM0 Until
>>>character RXed
>>> TX_Byte(); // TX Back RXed Byte
Received
>>> }
>>>
>>>}
>>>
>>>// Function Transmits Character from RXTXData Buffer
>>>void TX_Byte(void)
>>>{
>>> BitCnt = 0xA; // Load Bit counter, 8data +
>>>ST/SP
>>> CCR0 = TAR; // Current state of TA
>>>counter
>>> CCR0 += Bitime; // Some time till first bit
>>> RXTXData |= 0x100; // Add mark stop bit to
>>>RXTXData
>>> RXTXData = RXTXData << 1; // Add space start bit
>>> CCTL0 = OUTMOD0+CCIE; // TXD = mark = idle
>>> while (CCTL0 & CCIE); // Wait for TX
completion
>>>}
>>>
>>>// Function Readies UART to Receive Character into RXTXData Buffer
>>>void RX_Ready(void)
>>>{
>>> BitCnt = 0x8; // Load Bit counter
>>> CCTL0 = SCS+CCIS0+OUTMOD0+CM1+CAP+CCIE; //
Sync, Neg Edge,
>>>Capture
>>>}
>>>
>>>// Timer A0 interrupt service routine
>>>interrupt [TIMERA0_VECTOR] void Timer_A
>>>(void) //************************
>>>{
>>> CCR0 += Bitime; // Add Offset to CCR0
>>>
>>>// RX
>>> if (CCTL0 & CCIS0) // RX on CCI0B?
>>> {
>>> if( CCTL0 & CAP ) // Capture mode = start
bit
>>>edge
>>> {
>>> CCTL0 &= ~ CAP; // Switch from capture
to
>>>compare mode
>>> CCR0 += Bitime_5;
>>> }
>>> else
>>> {
>>> RXTXData = RXTXData >> 1;
>>> if (CCTL0 & SCCI) // Get bit waiting in
>>>receive latch
>>> RXTXData |= 0x80;
>>> BitCnt --; // All bits RXed?
>>> if ( BitCnt == 0)
>>>//>>>>>>>>>> Decode of Received Byte
Here
>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>> {
>>> CCTL0 &= ~ CCIE; // All bits RXed,
disable
>>>interrupt
>>> _BIC_SR_IRQ(CPUOFF); // Clear LPM0 bits from
0(SR)
>>> }
>>>//>>>>>>>>>> Decode of Received Byte
Here
>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>> }
>>> }
>>>// TX
>>> else
>>> {
>>> if ( BitCnt == 0)
>>> CCTL0 &= ~ CCIE; // All bits TXed,
disable
>>>interrupt
>>> else
>>> {
>>> CCTL0 |= OUTMOD2; // TX Space
>>> if (RXTXData & 0x01)
>>> CCTL0 &= ~ OUTMOD2; // TX Mark
>>> RXTXData = RXTXData >> 1;
>>> BitCnt --;
>>> }
>>> }
>>>}
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>.
>>>
>>>
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>
>
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
Reply by ●February 8, 20052005-02-08