Hi to all,
I'd like to control a DC motor (5A as nominal current, 14A as stall current) using a driver like VNH2SP30 (do you know an equivalent Cypress power DC driver?), I have done logic using SHADOW REGISTERS (to read buttons and to control leds or driver inputs) and GPIO interrupt (to read the encoder) (like AN2094). Also I have a PWM to control the motor. I have done all tests using port0 like input port (using interrupt manage to read an encoder) and port1 like output port: it works fine! Now I'd like to use analog input to acquire sense current and other 3 analog signals, I have read that I must use only port0 like analog port (using MUX) so I have tried to change input port from port0 to port2 but I have some problems: I have always the port2 inputs to high level (1) but my buttons is open! I have changed all pins configuration like pull-up, pull-down or High Z but I have always the same problem: with or without external connections the pin output is always 5V! I have connected my button between 5Vdc and input pin without any resistor (so it must be PULL-DOWN!). Can you help me? It's very strange! I attach the programs: "EFFEZANZA_ZanzaMotor.rar" is the working project (but without analog inputs and ADC), EFFEZANZA_ZanzaMotor_Port2.rar is the project that have the pins problems.
I have checked both your projects, and think that this error should not occur.
Can you try to find if there are any issues with the hardware?