Altera_Forum
Honored Contributor
14 years agoHelp wanted, C to state machines, or any alternatives.
Hi,
i need help, im a student doing my project. i run the Matlab simulation perfectly in matlab using the simulink models. i need to control 3 phase switches using the altera deo nano FPGA. is there a way can i convert the codings into state machines? thank u very much. function [sw_a, sw_b, sw_c, aa, bb, cc] = DLL(Ia_error, Ib_error, Ic_error, hysteresis_band, a, b, c) % sw_a, sw_b and sw_c are the switching gate signals h = hysteresis_band; % Phase a: if (Ia_error >= h) sw_a = 1; elseif (Ia_error <= -h) sw_a = 0; else sw_a = a; end aa = sw_a; % Phase b: if (Ib_error >= h) sw_b = 1; elseif (Ib_error <= -h) sw_b = 0; else sw_b = b; end bb = sw_b; % Phase c: if (Ic_error >= h) sw_c = 1; elseif (Ic_error <= -h) sw_c = 0; else sw_c = c; end cc = sw_c; end