View unanswered posts | View active topics It is currently Sun Dec 21, 2014 3:16 am






Reply to topic  [ 7 posts ] 
Loop inside ROBOTC IDE or COMPILER... 
Author Message
Rookie

Joined: Sun Apr 15, 2007 8:33 am
Posts: 40
Location: USA
Post Loop inside ROBOTC IDE or COMPILER...
Hi,

I have a source program that I cannot open anymore from ROBOTC IDE.
I can open it from MS-VS, NotePad,... without any issue...
The task manager display ROBOTC.EXE 100% CPU busy...
In fact I stay stuck on the ROBOTC splash screen...

any help welcome.

thanks.

jm.

_________________
SuntzuMaster- a French gentlemen in USA.


Mon May 21, 2007 9:01 pm
Profile
Rookie

Joined: Sun Apr 15, 2007 8:33 am
Posts: 40
Location: USA
Post 
PS: I am using the ROBOTC v 1.05.

_________________
SuntzuMaster- a French gentlemen in USA.


Mon May 21, 2007 9:02 pm
Profile
Rookie

Joined: Sun Apr 15, 2007 8:33 am
Posts: 40
Location: USA
Post 
I found the code that is creating trouble and that the compiler loop....

I think that some compiler debug should be done... This code is a development in progress... If needed I can send or post the fulll source program.

thanks.

jm.


inline bool I2C_Convers(const tSensors I2C_Port,const unsigned byte I2C_Bus_Addr ,const unsigned byte I2C_RegIndex, ubyte *I2C_Reply, unsigned int I2C_Reply_Length, int nDelay)
{
TI2C_Output I2C_Output;
int nI2C_BytesReady = 0;
bool bRecv0 = true;
bool bRecv1 = true;

while (true)
{
nI2C_BytesReady = 0;
I2C_Output.nMsgSize = 2;
I2C_Output.I2C_Bus_Addr = I2C_Bus_Addr;
I2C_Output.I2C_RegIndex = I2C_RegIndex;

memset(I2C_Reply,0x00,I2C_Reply_Length);

nI2CBytesReady[I2C_Port] = 0;
nI2CRetries = 5;

bRecv0 = true;
while(bRecv0)
{
sendI2CMsg(I2C_Port,I2C_Output.nMsgSize,0);
switch(nI2CStatus[I2C_Port])
{
case NO_ERR:
while(nI2C_BytesReady < I2C_Reply_Length)
{
nI2C_BytesReady = nI2CBytesReady[I2C_Port];
wait1Msec(1);
}
readI2CReply(I2C_Port,I2C_Reply,I2C_Reply_Length);
bRecv0 = false;
break;

case STAT_COMM_PENDING:
wait1Msec(1);
continue;
break;

default:
case ERR_COMM_BUS_ERR:
return(false);
break;
}
}

bRecv1 = true;
while(bRecv1)
{
sendI2CMsg(I2C_Port,I2C_Output.nMsgSize,I2C_Reply_Length);
switch(nI2CStatus[I2C_Port])
{
case NO_ERR:
while(nI2C_BytesReady < I2C_Reply_Length)
{
nI2C_BytesReady = nI2CBytesReady[I2C_Port];
wait1Msec(1);
}
readI2CReply(I2C_Port,I2C_Reply,I2C_Reply_Length);
bRecv1 = false;
break;

case STAT_COMM_PENDING:
wait1Msec(1);
continue;
break;

default:
case ERR_COMM_BUS_ERR:
return(false);
break;
}
}

break;
}

wait1Msec(nDelay);
return(true);
}

_________________
SuntzuMaster- a French gentlemen in USA.


Tue May 22, 2007 8:19 am
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 616
Post 
You can manually reset RobotC's IDE by deleting the following registry values through regedit.

HKEY_CURRENT_USER\Software\Robotics Academy\RobotC

This should reset your RobotC and fix the compiler issue.

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Tue May 29, 2007 9:25 am
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post 
This is a new bug in the RobotC compiler. The compiler goes into an infinite loop when a "continue" statement is used within a "switch" block.

This is corrected in version 1.06.

There are a couple of other problems in your program that you should correct as well. Replace the "*" with a "&" in the function declaration. While RobotC accepts this syntax today this is an anomoly (i.e. bug or unsupported function) and RobotC treats this as a "&". In future, you may get compile errors if RobotC supports proper pointer variables.

I would recommend removing the "inline" qualifier from your function declaration as well.


Wed May 30, 2007 1:35 am
Profile
Rookie

Joined: Sun Apr 15, 2007 8:33 am
Posts: 40
Location: USA
Post 
I am using "inline" because I call that function from two different tasks.
Is that something that is not appropriate from ROBOTC compiler standard?
I was thinking that the "&" was used to pass a parameter to a function by address and then the function prototype have to use "int * x" to tell that a parameter is an address to an integer?

I am still very "C" ANSI, "C++" and "C#" then because I was unable to find a language reference book about ROBOTC I tried to guess what can be done based on my "C" skills... By the way any idea on when more documentation could be available?

Does ROBOTC support pointeur based algebra?

Could you tell me what is the right way to concatenate string variables:
in "C" I was used to "strcat, strncat,..." I found that wiith ROBOTC I can used s1 = s2 + s3 + s4.... looks like "C#" or even "Java" is that the right way to do that?

I think that I have found another bug... I have to test it again and if I am able to reproduce it I shall post a new open issue on the bug tracker application.

thanks

jm.

PS: When does the 1.06 be available?.

_________________
SuntzuMaster- a French gentlemen in USA.


Wed May 30, 2007 7:45 pm
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post 
ROBOTC does not support pointer variables. Not because they're difficult to support but because they introduce too much risk in thing going awry without an easy way to figure out why.

ROBOTC does support the standard "call by reference" variables found in C++. Which incidently, utilize pointers but in a controlled fashion managed by the compiler. You simply declare your function variables with the "&" qualifier to indicate that it is a call-by-reference variable. When you call function, the compiler will generate a reference (i.e. pointre containing the address) for the variable. All accesses to the function variable will use this pointer value; this is a convenient way to have the function update values of its parameters and have the results returned to the calling program.


Fri Jun 22, 2007 6:33 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

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:  
cron



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