When using the 8255 to glow an LED array using BSR mode, is it necessary to first set port c as an output port? Why?

In our lab, when I had not not set port C as output and directly used BSR mode to set and reset individual bits, only the 4 led's connected to the lower four bits of port C were responding. When I set port C as output, the desired output was obtained. But what is the need to set port C as output? When we are setting and resetting certain bits in port C, shouldn't port C automatically be taken as an output port?


It is widely standard practice that the output enable of bi-directional/multifunction I/O ports is affected only by the contents of the output configuration / direction register, and not by any change to the data register.

You may think of the bit set/reset mode as being special, but all it is really doing is modifying the data register. If unaltered, the output/input configuration remains as default, with port C split.

  • \$\begingroup\$ If port C is not set in output mode and we write a BSR instruction to the control register, will the write fail? \$\endgroup\$ – Ranjith Apr 22 '13 at 15:59
  • \$\begingroup\$ Check the data sheet and/or conduct a test. \$\endgroup\$ – Chris Stratton Apr 22 '13 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.