Power external circuit and motor and read in analog voltage

I've got a project going in C++, and I need to be able to provide 5V DC at about 20mA to a circuit while reading out an output voltage of that circuit, which I expect to look like a square wave between 0V and 5V at 10-80 Hz with a 5% duty cycle. I need to attach a timestamp (with an accuracy of about 1ms) to each rising edge of the square wave, and send those timestamps to my C++ program. The program will also send instructions to the board to control the input voltage to a motor, which will be up to 12V DC and 3A.

My only experience with this sort of thing is with an FPGA board a while ago, and while I have some knowledge of circuits, I'm not sure what board would be required for this application, or what the system would look like, or even how to interface with the C++ program. Is acting as a 5V power supply as simple as just setting an output pin to 5V? How do I program the board to look for rising edges of the square wave? What component should I use to control the motor voltage, and how do I control it, assuming I have a 12V DC supply available?

Any help is greatly appreciated.

FearfulFerret: ...I need to be able to provide 5V DC at about 20mA to a circuit while reading out an output voltage of that circuit, which I expect to look like a square wave between 0V and 5V at 10-80 Hz with a 5% duty cycle. OK I need to attach a timestamp (with an accuracy of about 1ms) to each rising edge of the square wave, and send those timestamps to my C++ program. Wow! The program will also send instructions to the board to control the input voltage to a motor, which will be up to 12V DC and 3A.

Is acting as a 5V power supply as simple as just setting an output pin to 5V? If that "20mA" is the real deal then 'yes'. Probably better to use an output pin to activate a reed relay which would turn on/off 5V How do I program the board to look for rising edges of the square wave? There are two pins that can be configured for "external interrupt". http://www.gammon.com.au/forum/?id=11488 What component should I use to control the motor voltage, and how do I control it, assuming I have a 12V DC supply available? "Control" means you want to vary the speed and/or direction? If just the speed then a MOSFET and analogWrite (PWM), if also direction then you will need an H-Bridge (possibly relays or likely semiconductors)

edit.. added link

Is the 1ms accuracy target feasible, and are there any programming tricks or selection of hardware that would help to reach that target?

I'm planning on getting an Uno for this project. Would this board suit my needs, or would you suggest another?

I don't know of an "RTC" or sim. with a 1ms accurate readout. When you posted "I need to attach a timestamp (with an accuracy of about 1ms) to each rising edge of the square wave", I interpret that as meaning that you want this rising-edge to trigger a time-stamp that knocks out, basically, which millisecond of the 86,400,000 milliseconds (24h x 60m x 60s x 1000) in a day that the rising-edge occurred on. Am I getting that right? Maybe there's a way that that could be integrated with a millis-based object, but I'm not up-to-speed where I could say, "yes, definitely".

Yes, that's correct. Here's my rough plan:

C++ first sends some signal to the board and internally records the timestamp of when the signal was sent; the board makes a millis() call when it gets the signal and subtracts the value of that call from future millis() calls. The list of timestamps will then be referenced from that initial handshake.

I'm not at all certain how to interface with the board using C++, and so I don't know how such a handshake would be made or how much time would pass between the program sending the signal and the board making the millis() call.