Commit 1e9b2e6d authored by lcgamboa's avatar lcgamboa

fix: Fix gpboard simulation clock speed.

parent 829fff56
......@@ -2,5 +2,5 @@ PACKAGE=picsimlab
MAINVER=0
MINORVER=9
VERSION=0.9.2
DATE=240324
DATE=240406
VERSION_STABLE=0.9.1
......@@ -273,13 +273,12 @@ void cboard_gpboard::Draw(void) {
}
void cboard_gpboard::Run_CPU(void) {
int i;
long int i;
// int j;
unsigned char pi;
unsigned int alm[64];
const int pinc = MGetPinCount();
// const int JUMPSTEPS = Window1.GetJUMPSTEPS ();
// //number of steps skipped
const long int NSTEP = PICSimLab.GetNSTEP(); // number of steps in 100ms
const float RNSTEP = 200.0 * pinc / NSTEP;
......@@ -294,7 +293,7 @@ void cboard_gpboard::Run_CPU(void) {
// j = JUMPSTEPS; //step counter
pi = 0;
if (PICSimLab.GetMcuPwr()) // if powered
for (i = 0; i < PICSimLab.GetNSTEP(); i++) // repeat for number of steps in 100ms
for (i = 0; i < NSTEP; i++) // repeat for number of steps in 100ms
{
/*
if (j >= JUMPSTEPS)//if number of step is bigger
......
......@@ -51,7 +51,10 @@ unsigned char bridge_gpsim_get_pin_count(void) {
}
const char* bridge_gpsim_get_pin_name(int pin) {
if (gpic) {
return gpic->get_pin_name(pin).c_str();
}
return "error";
}
unsigned char bridge_gpsim_get_pin_value(int pin) {
......@@ -107,9 +110,7 @@ void bridge_gpsim_set_apin_value(int pin, float value) {
void bridge_gpsim_step(void) {
gpic->step_cycle();
if (gpic->mCurrentPhase == ((ClockPhase*)gpic->mExecute2ndHalf)) {
gpic->step_cycle();
}
bp.clear_halt();
}
void bridge_gpsim_end(void) {
......
......@@ -83,7 +83,7 @@ void bsim_gpsim::MSetSerial(const char* port) {
void bsim_gpsim::MSetFreq(float freq_) {
freq = freq_;
bridge_gpsim_set_frequency(freq);
TimerUpdateFrequency(freq);
TimerUpdateFrequency(freq / 4.0);
}
float bsim_gpsim::MGetFreq(void) {
......@@ -99,7 +99,7 @@ void bsim_gpsim::MSetSerial(const char* port) {
}
float bsim_gpsim::MGetInstClockFreq(void) {
return freq;
return freq / 4.0;
}
int bsim_gpsim::CpuInitialized(void) {
......
......@@ -379,6 +379,8 @@ void COscilloscope::ReadPreferences(char* name, char* value) {
SetMeasure(i, measures[i]);
}
}
SetBaseTimer();
}
std::vector<std::string> COscilloscope::WritePreferencesList(void) {
......@@ -569,6 +571,7 @@ void COscilloscope::ReadPreferencesList(std::vector<std::string>& pl) {
// osc_ch2
WindowCmd(PW_MAIN, "combo3", PWA_COMBOSETTEXT, tokens[9]);
SetChannelPin(1, atoi(tokens[9]) - 1);
SetBaseTimer();
}
void COscilloscope::SetBaseTimer(void) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment