Hi Seb,

Rob Hamerling wrote:

>> It seems it can be normalized (only) with an ADCON_CHS'put() procedure 
>> which takes a bit*4 variable (or a full byte) and puts bits 0..2 in 
>> ADCON_CHS and bit3 in ADCON_CHS3.
> 
> I have done a quick test and I'm not so happy. It appears that the 
> proposed 'put routine only accepts a bit*3 parameter, thus the fourth 
> bit will be lost. So 'CHS' would need to be declared as a bit*4 field 
> and the original CHS would have to be renamed and taken care of by the 
> 'put procedure.  Slightly more complicated than at first sight.


The modified ADCON declaration below seems to work. I renamed the ADCON0 
field CHS to CHS012 and added a 'put procedure for CHS. I haven't 
actually tested this code, but the assembler listing looks OK to me.... 
When it works (can you test it?) I'll modify the device files of the 
PICs in question accordingly.

Regards, Rob.


> -- ------------------------------------------------
> var volatile byte  ADCON0               at { 0x1F }
> var volatile bit*2 ADCON0_ADCS          at ADCON0 : 6
> var volatile bit*3 ADCON0_CHS012        at ADCON0 : 3
> var volatile bit   ADCON0_GO            at ADCON0 : 2
> var volatile bit   ADCON0_NDONE         at ADCON0 : 2
> var volatile bit   ADCON0_CHS3          at ADCON0 : 1
> var volatile bit   ADCON0_ADON          at ADCON0 : 0
> procedure ADCON0_CHS'put(byte in chn) is
>   ADCON0_CHS012 = chn
>   ADCON0_CHS3 = 0
>   if (chn & 0x08) != 0 then
>     ADCON0_CHS3 = 1
>   end if
> end procedure



-- 
Rob Hamerling, Vianen, NL (http://www.robh.nl/)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to