Hi
I have a custom DSP board with TMS320F28335 that has GPIO port to use GPIO as input on GPIO 33,34 and 35. I want to use these three GPIO inputs to chek the states of Hall sensors to drive BLDC machine. I have defined hall sensor as:
#define Hall_A_ON (GpioDataRegs.GPBSET.bit.GPIO33 = 1); // Hall a-->1
#define Hall_A_OFF (GpioDataRegs.GPBCLEAR.bit.GPIO33 = 1); //Hall a-->0
#define Hall_B_ON (GpioDataRegs.GPBSET.bit.GPIO34 = 1); // Hall a-->1
#define Hall_B_OFF (GpioDataRegs.GPBCLEAR.bit.GPIO34 = 1); //Hall a-->0
#define Hall_C_ON (GpioDataRegs.GPBSET.bit.GPIO35 = 1); // Hall a-->1
#define Hall_C_OFF (GpioDataRegs.GPBCLEAR.bit.GPIO35 = 1); //Hall a-->0
I have also configured GPIO ports as input
GpioCtrlRegs.GPBMUX1.bit.GPIO33 = 0; // Set GPIO function of the pins
GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0;
GpioCtrlRegs.GPBMUX1.bit.GPIO35 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO33 = 0; // Set GPIO as inputs
GpioCtrlRegs.GPBDIR.bit.GPIO34 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO35 = 0;
GpioCtrlRegs.GPBPUD.bit.GPIO33 = 0; // Enable pullup on GPIO33
GpioCtrlRegs.GPBPUD.bit.GPIO34 = 0;
GpioCtrlRegs.GPBPUD.bit.GPIO35 = 0;
My question is how I can use if else statement using GPIO signal
for example
if(Hall_A ==1)
Iq=500; // Where Iq is an arbitrary signal to generate square wave
if(Hall_A==0)
Iq=-500;
Best Regards
Shahid Atiq