This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

question about input logic 1 to IO pin

I am building a Cypress USB-MCU AN2131QC board. I faced a problem of
setting logic 1 from pins to Port A. Would anybody please tell us why is the
code goes wrong? ^.^


#include "ezusb.h"
#include "ezregs.h"
void main()
{

  PORTACFG = 0x00;      // bits 7..0 are I/O
  OEA = 0x00;           // port A for inputs

  // wait until pin 1 of Port A is set to logic 1
  while(1)
  {
     // check input for pin 1
     if(  PINSA & bmBIT1 != 0 )
         break;
   }

  // set port B
  PORTBCFG = 0xFF;
  OEB = 0xFF;
  OUTB = 0xFF;

  // my code always come to here no matter i set pin 1 of PORT A or not.
  // Is this right for input a logic for a pin??? 
}

0