This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

good code bad answer

my code is 110% correct; eg no errors and runs properly. see.

int _val;

int myfunc2(int val)
{
  _val = val;
   return _val;
};

int Bar(int val)
{
  return _val + val + 1;
};

void myfunc1(int val)
{
  _val += Bar(val);
};

etc
etc
etc

it doesnt give me the right answer sometime.

HEEEEEEEELLLLLLLPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

Parents
  • Yes, that sounds pretty nasty.
    Mine lived on for a long time undetected. Then, starting at a particular release, it was relatively easy to reproduce (reason remains a big mystery, still). The timing margins addressing an external analog output via the SPI bus were not conservative enough, so that some (one?) of the 12 bits heading towards one of the DAC's banks ended up nowhere or at an identical, separate DAC (there is a chip select there). Because the DAC have a shift register to input the data, even the loss of 1 bit meant huge swings! That was fun to watch :-) but much more fun to see with a scope and solve...

Reply
  • Yes, that sounds pretty nasty.
    Mine lived on for a long time undetected. Then, starting at a particular release, it was relatively easy to reproduce (reason remains a big mystery, still). The timing margins addressing an external analog output via the SPI bus were not conservative enough, so that some (one?) of the 12 bits heading towards one of the DAC's banks ended up nowhere or at an identical, separate DAC (there is a chip select there). Because the DAC have a shift register to input the data, even the loss of 1 bit meant huge swings! That was fun to watch :-) but much more fun to see with a scope and solve...

Children