We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
now it works... but could you explain to me the following code lines:
COM1->US_THR = (a[i] & 0xFF);
What's the meaning of 0xFF (1111 1111)? What's the reason for this?
and the second line:
AT91F_PMC_EnablePeriphClock ( AT91C_BASE_PMC, 1<<AT91C_ID_US1 ) ;
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.
I KEEP GETTING FATAL ERROR WHEN I TYPE A51 AT MY COMMAND LINE.
WHY?
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.
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).