Hi Rob,

Thanks for the tips. 
The device is a 10f222 and has only an 8 bit dac, I would assume that it 
would only have one result register and not require the hi and low bytes. 
Is this so?

Regards
Clive

On Sunday, 23 June 2013 09:28:27 UTC+1, RobH wrote:
>
>
> Hi Speedy23 
>
> Please sign your messages with your real (first) name. 
>
> Op 21-6-2013 21:08, speedy23 schreef: 
>
> > I have been scratching my head to work out a routine that would return 
> > true if the result from an AD conversion is within a certain range. 
> > For example 
> > if ADRES >= 40 and ADRES <=60 then Interval = 5000 
> > else Interval = 1200 
> > Most things that seem logical fail. 
> > Any help/suggestions would greatly appreciated. 
>
> Well, in the first place: assuming you are using the Jallib ADC library 
> - why would you place your message here otherwise - you have nothing to 
> to with ADRES. The ADC value is returned by the functions 
> adc_read_high_res (a word) or adc_read_low_res (a byte). 
> When you have setup the ADC library correctly and low resolution is 
> sufficient for you and you are using pin_AN0 then you might read the ADC 
> value with: 
>    var  byte  adcvalue 
>    adcvalue = adc_read_low_res(0) 
>
> Now if you want to check if this value is between 40 and 60 (inclusive) 
> you could write: 
>
>    if adcvalue >= 40 & adcvalue <= 60 then 
>        Interval = 5000 
>    end if 
>
> Note: the word 'and' is not a valid operator in JAL. Check section 3.1 
> of the jalv2 manual for a list of operators with JalV2 
>
> Regards, Rob. 
>
> -- 
> Rob Hamerling - http://www.robh.nl 
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jallib.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to