How can i solve this ADC device driver problem.

Sep 11, 2008 1 Replies

Hi. I have a ADC device which have 16 input channel. Before I start AD transfer, I must choose the range of the input channel, such as 0 to 3. I provide two argument 'start_channel', 'end_channel' to select the channels. and the value of the 'end_channel' should always larger than the value of the 'start_channel'. now I have a problem, if some users set the two argument which the value of the 'start_channel' is larger than the value of the 'end_channel' .Then how can I solve this problem?I have two choices like this:


1)set the value of 'start_channel' equal to 'end_channel' , let the whole system still can work.
2)return some information, halt the whole system.

I don't know which way is better.Please give some advices. Or, If you have more better solution, please tell me.


An error code that signifies an error should be fine, and I'm sure, pretty standard. If there is no easy way to return an error code to the calling program, just doing nothing would suffice. Your documentation should include that information and it is up to the end user to apply that knowledge accordingly. Calling conventions, argument range, and error conditions should all be part of your standard documentation.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required