I am a bit puzzled. (and new to working in C)
I have an array of longs that I need to feed out my Uart.
Obviously the uart can't take more than a char.
The code below shows some of the ideas I've tried, but in all cases,
the ASM shows me that the pointer will be bumped four bytes, not one.
What's the best way to get this data to my Uart?
Yes, I CAN sit and spin for the UDR to be ready.
void Do_Serial_Output(void)
{
unsigned char i = 0;
unsigned char t = 0;
if (0 < Proc_Data_Size) { // If there's data to send..
while ( i<4 ) {
while (!(UCSRA & (1<< UDRE))) {}
//memcpy(&t,&(Proc_Data[Proc_Data_Out_Index])+i,1);
//UDR = t;
//UDR = (char)(*((char*)(&(Proc_Data[Proc_Data_Out_Index])+i)));
UDR = &(Proc_Data[Proc_Data_Out_Index])+i;
++i;
}
Proc_Data_Size--;
Proc_Data_Out_Index++;
if (Proc_Samples < Proc_Data_Out_Index) Proc_Data_Out_Index =
0; // Handle wrap
}
}
--
"The very powerful and the very stupid have one thing in common. Instead of
altering their views to fit the facts, they alter the facts to fit their
views... which can be very uncomfortable if you happen to be one of the
facts that needs altering." Doctor Who, Face of EvilMessage
Array of Long
2009-03-06 by David VanHorn
Attachments
- No local attachments were found for this message.