So you are trying to count TTL pulses for 4ms periods then raster scan an image of fluorescence image, pixel by pixel? I had done something like this in the past it is not so hard, you will need 2 counters to do this. Configure the first counter to count events while high (assuming the TTL pulse is not comming in too fast to count) and configure the source of the TTL to the PFI line attached to your PMT signal. Now set the second to counter to put out a singal pulse (not a pulse train) of 4ms wide. Configure your first counter to have its gate pin as the output of the secont counter. Now everytime the second counter goesw high (configured for 4ms) the events will be counted. Now for your image algorithm in 2D:
Configure Counters()
For each Pixel{
Pulse_Counter_2
Read_A_Point_Counter_1
Move_Stage
}
Save the values of the counter1 in a 2d array and feed this to an intensity plot for a quick visualization. Sorry I didnt have time to code this up for you.
Paul