View unanswered posts | View active topics It is currently Tue Sep 17, 2019 10:25 am






Reply to topic  [ 1 post ] 
Strange bug with comments before #pragma compiler directive 
Author Message
Rookie

Joined: Sun Dec 27, 2009 5:46 am
Posts: 10
Post Strange bug with comments before #pragma compiler directive
I noticed a strange bug when some pragma directives are preceded by a comment. I reduced the program to the very minimum and obtained this:

Code:
// Some comment
#pragma config(Sensor, S2,              startStop,     sensorTouch)

#define SAMPLING_PERIOD 50 /* in ms */

task main()
{
    while( true ){
        nxtDisplayTextLine(0,"p");
        nxtDisplayTextLine(2, "Senso: %d", SensorValue[startStop]);
       wait1Msec(SAMPLING_PERIOD) ;
   }
}


The symptom is that I get the raw sensor value (in my case, either 180 or 1023) instead of the normal sensor value (0/1).
I also noticed that by removing the initial comment, the problem disappeared, as in:

Code:
#pragma config(Sensor, S2,              startStop,     sensorTouch)

#define SAMPLING_PERIOD 50 /* in ms */

task main()
{
    while( true ){
        nxtDisplayTextLine(0,"p");
        nxtDisplayTextLine(2, "Senso: %d", SensorValue[startStop]);
       wait1Msec(SAMPLING_PERIOD) ;
   }
}


I had already used initial comments (before the #pragma directives), but in cases I had only motors, no sensors. I didn't test with other sensors and other ports, though.
Does this also happen with everybody else's configuration? If yes, it should interest the developpers...

G. G.


Sun Jan 10, 2010 6:49 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.