Hi, I am having trouble trying to 'translate' C code to GCBs' equivalent. Below is the specific C code, what would be the best way to write this in GSB? The MCU is the PIC16F1823 using ADC 'AN1'.
Below is the main body code, I have left off the header and footer code as it is the below logic i am having trouble converting to GCB.
Is GCB capable of this level of logic (I assume it is, but it is beyond my GCB knowledge :(
Thanks in advance guys for any help steering me in the right direction with GCB!
if(st_in>416)//CheckSTsignal
{
if(st_in<850)//checkifSTsignalistlight
{
t_out=1; //turn on t lightb_out=0;
}
if(t_out)
{
v_t=1;
}
else
{
v_t=0;
}
if((st_in>700)&&(v_t))//checkifSTsignalisbandtlightison
{
b_out=1; //turn on b lightt_out=1;
}
if((st_in>700)&&(!v_t))//checkifSTsignalisbandtlightisoff
{
b_out=1; //turn on b light
}
}
else//ifnoSTsignal
{
b_out=0; //B light offt_out=t_in; v_t=0; //T light on flag reset
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And, the following needs validation st_in type. I would assume WORD. From an ADCRead? t_out and b_out. Could be bits, byte or a register.bit v_t Could be bit, byte or a register.bit !v_t and v_t Need to be sure what these meant... and now mean. Are they v_t = 0
and v_t = 1 respectively?
#chip16f690if(st_in>416)then'Check ST signalif(st_in<850)then'check if ST signal is t lightt_out=1'turn on t lightb_out=0endifif(t_out=1)thenv_t=1elsev_t=0endifif((st_in>700)&(v_t=1))then'check if ST signal is b and t light is onb_out=1//turnonblightt_out=1endifif((st_in>700)&(!v_t=0))then'check if ST signal is b and t light is offb_out=1//turnonblightendifelse'if no ST signalb_out=0//Blightofft_out=t_inv_t=0//Tlightonflagresetendif
EDITED: Changed to code that compiles
EDIT.... This code should be very short. The code code be relationised to a lot less code!!
Last edit: Anobium 2020-08-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I am having trouble trying to 'translate' C code to GCBs' equivalent. Below is the specific C code, what would be the best way to write this in GSB? The MCU is the PIC16F1823 using ADC 'AN1'.
Below is the main body code, I have left off the header and footer code as it is the below logic i am having trouble converting to GCB.
Is GCB capable of this level of logic (I assume it is, but it is beyond my GCB knowledge :(
Thanks in advance guys for any help steering me in the right direction with GCB!
Not to hard to do this. Rules
And, the following needs validation
st_in
type. I would assume WORD. From an ADCRead?t_out
andb_out
. Could be bits, byte or a register.bitv_t
Could be bit, byte or a register.bit!v_t
andv_t
Need to be sure what these meant... and now mean. Are theyv_t = 0
and
v_t = 1
respectively?EDITED: Changed to code that compiles
EDIT.... This code should be very short. The code code be relationised to a lot less code!!
Last edit: Anobium 2020-08-17