I would like to simply analyze a select-case portion of my code and find how many instructions are there between.
To be able to do this, I am trying to use XTA. However, I cant seem to get it working,
A few questions:
1) How to analyze such a select-case portion, by loop points, or endpoints, what is the difference and how to define them correctly?
2) Usually the code portion is Unresolved, how to resolve that issue?
Example code,
Code: Select all
select
{
case tmr3 when timerafter(time3) :> void :
//START ANALYSIS HERE!
//Measure start time
////debug_timer :> start_time;
//Initialize messaging
InitializeMessaging(i2c_interface);
// For Left Sensor
// Read from high and low byte respectively
high_byte = i2c_interface.read_reg(getDistanceSensorAddr(LEFT_DISTANCE_SENSOR_ID), 0x02, result);
low_byte = i2c_interface.read_reg(getDistanceSensorAddr(LEFT_DISTANCE_SENSOR_ID), 0x03, result);
// Construct the distance information in centimeters
acc = (high_byte * 256) + low_byte;
if ((acc < 600) && (acc > 0)) // Distance should be in between 600cm and 0cm
{
left = acc;
}
else
{
left = 0;
}
//printf("y\n");
// For Right Sensor
// Read from high and low byte respectively
high_byte = i2c_interface.read_reg(getDistanceSensorAddr(RIGHT_DISTANCE_SENSOR_ID), 0x02, result);
low_byte = i2c_interface.read_reg(getDistanceSensorAddr(RIGHT_DISTANCE_SENSOR_ID), 0x03, result);
// Construct the distance information in centimeters
acc = (high_byte * 256) + low_byte;
if ((acc < 600) && (acc > 0)) // Distance should be in between 600cm and 0cm
{
right = acc;
}
else
{
right = 0;
}
//printf("z\n");
// For Front Sensor
// Read from high and low byte respectively
high_byte = i2c_interface.read_reg(getDistanceSensorAddr(FRONT_DISTANCE_SENSOR_ID), 0x02, result);
low_byte = i2c_interface.read_reg(getDistanceSensorAddr(FRONT_DISTANCE_SENSOR_ID), 0x03, result);
// Construct the distance information in centimeters
acc = (high_byte * 256) + low_byte;
if ((acc < 600) && (acc > 0)) // Distance should be in between 600cm and 0cm
{
front = acc;
}
else
{
front = 0;
}
// For Rear Sensor
// Read from high and low byte respectively
high_byte = i2c_interface.read_reg(getDistanceSensorAddr(REAR_DISTANCE_SENSOR_ID), 0x02, result);
low_byte = i2c_interface.read_reg(getDistanceSensorAddr(REAR_DISTANCE_SENSOR_ID), 0x03, result);
// Construct the distance information in centimeters
acc = (high_byte * 256) + low_byte;
if ((acc < 600) && (acc > 0)) // Distance should be in between 600cm and 0cm
{
rear = acc;
}
else
{
rear = 0;
}
// Send sensor values all together
sensors_interface.ShareDistanceSensorValues (left, right, front, rear);
// Delay
time3 += delay3;
//Measure end time
////debug_timer :> end_time;
////printf("SONAR t: %u", end_time - start_time);
//STOP ANALYSIS HERE!
break;
}
Thanks, best regards