Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/21/10 02:14
Read: times


 
#179222 - arrays on port pins - how do I define it?
Hi all

I have a number of Tri colour LEDs connected to port pins that I would like to manage in the form of an array

I am having trouble defining the array as it is associated with physical port pins.

here is the definition
sbit po_LED_Tri102_1	= P3^0;
sbit po_LED_Tri102_2	= P3^1;
sbit po_LED_Tri102_3	= P3^2;
sbit po_LED_Tri103_1	= P3^3;
sbit po_LED_Tri103_2	= P3^4;
sbit po_LED_Tri103_3	= P3^5;

#define LED_TRI_RED_1        po_LED_Tri102_1
#define LED_TRI_GRN_1        po_LED_Tri102_2
#define LED_TRI_BLU_1        po_LED_Tri102_3

#define LED_TRI_RED_2        po_LED_Tri103_1
#define LED_TRI_GRN_2        po_LED_Tri103_2
#define LED_TRI_BLU_2        po_LED_Tri103_3



 




and here is how I want to feed the RED LEDs into an array, I believe the issue is that this is actually trying to define the array at runtime, when all that I really want to do is run it preprocessing time.





bdata sbRED_LED[2];
bdata sbGRN_LED[2];
bdata sbBLU_LED[2];


void funInitLedArray(void);

void funInitLedArray(void){
unsigned char i;

    for (i = 0; i < NUM_OF_TRI_LEDS; i++){

        sbRED_LED[i] =  #LED_TRI_RED_ ## i;
        sbGRN_LED[i];
        sbBLU_LED[i];
    
    }



}

 



Any thoughts on how this is best achieved?

Thanks for the help

Regards

Marshall


List of 2 messages in thread
TopicAuthorDate
arrays on port pins - how do I define it?            01/01/70 00:00      
   Work with the port byte instead of bits            01/01/70 00:00      

Back to Subject List