now the code is
void send_byte(char byte_to_send)
{
for (char i=8; i>0; i--)// decrementing is more efficient that incrementing
{
if (byte_to_send & 0x1)
{
logical1();
}
else
{
logical0();
}
byte_to_send = byte_to_send>>1;
}
}
with error
*** Error 51 "test0002.c" Line 71(6,10): A numeric expression must appear here
*** Error 12 "test0002.c" Line 71(16,17): Undefined identifier i
*** Error 12 "test0002.c" Line 71(21,22): Undefined identifier i
3 Errors, 0 Warnings.
so i added a "int i;"
void send_byte(char byte_to_send)
{
int i;
for (char i=8; i>0; i--)// decrementing is more efficient that incrementing
{
if (byte_to_send & 0x1)
{
logical1();
}
else
{
logical0();
}
byte_to_send = byte_to_send>>1;
}
}
and the error is
*** Error 51 "test0002.c" Line 71(6,10): A numeric expression must appear here
*** Error 76 "test0002.c" Line 71(24,25): Expect ;
2 Errors, 0 Warnings
at
for (char i=8; i>0; i--)
however if i remove the "char" from "for (char i=8; i>0; i--)" it does compile, but doesnt work
void send_byte(char byte_to_send)
{
int i;
for (i=8; i>0; i--)// decrementing is more efficient that incrementing
{
if (byte_to_send & 0x1)
{
logical1();
}
else
{
logical0();
}
byte_to_send = byte_to_send>>1;
}
}
>>> Warning 203 "test0002.c" Line 100(1,1): Condition always TRUE
Memory usage: ROM=8% RAM=3% - 4%
0 Errors, 1 Warnings.