binary counter and 10 bit output

i am new to arduino and c programming. so need all the available help. i have worked a lot in analog and plc. the problem before me is in a way very simple.

i want to read number of pulses on a pin for a fixed duration with another input acting as count enable. next the value is to be out put to the arduino pins as binary word 10 bits for furthur conversion with r2r ladder. also the previous value should be latched when the count enable goes low.

can anybody help???? thanks in advance

int counter = 0; // good for fifteen bits
while (!enable);  // wait for enable
while (enable) {
  counter ++;
}
outputToLadder (counter);

the value is to be out put to the arduino pins as binary word 10 bits for furthur conversion with r2r ladder.

So does that mean you will have 10 arduino output pins you want to put the value to? If so that will be very difficult because the R/2R ladder will have to be in a very tight ratio in order to give you 10 bits output monotonically.

the counter code looks good and i will try to implement it. yes i need a 10bit output at the arduino pins and will implement the r2r as accurate as needed. thanks for reply to both of you