Go Down

Topic: Problem with modulo (%) and reset (Read 14 times) previous topic - next topic


just observed this statement in your code

#undef int

What is its purpose?
Does the problem exists when you remove that line?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Actually I do not know why there is #undef int.
I pick the code where I started somewhere and it was there.

But removing it does not help.  Works exactly same way.

Mike Murdock

I don't know about the reset problem, but your code may not work correctly unless you change some of your constants:
Code: [Select]
1000000should be
Code: [Select]
Code: [Select]
50000should be
Code: [Select]




Dec 30, 2010, 12:25 am Last Edit: Dec 30, 2010, 12:33 am by retrolefty Reason: 1
the reset signal stays 5 V, goes to 0 V and the over 7 V and then back to
5 V.

When the reset is being done via the DTR/RTS signal from the serial FTDI chip, by way to the Arduino IDE or any PC application that is opening or closing that comm port, it is capacitance coupled to the reset pin by a .1mfd cap, so the overshoot to +7vdc is just a transent pulse caused by the discharging of the cap and should not be a concern nor have any effect on the chip. The reset pin unlike all the other pins is rated for a much higher voltage, +12vdc I think, because that is the mechanism to allow the chip to utilize a different high voltage programming mode. All the ugly details are in the AVR datasheet for the chip.

The biggest is that WHY Arduino
hangs when Reset or Interrupt is done during %-operation???

This has nothing to do with the hardware reset circuitry, just some software mistake or error not yet solved by you or us.  ;)



.. +7vdc is just a transent pulse ...

Anyway, after reset button or normal reset from PC it does not reset
correctly like it does when power on or upload program.  And the signal from osciloscope is different between those two cases.

Still the buggest problem is that WHY Arduiono goes on that kind of state.   No I'm not bold enough to use %-operator in my code...

And for Mike:  for some reason it works same way (= correct when reset happens to work) if there is 500000 or 500000L. You are right that it should have L, but seems to be ok without also.  Still this is not the biggest point of the problem.

Go Up