Keil Logo

C16x/ST10 Bit I/O Example Program

This example program shows how to:

  • Declare a Special Function Register (SFR)
  • Declare a Bit in a Bit-Addressable SFR
  • Configure an I/O Port Pin as an Input or Output
  • Read an Input Pin
  • Write an Output Pin

It works with virtually all devices that are 100%-compatible with the C167 and Port 7.

You can test this program using the uVision2 Debugger. I/O Ports are completely simulated (input and output) so you can change the state of the P7.0 input and watch the state of the P7.4 output as it changes.

Buttons are defined for the toolbox which set and clear the P7.0 pin (see the DEBUG.INI file). You may use these buttons to change the state of P7.0.

To test this example program:

  1. Start the debugger.
  2. Click on Debug - Go to run the program.
  3. Make sure that View - Periodic Window Update is checked.
  4. Click Peripherals - I/O-Ports - Port 7 to view P1.
  5. Click on the Set P7.0 and Clr P7.0 toolbox buttons.
  6. Watch as P7.4 changes to match P7.0.
C16X_BITIO.ZIP (7.6K)
Tuesday, July 2, 2002
  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.