bigal_scorpio
Active Member
Hi to all,
I am presently involved in my project of making a power supply with an LCD readout for voltage.
The other thread I started was in general electronics and I am with the help of Eric Gibbs, just about getting things moving on the PSU side of things.
Now I am coming to the PIC micro part which I am using a 16F872 to read 3 sets of voltage and 1 current measurement. My problem is due to ADC being new to me. Most of my projects so far have been digital only. I program using PicBasic Pro.
Can anyone explain in simple terms what Left Justify or Right Justify means. I just don't get that when I have a 10bit ADC and justify it either way, if it reads 6bits as zero then surely won't it leave me with only 4 bits of data?
Also I am a little puzzled as to what to do with ADCON1? I am wanting 4 ADC readings so I figure I need to set the last four bits as 0011 (I am also using a 4096 presicion Ref on Vref) but WHERE in the program do I use it? Should I set the MSB to Left or right Justify? And finally do I need to set ADCON1 more than once or is it sufficient to set and leave it?
All help appreciated, Al
PS here is the part of the 16F872 datasheet showing the ADCON1 data.
I am presently involved in my project of making a power supply with an LCD readout for voltage.
The other thread I started was in general electronics and I am with the help of Eric Gibbs, just about getting things moving on the PSU side of things.
Now I am coming to the PIC micro part which I am using a 16F872 to read 3 sets of voltage and 1 current measurement. My problem is due to ADC being new to me. Most of my projects so far have been digital only. I program using PicBasic Pro.
Can anyone explain in simple terms what Left Justify or Right Justify means. I just don't get that when I have a 10bit ADC and justify it either way, if it reads 6bits as zero then surely won't it leave me with only 4 bits of data?
Also I am a little puzzled as to what to do with ADCON1? I am wanting 4 ADC readings so I figure I need to set the last four bits as 0011 (I am also using a 4096 presicion Ref on Vref) but WHERE in the program do I use it? Should I set the MSB to Left or right Justify? And finally do I need to set ADCON1 more than once or is it sufficient to set and leave it?
All help appreciated, Al
PS here is the part of the 16F872 datasheet showing the ADCON1 data.