Go Down

Topic: I not have idea. (Read 459 times) previous topic - next topic

I have a very strange error. Whit this code, my Arduino Mega 2560 (I test this problem with an UNO whit the same error).

If I use a noInterrupt it work.

Code: [Select]

//     noInterrupts();
    bitWrite(_Booleanas[SetPointID / 8], SetPointID % 8, Valor);
//     interrupts();


I don't think than the interrups been the problems. And, it is a very strange error, because, sometimes work and sometimes not work.

What I start to prove?

Thanks

Leonel

guix

Hello,

Show a whole example that can reproduce the problem :)

mmm, this is a problem, this project is big, this library have more than 1000 lines of code just in the header file (including the doxygen documentation).

But the error is always in the same line.

Another thing that I forgot is that if I add a delay instead of "interrupt" also work (sometimes yes, sometimes no...).

The name of the project is OpenMolo an Open Source PLC (industrial control).

The site of the project (in Spanish only) is:

http://libre.backupnet.com.ar/I1159-Open+Molo

And the documentation (in Spanish too) is:

http://repositorio.libre.backupnet.com.ar/OpenMolo/OpenMoloDOC/html/index.html

SVN: svn://svn.backupnet.com.ar/OpenMolo

The library whit this problem is SetPoints (OpenMolo/trunk/Librerias/SetPoints - Line 212) on the example of Almacenamiento (storage).

In other words... How many things can do arduino reset?

This error is strange because, I'm doing a simple arithmetic integer calculations, using a array that the index never is exceeded and bitWrite?

I just thik that it can be, because the PC stack is overflowed.

Thanks.

guix

Make a new little script that can reproduce the exact problem.

And also, explain the problem better than "sometimes work sometimes not".

Nick Gammon


Code: [Select]

   bitWrite(_Booleanas[SetPointID / 8], SetPointID % 8, Valor);


... it is a very strange error, because, sometimes work and sometimes not work.


Be reasonable. How can we be expected to debug one line of code? That sometimes works? You haven't even said how _Booleanas, SetPointID or Valor are defined.

Do you use the String class? Do you do dynamic memory allocation? Are you using Serial comms? Are you using interrupts?

And what is "working"? It crashes? Gives the wrong results? No results?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up