This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Trouble with reading port

Other Parts Discussed in Thread: MOTORWARE

Hello

I'm using the HV Kit with InstaSPIN and the Piccolo f28968 with the Motorware. In the lab3a I wanted to read the port 22 so that I can switch on/off the motor.

I implemented the following function under the while loop in proj_lab03b.c(main):

a = GPIO_read(gpioHandle, GPIO_Number_22);

I declared the global variable in the proj_lab03b.c as follow: 

GPIO_Handle gpioHandle;

And I defined the port 22 in the function DRV_setupGpios(DRV_Handle handle) at drv.c as follow:

GPIO_setMode(obj->gpioHandle, GPIO_Number_22,Mode_GeneralPurpose);

GPIO_setDirection(obj->gpioHandle, GPIO_Number_22,GPIO_Direction_Input);

The problem is that I always read the value "0" and I don't know why. What is wrong? Can help me anybody? If I check the GPDAT Register I see that the value of the port 22 changes. It means that the port works fine, but the reading is not working properly.

Thank you in advance

Pablo