Hedy guys :
Nowaday I was doing a project about data transmission with Atmega16's usart port ,here is the form of
data i need to transmit :
Command packet format:
2 bytes 4 bytes 1 byte 2 bytes 1 byte 4 bytes 2 bytes
0xef01 0xffffffff 0x01 0x0007 0x13 0x00000000 0x001c
I make an array like this
my_array [7]={0xef01, 0xffffffff, 0x01,0x0007,0x13, 0x00000000,0x001c};
and then use this code ,wanting to put every element by putting it into the Tx Buffer
uint i;
for(i=0;i<7;i++)
{
while(!(UCSRA&(BIT(UDRE)))) ;
UDR=ceshi;
while(!(UCSRA&(BIT(TXC))));
UCSRA|=BIT(TXC);
}
but as you can see the data length I want to transmit is 32 bits ,but the Tx register is only 8bits ,
it's obvious that this method is incorrect ,so I wish someone can help and solve this problem ,Thank you .