Vref-

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
JANUARY1
Posts: 15
Joined: Sun Jun 03, 2012 1:05 pm
Location: KENDAL
Been thanked: 2 times
Contact:

Vref-

Post 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.

User avatar
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: Vref-

Post 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.

JANUARY1
Posts: 15
Joined: Sun Jun 03, 2012 1:05 pm
Location: KENDAL
Been thanked: 2 times
Contact:

Re: Vref-

Post by JANUARY1 »

many thanks :D :D :D :D

Post Reply