Keil Logo

µVISION DEBUGGER: HOW TO CONNECT TWO PORT PINS


Information in this article applies to:

  • µVision Version 2 and Later

QUESTION

I need to simulate a connection between two port pins. Is this possible to do in the µVision simulator?

ANSWER

Yes. You must create a signal function that copies the output port pin to the input port pin. In general, the steps to do this are:

  1. Use the wwatch function to wait for the Output PORTx VTReg to get written.
  2. Read the pin value from the Output PORTx VTReg.
  3. Write the pin value to the Input PORTx VTReg.

The following example connects the Output Pin (PORT1.7) to the Input Pin (PORT2.1). The application must configure P1.7 as an output and P2.1 as an input:

/* define port_loopback function */
signal void port_loopback (void) {
  printf("loopback signal function is started\n");
  while (1) {
    wwatch (PORT1);         /* wait for PORT1 (VTR) access      */
    if (PORT1 & 0x80) {     /* set PORT2.1 depending on PORT1.7 */
      PORT2 |= 0x02;
    } else {
      PORT2 &= ~0x02;
    }
  }
}

/* start port_loopback function */
port_loopback()

SEE ALSO

Last Reviewed: Wednesday, October 12, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.