LCD and ADC problem

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

LCD and ADC problem

Postby MarkW » Wed May 12, 2010 12:29 pm

Hi

Got a 16F886 running a 20x4 char display with ADC port 11 and 13.

Currently running Flowcode V3.4.7.48

Issue is that in this version the LCD works fine, no problem. However
when i try to use ADC port13 i get compile error. Does not get so far
as to even generate any code. All other ADC assigned ports work ok (compile).
I tried using V3.6.11 and the same problem exists when trying to use ADC port13,
and with this version there is the added problem that the LCD strings sent to the port
are shifted around on the display.

going back to V3.4.7.48 solves the LCD problem but the ADCport13 problem remains
in both versions. The processor is setup correctly for 20mhz in config (HS) and the
flowchart speed config etc. Crystal is standard 20Mhz. LED 1sec turn on/off
confirms this. Any ideas?

Plus if i want to try V4.3 (downloaded the trial version), can this run with V3 on my machine?
Or do i need to un-install V3?

Thanx in advance

Mark

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: LCD and ADC problem

Postby Sean » Thu May 13, 2010 4:22 pm

I have attached a new .fcd file for the 16F886 which corrects a problem with the ADC13 code.

16F886.fcd
(8.54 KiB) Downloaded 238 times


Copy the attached file into the FCD folder of your Flowcode V3 installation, overwriting the original file (Flowcode should be closed for this operation). The corrections should be effective next time you load and compile the program.

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Re: LCD and ADC problem

Postby MarkW » Thu May 13, 2010 6:41 pm

Hi Sean

Ok great! Thanx very much. Any ideas about the LCD problem as mentioned
previously?
And also the question about trying V4 with V3 already installed?

Thanx

Mark

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: LCD and ADC problem

Postby Sean » Fri May 14, 2010 9:50 am

Flowcode V3 and V4 can be installed on the same machine and run independently.

There was a short term problem with the LCD component when one of the 4-line options was selected. Two of the lines on a 20x4 display have different start addresses than the same lines on a 16x4 display. The later v3 component code (and all v4 code) differentiates between these options and sets the start addresses for each line.

This component code supplied with v3.6.11.53 (my current v3 installation) includes the modifications introduced to support both options:

void Cursor(char x, char y)
{
/*Macro_Curseur_Start*/
/*Macro_Cursor_Start*/

#if (%j == 1)
y=0x80;
#endif

#if (%j == 2)
if (y==0)
y=0x80;
else
y=0xc0;
#endif

#if (%j == 4)
if (y==0)
y=0x80;
else if (y==1)
y=0xc0;

#if (%k == 16)
else if (y==2)
y=0x90;
else
y=0xd0;
#endif

#if (%k == 20)
else if (y==2)
y=0x94;
else
y=0xd4;
#endif
#endif

%i_RawSend(y+x, 0);
delay_ms(2);

/*Macro_Cursor_End*/
/*Macro_Curseur_End*/
}

%j is the substitution for the number of lines, and %k is the substitution for the characters per line.

If you already have this version of the code (it should be possible to see the code above - with the substitutions made - in your final program using the Chip -> View C... menu) it is possible that the display you are using does not follow the same rules as the ones we have tested.

In this case, it should be relatively simple to edit the component c file to provide the correct line start addresses.

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Re: LCD and ADC problem

Postby MarkW » Mon May 17, 2010 7:01 am

Thanx Sean

Will take a look at that and fix it. Thanx again for your help!

Regards

Mark