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

Power on reset problem

If I power up my board the code runs but not properly, it appears to skip through delay routines instantly which is preventing correct initiation of some of the external devices.
...but if I then use the reset button on the board everything works fine.

The uc is a Philips 80C31 running at 11MHz.
The board has the reset circuitry as per the data sheet. Does anyone have any ideas as to what is going on here and what I can do to fix it? - I am going to try a longer RC period on the reset pin.


Many thanks

Parents
  • Hi Neil,

    Just a suggestion - unfortunatly I am unable to test if true - but is it possible that the compiler is optimising out the delay?
    Consider if you have the the following:-

    int delay;
    
    for (delay = 0; delay <= 32000; delay++)
    {
    /* dummy loop to provide delay */
    /* with either nothing inside the loop */
    /* or something eg. x=delay; that the compiler can safely be mode outside the loop */
    }
    

    then a 'good' compiler would see this code as apparently doing nothing and in all probability would optimise it out! so if you have delay loops done in a similar fashion, try declaring the loop counter as volatile and this should hopefully stop the compiler from removing your delay.

    Mark :-)

Reply
  • Hi Neil,

    Just a suggestion - unfortunatly I am unable to test if true - but is it possible that the compiler is optimising out the delay?
    Consider if you have the the following:-

    int delay;
    
    for (delay = 0; delay <= 32000; delay++)
    {
    /* dummy loop to provide delay */
    /* with either nothing inside the loop */
    /* or something eg. x=delay; that the compiler can safely be mode outside the loop */
    }
    

    then a 'good' compiler would see this code as apparently doing nothing and in all probability would optimise it out! so if you have delay loops done in a similar fashion, try declaring the loop counter as volatile and this should hopefully stop the compiler from removing your delay.

    Mark :-)

Children
No data