Go Down

Topic: How to do parallel output efficiently (Read 1 time) previous topic - next topic

swseansw

Hi, ,i am an arduino beginner. i have a programming problem. Is there any efficient way to do the digital parallel output. While programming directly to AVR, we only need to give the data to PORTXn.
I use the following function to do so. But it may take a little long to finish writing. So i hope somebody can help me.
Thanks. :)
Code: [Select]

int Dpin[]={3,4,5,6,7,8,9,10};

void sendPin(byte j)
{
       for (int n=0;n<8;n++)
     {
           if((0x01&j) < 0x01)
               {digitalWrite(Dpin[n],LOW);}
               else
               {digitalWrite(Dpin[n],HIGH);}
           j>>=1;
     }
}


PaulS


swseansw

Hi,PaulS
thank you so much. Would you please give me some suggestion or recommend some material about systematical Arduino programming learning?

PaulS

There's the whole reference section to be read and understood. Once you've done that, you'll know what else you need to learn. Asking specific questions will result in better answers than very vague "What should I study?" questions.

Go Up