function Programmed_Signal=ProgSWGenerator(On_time,Off_time)
%#codegen
%Persistent variable are used to model state.
persistent On_counter;
persistent Off_counter;
persistent On;
if isempty(On_counter) && isempty(Off_counter) && isempty(On)
    On_counter=1;
    Off_counter=1;
    On=true;
end

if On==true
    Programmed_Signal=true;
    if On_counter<50*On_time 
        On_counter=On_counter+1;
    else
        %Reset Counter
        On_counter=1;
        On=false;
    end
else
     Programmed_Signal=false;
    if Off_counter<50*Off_time 
        Off_counter=Off_counter+1;
    else
        %Reset Counter
        Off_counter=1;
        On=true;
    end
end

