Hi CrackJack,
A quick overview of your code pointed out 2 things: 1) Your digital I/O settings are referencing analog input channels. As this is not the expected input, these settings are most likely the cause of the error. 2) A DAQmx Clear Task would probably be a good replacement for the Stop Task as you are never releasing the resources. This could present problems for you down the road. Hopefully this helps!

* Please keep one issue per thread
Regards,
h_baker
National Instruments
Applications Engineer