On Aug 3, 3:39 am, bdebossorei...@gmail.com wrote:
> Hello everybody !
>
> I am a beginer in MSP430 programing... I have juste finished to code a
> sofware that generate a a frame and send it to a PC using USART1
> (RS232)... Not an hard work :p
>
> Now I would like to receive frames from USART0 and then to Send these
> frame using USART1... for example :
>
> TXBUF1=3DRXBUF0; (every RX1 interrupt.)
>
> Anyway I have try something : Initialize USART0 and USART1 like this :
>
> #include <msp430x16x.h>
> #include <in430.h>
>
> unsigned char *p2ud; // Global
>
> void main(void)
> {
> // USART1 init
> (transmission)
> WDTCTL =3D WDTPW + WDTHOLD; // Stop Watchdog
> P3SEL |=3D 0xC0; // P3.6,7 UART1
> BCSCTL1 |=3D XTS; // HF Quartz
> BCSCTL2 |=3D SELM_3; // MCLK =3D LFXT1
> ME2 |=3D UTXE1; // Enable USART1 TX
> UCTL1 |=3D CHAR; // 8-bit chararcters
> UTCTL1 |=3D SSEL0; // UCLK =3D ACLK
> UBR01 =3D 0x1A; // 3MHz/115200 =3D 26.04 =
-> 26 -> h1A
>
> UBR11 =3D 0x00;
> UMCTL1 =3D 0x00; // Modulation
> UCTL1 &=3D ~SWRST; // USART State machine init
> IE2 |=3D UTXIE1; // Enable TX
> interrupt.
>
> //USART0 init
> (reception)
> WDTCTL =3D WDTPW + WDTHOLD; // Arr=EAte le Watchdog
> P3SEL |=3D 0x30; // P3.4,5 UART0
> BCSCTL1 |=3D XTS; // HF Quartz
> BCSCTL2 |=3D SELM_3; // MCLK =3D LFXT1
> ME1 |=3D URXE0; // Enable USART0 RX
> UCTL0 |=3D CHAR;
> UTCTL0 |=3D SSEL0; // UCLK =3D ACLK
> UBR00 =3D 0x1A; // 3MHz/115200 =3D 26.04 ->
> 26 -> h1A
> UBR10 =3D 0x00;
> UMCTL0 =3D 0x00; // Modulation
> UCTL0 &=3D ~SWRST; // USART State machine init
> IE1 |=3D URXIE0; // Enable TX interrupt.
>
> _BIS_SR(LPM0_bits + GIE);
>
> }
>
> // ISR
>
> #pragma vector=3DUART1TX_VECTOR
> __interrupt void usart1_tx (void)
> {
> _NOP();
>
> }
>
> #pragma vector=3DUART0RX_VECTOR
> __interrupt void usart0_rx (void)
> {
> TXBUF1=3DRXBUF0;
> _NOP();
>
> }
>
> ... it doesn't work but i'm not surprised... :p
> I don't if it is the right way to initialize the 2 UART ports...
>
> Is anybody could help me to reach it ?
>
> Thanks
>
> Bobish
First simply get the transmitter going to verify your timing. Perform
simple initialization (without interrupts) and then do something like
this :
while(1) {
while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready?
TXBUF0 =3D 'X';
}
First step is to see a bunch of 'X's recieved at the PC. Then
duplicate timing settings for RX.
Reply by Grant Edwards●August 6, 20072007-08-06
On 2007-08-06, bdebossoreille@gmail.com <bdebossoreille@gmail.com> wrote:
> Sorry for the mistake...
>
> The goal of my operation is to write a code that could finally write
> serial datas into an external flash memory... I would like to do it
> step by step... That's why I would like to try just to send data from
> UART0 to UART1 port on the �C. If I reach it, I will be able to write
> data into an external flash...
I've never seen a flash memory with a UART interface. Are you
sure you shouldn't be using SPI or I2C?
--
Grant Edwards grante Yow! Hello. I know
at the divorce rate among
visi.com unmarried Catholic Alaskan
females!!
Reply by ●August 6, 20072007-08-06
Sorry for the mistake...
The goal of my operation is to write a code that could finally write
serial datas into an external flash memory... I would like to do it
step by step... That's why I would like to try just to send data from
UART0 to UART1 port on the =B5C. If I reach it, I will be able to write
data into an external flash...
Could you help tto find the mistake on my code ?
Reply by CBFalconer●August 3, 20072007-08-03
bdebossoreille@gmail.com wrote:
>
> Note : The protocol used for USART0 is RS485 and for USART1 is
> RS232...
>
> I looking forward to have informations because I really don't
> know how to reach this problem...
Be careful with your language. RS485 and RS232 are hardware
specifications, not protocols. You can use the hardware to
implement various protocols. For example, you can transfer
asynchronously (start/stop bits, limited char bit length) or
synchronously (no extra delimiting bits) over either hardware.
--
"Vista is finally secure from hacking. No one is going to 'hack'
the product activation and try and steal the o/s. Anyone smart
enough to do so is also smart enough not to want to bother."
--
Posted via a free Usenet account from http://www.teranews.com
Reply by ●August 3, 20072007-08-03
Note : The protocol used for USART0 is RS485 and for USART1 is
RS232...
I looking forward to have informations because I really don't know how
to reach this problem...
Reply by ●August 3, 20072007-08-03
Hello everybody !
I am a beginer in MSP430 programing... I have juste finished to code a
sofware that generate a a frame and send it to a PC using USART1
(RS232)... Not an hard work :p
Now I would like to receive frames from USART0 and then to Send these
frame using USART1... for example :
TXBUF1=3DRXBUF0; (every RX1 interrupt.)
Anyway I have try something : Initialize USART0 and USART1 like this :
#include <msp430x16x.h>
#include <in430.h>
unsigned char *p2ud; // Global
void main(void)
{
// USART1 init
(transmission)
WDTCTL =3D WDTPW + WDTHOLD; // Stop Watchdog
P3SEL |=3D 0xC0; // P3.6,7 UART1
BCSCTL1 |=3D XTS; // HF Quartz
BCSCTL2 |=3D SELM_3; // MCLK =3D LFXT1
ME2 |=3D UTXE1; // Enable USART1 TX
UCTL1 |=3D CHAR; // 8-bit chararcters
UTCTL1 |=3D SSEL0; // UCLK =3D ACLK
UBR01 =3D 0x1A; // 3MHz/115200 =3D 26.04 -
> 26 -> h1A
UBR11 =3D 0x00;
UMCTL1 =3D 0x00; // Modulation
UCTL1 &=3D ~SWRST; // USART State machine init
IE2 |=3D UTXIE1; // Enable TX
interrupt.
//USART0 init
(reception)
WDTCTL =3D WDTPW + WDTHOLD; // Arr=EAte le Watchdog
P3SEL |=3D 0x30; // P3.4,5 UART0
BCSCTL1 |=3D XTS; // HF Quartz
BCSCTL2 |=3D SELM_3; // MCLK =3D LFXT1
ME1 |=3D URXE0; // Enable USART0 RX
UCTL0 |=3D CHAR;
UTCTL0 |=3D SSEL0; // UCLK =3D ACLK
UBR00 =3D 0x1A; // 3MHz/115200 =3D 26.04 ->
26 -> h1A
UBR10 =3D 0x00;
UMCTL0 =3D 0x00; // Modulation
UCTL0 &=3D ~SWRST; // USART State machine init
IE1 |=3D URXIE0; // Enable TX interrupt.
_BIS_SR(LPM0_bits + GIE);
}
// ISR
#pragma vector=3DUART1TX_VECTOR
__interrupt void usart1_tx (void)
{
_NOP();
}
#pragma vector=3DUART0RX_VECTOR
__interrupt void usart0_rx (void)
{
TXBUF1=3DRXBUF0;
_NOP();
}
.=2E. it doesn't work but i'm not surprised... :p
I don't if it is the right way to initialize the 2 UART ports...
Is anybody could help me to reach it ?
Thanks
Bobish