Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
COMP(sim);
HAL_PIN(amp) = 0.1;
HAL_PIN(freq) = 0.1591549;
HAL_PIN(sin) = 0.0;
HAL_PIN(cos) = 0.0;
HAL_PIN(square) = 0.0;
HAL_PIN(vel) = 0.0;
HAL_PIN(res) = 100000.0;
MEM(float time) = 0.0;
RT_IN(
float amp_ = PIN(amp);
float freq_ = PIN(freq);
float sin_;
float cos_;
float r = PIN(res);
float square_;
time += period;
if(freq_ * time >= 2.0 * M_PI){
time = 0.0;
}
sin_ = amp_ * sinf(freq_ * time);
cos_ = amp_ * cosf(freq_ * time);
PIN(sin) = mod(((int)(sin_ * r)) / r);
PIN(cos) = mod(((int)(cos_ * r)) / r);
PIN(square) = (sin_ > 0.0) ? (amp_) : (-amp_);
PIN(vel) = mod(((int)(freq_ * time * r)) / r);
);
ENDCOMP;
bcba03dbeThis file is pinned to the selected release. Download the original to open it in your design tool.