Pages: [1]   Go Down
Author Topic: I not have idea.  (Read 384 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 2
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
//     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
Logged

France
Offline Offline
Edison Member
*
Karma: 37
Posts: 1008
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

Show a whole example that can reproduce the problem smiley
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

France
Offline Offline
Edison Member
*
Karma: 37
Posts: 1008
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18781
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
   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?
Logged


Pages: [1]   Go Up
Jump to: