This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USART: to send more Bits

Hello,

I'm searching for a function in the Realview Compiler, where I can send more than one Bit over the USART.

__inline void AT91F_US_PutChar (
  AT91PS_USART pUSART,
  int character )
{
    pUSART->US_THR = (character & 0x1FF);
}

e.g. I have a[11] = "Hello World"; and I want to send it with

for(int i=0; i<2; i++)
        {
           AT91F_US_PutChar (COM0,a[i]);
        }

But with this version, only the last Bit (e.g. o) will be transmitted. What would be the reason for this?

best regards
Bernd

Parents
  • What's the meaning of 0xFF (1111 1111)? What's the reason for this?

    There shouldn't be a pressing reason to set the top 24 bits of the word written to the USART to 0. The USART should only process as many bits as it is configured to do, and ignore the rest.

    What's the meaning of 1<<AT91C_ID_US1? US1 ID is 7. So it's a bit-operation which sets the number 1 at the 7te position.

    7 is the peripheral ID of USART1 (see device datasheet, p. 21). The peripheral clock to device 7 is enabled by writing 0x00000080 to the PMC_PCER (see device datasheet, p. 280).

Reply
  • What's the meaning of 0xFF (1111 1111)? What's the reason for this?

    There shouldn't be a pressing reason to set the top 24 bits of the word written to the USART to 0. The USART should only process as many bits as it is configured to do, and ignore the rest.

    What's the meaning of 1<<AT91C_ID_US1? US1 ID is 7. So it's a bit-operation which sets the number 1 at the 7te position.

    7 is the peripheral ID of USART1 (see device datasheet, p. 21). The peripheral clock to device 7 is enabled by writing 0x00000080 to the PMC_PCER (see device datasheet, p. 280).

Children
No data