1 Jul 2007 11:07
Re: pic16 adc libs
Claudia Ruch wrote: > Hi Jan, > > I write to you because I have a problem with the sdcc adc.h library. I > am new to microcontroller programming and I am working at my diploma > thesis at the University of Munich at the moment . I saw that there is a > bug in this file because of the new adcon2 register. I use the pic > 18f2550 and tried to correct the adc_open command but I did not > succeed. Can you send me your improved files for ad conversion? Do you > thing fosc/16 is okay for a 20MHz oscillator? Which aquisition time do > you recommend? My patch is only tested on the pic18fXXXX (pic18f2550 and pic18f4550). On the pic18f1320 and pic18f1220 the library shipped with sddc did work as far as i remember. I'll attach the patch to this mail. Greetings from Heidelberg jan > > It would help me a lot if you sent me your files. > > Greetings form Munich > > Claudia(Continue reading)

struct {
unsigned int READ_BL_LEN:4;
unsigned int CCC:12;
} CSD;
Accessing READ_BL_LEN is OK.
Accessing CCC is wrong. Is there any problem with bitfields or is my
code wrong?
printf ("RDlen=%d\n", CSD.READ_BL_LEN);
>> ld hl,#_CSD
>> ...
printf ("CCC=%03X\n", CSD.CCC);
>> ld bc,#_CSD + 1
>> ld l,c
>> ld h,b
>> ld a,(hl)
>> ld c,a
>> inc hl
>> ld a,(hl)
>> and a,#0x0F
It seems that second part of bitfield starts at next byte location from
bit 0
Thanks.
Hynek Sladky
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
RSS Feed