For loop problems, two deep

In this program, I have a function where I have two for loops. Here's an example:

"for (j = 0; j < 3; j++)
{
for (i = 0; i < 8; i++)
{
time = 1612 - (4 * i);
wait ();
}
if (j < 2)
{
time = 1588;
wait ();
while (incoming);
}
}"

Well, the software simulation works perfectly. However, when I try programming a chip and implimenting it, it gets stuck somewhere in this loop. Do any of you happen to know why? Thanks

Parents
  • Well, since you didn't specify the data types for i and j, or the wait function, or how time is used (and its data type), and what incoming does and is set to...

    My guess is that it is hanging in while(incoming). But, that's just a WAG and is probably not correct.

    If it works under simulation then there's something in your hardware that you must not be simulating.

    Jon

Reply
  • Well, since you didn't specify the data types for i and j, or the wait function, or how time is used (and its data type), and what incoming does and is set to...

    My guess is that it is hanging in while(incoming). But, that's just a WAG and is probably not correct.

    If it works under simulation then there's something in your hardware that you must not be simulating.

    Jon

Children
More questions in this forum