Code: Select all
char frequency[4];
void Send_Frequency()
{
Soft_UART_Write(frequency[3]);
Soft_UART_Write(frequency[2]);
Soft_UART_Write(frequency[1]);
Soft_UART_Write(frequency[0]);
Soft_UART_Write(0x0A);
}
void main()
{
Soft_UART_Init(PORTA, 4, 0, 4800);
while(1==1)
{
frequency[0] = 4;
frequency[1] = 3;
frequency[2] = 2;
frequency[3] = 1;
Send_Frequency();
Delay_ms(5000);
}
}
But if i put this:
Code: Select all
void Send_Frequency()
{
char temp;
temp = frequency[3];
Soft_UART_Write(temp);
temp = frequency[2];
Soft_UART_Write(temp);
temp = frequency[1];
Soft_UART_Write(temp);
temp = frequency[0];
Soft_UART_Write(temp);
Soft_UART_Write(0x0A);
}
Received: 0x01 0x02 0x03 0x04 0x0A
P.S. can we have direct addressing of arrays accessed using constant indexes.