AnsweredAssumed Answered

Combine bits from various registers into a virtual port

Question asked by danielhembree on Aug 28, 2013
Latest reply on Sep 5, 2013 by danielhembree

I'm sure this is a fairly straightforward answer, but it is currently beyond my capability. I have a system that uses the three I/O ports on an MC9S08SE8. The system's I/O ports are made up of a variety of the I/O pins on the MC9S08SE8. Below is an example of this. Although I would have liked to, I was unable to use the entire Port B for LEDs on my system. The last LED is on Port C.

 

#define SRC1_LED PTBD_PTBD4

#define SRC2_LED PTBD_PTBD5

#define SRC3_LED PTBD_PTBD6

#define SRC4_LED PTBD_PTBD7

#define MON1_LED PTBD_PTBD1

#define MON2_LED PTBD_PTBD2

#define MON3_LED PTBD_PTBD3

#define MONO_LED PTCD_PTCD7  

 

How can I programmatically combine these definitions and refer to them as one 'virtual port'? I initially thought a structure would do it but I don't know how to assign the definitions as members of the structure. Structures are a new concept for me anyway.

 

Thanks for the help.

 

Dan

Outcomes