I want to set the 2bit parameter CDAFVR<1:0> of the register FVRCON. Is it possible sometime like:
fvrcon.CDAFVR=....
With kind regards
Jan Lichtenbelt
Set 2 bits values
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Set 2 bits values
Hi Jan,
In XC8 you can do things like this.
FVRCONbits.CDAFVR = 3;
However in BoostC things are a little different.
I think the register bits are only defined as their bit position so you can do things like this.
set_bit(fvrcon, CDAVR0);
clear_bit(fvrcon, CDAVR1);
Not really what you were after but not too bad.
In XC8 you can do things like this.
FVRCONbits.CDAFVR = 3;
However in BoostC things are a little different.
I think the register bits are only defined as their bit position so you can do things like this.
set_bit(fvrcon, CDAVR0);
clear_bit(fvrcon, CDAVR1);
Not really what you were after but not too bad.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Set 2 bits values
I get a C-code error "Left operand must be l-value". What can be wrong?
Kind regards
Jan Lichtenbelt
Kind regards
Jan Lichtenbelt
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Set 2 bits values
Hi Jan
You have got:
For boost C it should be:
Registers are in lower case and bit names are in upper case.
Martin
You have got:
Code: Select all
TRISA=TRISA|0x04; // Set A2 as input
ANSELA= ANSELA | 0x04; // Set A2 as analog input
Code: Select all
trisa=trisa|0x04; // Set A2 as input
ansela= ansela | 0x04; // Set A2 as analog input
Martin
Martin