Brett vorm Kopf bei Simulation
Hallo,
wie schon im Thema beschrieben habe ich anscheinend ein ziemlich großes Brett vorm Kopf.
Ich will folgenden Code simulieren:
Code:
#include <avr\io.h>
#include <math.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <util/delay.h>
uint32_t AIS_posrep_lat = 32184764;
uint32_t AIS_posrep_lon = 4857123;
uint32_t rmc_lat_min = 32185302;
uint32_t rmc_lon_min = 4855382;
float
AIS_calculate_distance (void)
{
/*local variables*/
float pyth_distance = 0;
int32_t lat_calc, lon_calc;
int32_t lat_dif = 0;
int32_t lon_dif = 0;
/*calculate x/y difference between own position
and position of processed vessel*/
lat_dif += (AIS_posrep_lat - rmc_lat_min);
lon_dif += (AIS_posrep_lon - rmc_lon_min);
/*convert to nautical miles*/
lat_dif /= 10000;
lon_dif /= 10000;
lat_calc = lat_dif;
lon_calc = lon_dif;
//char buf23 [15];
//ltoa (lat_dif, buf23, 10);
//glcd_print (0,13, &buf23 [0]);
//ltoa (lon_dif, buf23, 10);
//glcd_print (10, 13, &buf23 [0]);
/*get squared value*/
lat_calc *= lat_calc;
lon_calc *= lon_calc;
/*calculate square root*/
pyth_distance = sqrt((lat_calc + lon_calc));
//ltoa (pyth_distance, buf23, 10);
//glcd_print (15, 13, &buf23 [0]);
return pyth_distance;
}/*AIS_calculate_distance*/
/*'main' initializes periphery and calls subroutines*/
int
main (void)
{
while (1)
{
uint8_t tempi = 0;
tempi = AIS_calculate_distance ();
}
return 0;
}
...aber ich kann die die Variablen (lat_dif und lon_dif) etc. nicht sehen (Location not valid.
Was mache ich hier falsch?
Vielen Dank!
MfG, Marten83