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

sbit ptr? (best method for port and bit identification)

Dear all,

My board will have several inputs connected to P0-P3. The PC will instruct the microcontroller using RS232, to monitor some of the inputs.

The communication between the PC and the 8051 will be somewhat like below:

PC->8051: 
   count the state changes on P0.3
   count the state changes on P0.6
                :
                :
   inform me on any change of the state of P1.5
   inform me on any change of the state of P3.4
                :
                :

This way, I'm trying to build a generic data acquision board which will be configured by the PC.

However, not to use a "case" statement for every bit of every port on the microcontroller, it should use somewhat like sbit pointer.

Is this possible?

Or what is the best way to find which bit of the which port to listen, using the information of [x, y] provided by PC (where x is the port number, and y is the bit offset in the port).

Regards,

0