3 Replies Latest reply on Jun 7, 2010 4:20 AM by konstantin.dimitrov

    roblems with port configured as input

    konstantin.dimitrov

      I am trying to do something with an Encore V MCU (7C64343). The problem I am facing has been described many times yet I have been unable to make it work for me at this stage:
      On port 1 I have a few digital inputs and one output controlled by an interrupt function.
      My problem is that I can never read the actual status of the inputs, they are always 0.
      What I am doing is this:

         

      The relevant bits P1.2, P1.3 and P1.4 are configured as StdCPUInput and drive Analog High Z in the PD

      unsigned char P1;

      and then in the interrupt function (executed around 100 times per second):

      P1=PRT1DR; // supposedly reads the actual input states
      P1^=0x20; // swinging the output pin
      PRT1DR=P1; // update the output

      Everywhere else in the code I only use P1 as read from the code above.
      Where is my problem here?

      Thanks!