Hi all,
I want to use the fixed 1.024V reference of the 16F1937.
The chip specifications tells me to set bit 1 and bit 7 of the FVRCON register.( if i'm correct with this)
But when I use the set_bit(FVRCON,0) and clear_bit(FVRCON,1) the compiler generate a error something like "left operand must be l-value"
Then i try to write C5 Hex and 197dec to the FVRCON register. with the same result.
does any one know how to do this?
(small example please)
thanks,
Rene
How to use the fixed ref of the 16F1937
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: How to use the fixed ref of the 16F1937
Hi Rene,
Use lower case for Register names
and
UPPER CASE for BIT NAMES.
so try:
set_bit(fvrcon,0);
etc,
Martin
Use lower case for Register names
and
UPPER CASE for BIT NAMES.
so try:
set_bit(fvrcon,0);
etc,
Martin
Martin
- rene
- Posts: 56
- Joined: Sun Sep 13, 2009 11:27 am
- Location: Dordrecht - Nederland
- Has thanked: 5 times
- Been thanked: 2 times
Re: How to use the fixed ref of the 16F1937
Hi Martin,
Yes, was right though.
Uppercase and lowercase, I should have known.
Now I'm one step further, compiling works ... thanks.
I like to built a milli-volt meter with minimal parts..(no opamps)
only one chip and a display, it should be possible with this PIC, right?
With the Internal ref at 1,024V, it must gif a raw value of 1023 at 1 volt input at AD0.
or am I completely off the track?
Have you or someone who reads this some experience with this chip?
Cheers,
Rene
Yes, was right though.
Uppercase and lowercase, I should have known.
Now I'm one step further, compiling works ... thanks.
I like to built a milli-volt meter with minimal parts..(no opamps)
only one chip and a display, it should be possible with this PIC, right?
With the Internal ref at 1,024V, it must gif a raw value of 1023 at 1 volt input at AD0.
or am I completely off the track?
Have you or someone who reads this some experience with this chip?
Cheers,
Rene
- rene
- Posts: 56
- Joined: Sun Sep 13, 2009 11:27 am
- Location: Dordrecht - Nederland
- Has thanked: 5 times
- Been thanked: 2 times
Re: How to use the fixed ref of the 16F1937
Solved....
I found my answer over here...
http://www.matrixmultimedia.com/mmforum ... =29&t=8955
thanks to all
I found my answer over here...
http://www.matrixmultimedia.com/mmforum ... =29&t=8955
thanks to all

-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: How to use the fixed ref of the 16F1937
Hi Rene,
Glad you have found your answer.
Re 16F19xx devices.
I have an issue with these devices either freezing or resetting when using ADC components, and even manually created an ADC component using C.
So in the end I just gave up.
I hope you don't face similar issues.
Would you mind keeping me updated to if your chip freezes/resets or not please.
Then I can try with the same chip.
Thanks
Martin
Glad you have found your answer.
Re 16F19xx devices.
I have an issue with these devices either freezing or resetting when using ADC components, and even manually created an ADC component using C.
So in the end I just gave up.
I hope you don't face similar issues.
Would you mind keeping me updated to if your chip freezes/resets or not please.
Then I can try with the same chip.
Thanks
Martin
Martin
- rene
- Posts: 56
- Joined: Sun Sep 13, 2009 11:27 am
- Location: Dordrecht - Nederland
- Has thanked: 5 times
- Been thanked: 2 times
Re: How to use the fixed ref of the 16F1937
Martin,
I'm having NO problems with the 16F1937 any more
With the modified file 'PIC_CAL_ADC.C " I succeed in FCv5.
Now I can use the internal REF. voltage without the chip crashes or freezes.
Depending on the required ref, set fvrcon to 0x81, 0x82, 0x83
I set fvrcon= 0x81 before every call of the ADC component. (maybe unnecessary)
But I think its possible to use for each analog input another internal Ref.
For me it works fine now.
Maybe you could try it again your self.
Success, and thanks again for you support.
Rene
I'm having NO problems with the 16F1937 any more
With the modified file 'PIC_CAL_ADC.C " I succeed in FCv5.
Now I can use the internal REF. voltage without the chip crashes or freezes.
Depending on the required ref, set fvrcon to 0x81, 0x82, 0x83
I set fvrcon= 0x81 before every call of the ADC component. (maybe unnecessary)
But I think its possible to use for each analog input another internal Ref.
For me it works fine now.
Maybe you could try it again your self.
Success, and thanks again for you support.
Rene