Page 1 of 1

Vref-

Posted: Mon Apr 24, 2017 11:53 am
by JANUARY1
Hi how do i put asm code in to flowcode 6 I'm using a PIC184550 and need to turn on bit 5 in adcon1 for Vref- to work at 2.5v not o volts many thanks.

Re: Vref-

Posted: Mon Apr 24, 2017 12:11 pm
by Benj
Hello,

In a C icon you can use this code.

Code: Select all

set_bit(adcon1, 5);
Note that the ADC CAL will probably overwrite your adcon1 setting, looking at the code yes it does.


The 18F4550 uses ADC type 13 so if you look at the file "Flowcode 6/CAL/PIC/PIC_CAL_ADC.c" in a text editor you will see that ADC type 13 starts around line 1683.

Code: Select all

#ifdef MX_ADC_TYPE_13
Inside the ADC Type 13 look for the line

Code: Select all

old_tris = *tris_reg;									//store old tris value, and set the i/o pin as an input
Before this line add your altered code.

Code: Select all

set_bit(adcon1, 5);
Then the VREF- will get switched on for you by the ADC component.

Please note that a text editor will be unable to save the file if Flowcode is located inside the Program files directory. Instead you will have to save the file to your desktop and then manually copy it back into position using Windows explorer.

We recommend you make a backup of the original file so you can revert back if you need to.

Re: Vref-

Posted: Tue Apr 25, 2017 1:12 pm
by JANUARY1
many thanks :D :D :D :D