??? 01/08/08 21:37 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#149155 - Bad indenting trap! Responding to: ???'s previous message |
John Myers said:
Your pointer assignment "PtrRx = &CompDataRx[0];" and "SerialInit(9600);" are within the main loop.
The code will continually reset 'PtrRx'. This is an example of where poor style is not just a matter of taste, but has actually misled you, me and a few others! Your code, as posted, was: void main() { while(1){ PtrRx = &CompDataRx[0]; // start address in the array CompAddress1 = P1; CompAddress2 = CompAddress1 + 0x80; CompAddress3 = CompAddress1 + 0x90; HwDelay(20); // etc... The problem would have been a lot more obvious id you'd indented it as: void main() { while(1){ PtrRx = &CompDataRx[0]; // start address in the array CompAddress1 = P1; CompAddress2 = CompAddress1 + 0x80; CompAddress3 = CompAddress1 + 0x90; HwDelay(20); // etc... You also need to make up your mind where you will put that opening brace: either on a line of its own or or the end of a line - but pick one and be consistent! |