Help arduino pin codes

Have you got the greatest 48 bit multiplier ever conceived? Prove it - post your code here.

Moderator: phalanx

Post Reply
brian25
Posts: 15
Joined: Sat Jun 22, 2013 5:22 am

Help arduino pin codes

Post by brian25 » Mon Aug 12, 2013 9:01 am

Hi guys, can you control the pins of arduino simultaneously?

Is this possible using array?
Pin 1 = 11;
Pin 2 = 10;
Pin 3= 9;
Pin 4= 8;



Char Old[]= {"11, 10, 9, 8};


Void setup()
{

}


Void loop()
{
Char ;
Char new []= {"1111"};
i = new;
if (strcmp(new, "1111") == 0 && strcmp(old, "1111"){
Digitalwrite( i, high);
}

the concept is if the two variable matches it will execute the 4 pins high output at the same time and when 0000 it will execute low simultaneously..


Tnx

fusedlightning
Posts: 30
Joined: Thu Aug 16, 2012 7:39 am

Re: Help arduino pin codes

Post by fusedlightning » Mon Aug 12, 2013 12:10 pm

The Arduino language does not support simultaneous pin changing.

However, if you're feeling adventurous, you can directly access the hardware registers that control the state of these output pins. The board has 3 different pin busses, and pins on the same bus can be changed in the same instruction cycle.

Directions for the Arduino R3 (and similar) can be found here. Just be warned, if you muck with TX/RX accidentally, really strange things can happen.
http://www.arduino.cc/en/Reference/PortManipulation

waltr
Support Volunteer
Posts: 2823
Joined: Tue Sep 08, 2009 12:07 pm
Location: Philadelphia, USA

Re: Help arduino pin codes

Post by waltr » Mon Aug 12, 2013 1:54 pm

Just an FYI.
This is the PIC micro-control forum. There is a separate Arduino forum.

fusedlightning
Posts: 30
Joined: Thu Aug 16, 2012 7:39 am

Re: Help arduino pin codes

Post by fusedlightning » Mon Aug 12, 2013 8:24 pm

Thanks. Didn't look to see where it was posted before replying.

Post Reply