i2c LCD problem

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

Moderator: Benj

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

i2c LCD problem

Post by andy.reynolds »

Hello all
I've got all the symptoms listed here when trying to program an i2c LCD in flowcode 7, I've downloaded the update as suggested but not sure that I'm applying it to the flowcode 7 folder correctly as I'm still getting the same errors, can you help ? :( :(

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: i2c LCD problem

Post by Steve »

Can you please describe your issue and perhaps post the error messages, your Flowcode file and the C code generated. That will make it easier to get this problem sorted for you.

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

ok so I've done a very basic diagram consising of lcd start-lcd clear-lcd set cursor-lcd print string, to test the screen and this is what i get when it tries to compile.

I've followed the thread re downloading the and extracting the zip file and applying it to the flowcode7 folder but I'm not sure that I've done it correctly.

C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:527:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c: In function 'FCD_04071_LCD__RawSend':
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:527: error: 'FCP_SET' undeclared (first use in this function)
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:527: error: (Each undeclared identifier is reported only once
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:527: error: for each function it appears in.)
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:528:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:529:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:530:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:531:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:532:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:542:40: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:544:40: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:546:40: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:548:40: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:578:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:592:21: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:596:21: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:602:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:603:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:604:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:605:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:606:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:609:40: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:611:40: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:613:40: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:615:40: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:620:23: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:628:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:632:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:678:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c: In function 'FCD_04071_LCD__Start':
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:678: error: 'FCP_SET' undeclared (first use in this function)
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:679:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:680:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:681:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:682:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given
C:\Users\Protega\DOCUME~1\I2C SCREEN TEST.c:683:22: error: macro "FCP_SET" requires 5 arguments, but only 2 given

Error returned from [avr-gcc.exe]
Completed compilation, return = 1

C:\Program Files (x86)\Flowcode 7\compilers\avr\batchfiles\avra.bat reported error code 1

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: i2c LCD problem

Post by dazz »

Hi andy
can you post your flowcode file as it will enable others to better help
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

Thanks Dazz
Here you go.
Attachments
I2C SCREEN TEST.fcfx
(8.76 KiB) Downloaded 347 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: i2c LCD problem

Post by medelec35 »

Hi Andy,
Compiles for me OK using the latest updates running V7.3.0.7:

Code: Select all

Launching the compiler...
C:\Program Files (x86)\Flowcode 7\compilers\avr\batchfiles\avra.bat  atmega328p "M:\Flowcode Testing\I2C SCREEN TEST.elf" "M:\Flowcode Testing\I2C SCREEN TEST.c" "M:\Flowcode Testing\I2C SCREEN TEST.lst"
Launching compiler...

M:\Flowcode Testing>"C:\PROGRA~2\FLOWCO~3\COMPIL~1\avr\BATCHF~1\..\bin\avr-gcc.exe" -mmcu=atmega328p -Os -ffunction-sections -fdata-sections -funsigned-char -o "M:\Flowcode Testing\I2C SCREEN TEST.elf" "M:\Flowcode Testing\I2C SCREEN TEST.c" -lm -Wl,-gc-sections 

M:\Flowcode Testing>"C:\PROGRA~2\FLOWCO~3\COMPIL~1\avr\BATCHF~1\..\bin\avr-objdump.exe" -S "M:\Flowcode Testing\I2C SCREEN TEST.elf"  1>"M:\Flowcode Testing\I2C SCREEN TEST.lst" 

M:\Flowcode Testing>"C:\PROGRA~2\FLOWCO~3\COMPIL~1\avr\BATCHF~1\..\bin\avr-size.exe" -B -d "M:\Flowcode Testing\I2C SCREEN TEST.elf" 
   text	   data	    bss	    dec	    hex	filename
    784	     14	     28	    826	    33a	M:\Flowcode Testing\I2C SCREEN TEST.elf

Compilation successful!
Completed compilation, return = 0

Launching the linker/assembler...
C:\Program Files (x86)\Flowcode 7\compilers\avr\batchfiles\avrb.bat  "M:\Flowcode Testing\I2C SCREEN TEST.elf" "M:\Flowcode Testing\I2C SCREEN TEST.hex" "M:\Flowcode Testing\I2C SCREEN TEST.cof"

M:\Flowcode Testing>"C:\PROGRA~2\FLOWCO~3\COMPIL~1\avr\BATCHF~1\..\bin\avr-objcopy" -O ihex -R .eeprom  "M:\Flowcode Testing\I2C SCREEN TEST.elf" "M:\Flowcode Testing\I2C SCREEN TEST.hex" 

HEX file creation successful!

M:\Flowcode Testing>"C:\PROGRA~2\FLOWCO~3\COMPIL~1\avr\BATCHF~1\..\bin\avr-objcopy" -O coff-avr -R .eeprom  "M:\Flowcode Testing\I2C SCREEN TEST.elf" "M:\Flowcode Testing\I2C SCREEN TEST.cof" 

COFF file creation successful!


FINISHED
What I do is open the zip file select all with Ctrl a, Copy with Ctrl c, then paste in the correct directory.
For 32 Bit windows:

Code: Select all

C:\Program Files\Flowcode 7

For 64 Bit windows:

Code: Select all

C:\Program Files (x86)\Flowcode 7
It appears that your V7 as not been correctly updated?

Martin
Martin

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: i2c LCD problem

Post by dazz »

Hi
i just did the update on my pc from this link
https://www.matrixtsl.com/temp/FC7_Late ... -05-18.zip
follow Martins post to move the files,and it will work
Rgards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

Thanks Dazz
Success up to a point, it's compiling ok now but I can't get it to upload to the board, I've also tried to upload a diagram that uploaded fine before the update, please see error message below.

Launching the programmer...
C:\Program Files (x86)\Flowcode 7\compilers\avr\batchfiles\avrc_arduinoA.bat m328p arduino com5 57600 "C:\Users\Protega\DOCUME~1\flash.hex"

C:\Users\Protega\DOCUME~1>"C:\PROGRA~2\FLOWCO~2\COMPIL~1\avr\BATCHF~1\..\bin\avrdude.exe" -p m328p -P com5 -b 57600 -c arduino -D -U flash:w:"C:\Users\Protega\DOCUME~1\flash.hex"
. . . . .

avrdude.exe: invalid file format '\Users\Protega\DOCUME~1\flash.hex' in update specifier
avrdude.exe: error parsing update operation 'flash:w:C:\Users\Protega\DOCUME~1\flash.hex'

Error returned from [avrdude]

C:\Program Files (x86)\Flowcode 7\compilers\avr\batchfiles\avrc_arduinoA.bat reported error code 1



FINISHED

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: i2c LCD problem

Post by Benj »

Hi Andy,

Which Arduino are you using? Does it say R3 on the PCB?
ArdR3.jpg
ArdR3.jpg (36.65 KiB) Viewed 39323 times
If it does then make sure you have selected the R3 version of the target and then hopefully programming will complete successfully.

I'm also guessing COM5 is the correct port for your Arduino?

The Target and COM port are both specified in the Project Options window if you need to change them.

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

I'm using the arduino nano 328 which I have it set to in the project options and yes it's set to com5.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: i2c LCD problem

Post by LeighM »

Hi,
Could you try the attached file, to replace the one in your Flowcode7 installation \compilers\avr\batchfiles directory

C:\Program Files (x86)\Flowcode 7\compilers\avr\batchfiles
Attachments
avrc_arduinoA.bat
(1.38 KiB) Downloaded 260 times

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

Bingo, thanks LeighM, I have a connection to the board now and a simple blink diagram uploads and works, however I can't get the screen to display anything, it's a 16x2 screen with backpack and I have established that the address is is 0x27 which I've set as 39 in the component configuration and the SDA line as C4 and SCL line as C5. I've had the screen working using the Arduino IDE so I know it works, any suggestions ?
Attachments
I2C SCREEN TEST.fcfx
(9.48 KiB) Downloaded 279 times

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: i2c LCD problem

Post by Benj »

Hello,

Can you point us to which display you're using i.e. a link to the display/backpack for sale or information on the display/backpack and I'll investigate for you.

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

Thanks Benj, please see link below.

https://www.ebay.co.uk/itm/With-Without ... 2749.l2649

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: i2c LCD problem

Post by Benj »

Please can you try address 63 instead and see if you have any more success with this.

Based on this from the description.
- I2C Address: It's either 0x27 or 0x3F
- Received an email from a customer saying that his board works with 0x3F

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

Thanks Benj, I have tried that, I'm sure it is 0x27 because I had it working with the Arduino IDE on that address.
In the component configuration, should the channel be set to software or channel 1 ?

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: i2c LCD problem

Post by dazz »

hI Andy

Sorry for the late reply i had to hunt down the bits
Ok change fron software to channel 1 as you mentioned above also connect as follows
SCL goes to pin A5
SDA goes to pin A4
%v to the 5v pin on the nano
gnd to gnd

i have had your file running

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

Thanks Dazz
I have it all set up as described but obviously something isn't right, all I get is a blank screen, I've tried a different Nano and a different screen as well (same address) but same result. :( It compiles fine and uploads fine.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: i2c LCD problem

Post by dazz »

Hi Andy
try adjusting the pot on the back of the i2c adapter, turn it untill you get a screen full of black blocks , then turn in the opposite direction until you hopefully see the words.

also find the hex file for the program, zip it up and attach here i will then download ant try it here, that help narrow down the issues

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

Thanks Dazz, I have tried the contrast.
See hex file attached.
Attachments
I2C SCREEN TEST.hex
(2.14 KiB) Downloaded 159 times

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: i2c LCD problem

Post by dazz »

Hi Andy
Sorry fell asleep ,ok your hex didn't work so i checked your flowchart and found
the pins had not been set correctly in the i2c properties box, chane the pins in properties to
SCL pin C5
SDA pin C4
see attached images:
first is your flowchart as posted
original flowchart.png
(64.31 KiB) Downloaded 4927 times
Second is with pins changed
working.png
(20.48 KiB) Downloaded 4927 times
let us know if this works

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: i2c LCD problem

Post by jgu1 »

Hi Martin!

Sorry Andy. I hav a question to Martin.

Martin you wrote:
Compiles for me OK using the latest updates running V7.3.0.7

I have also downloaded this and overWrite these files in the directories, But I still have V. 7.3.0.6

Please have I miss something?

Andy, When I compile it seem to be ok

Compilation successful!
Completed compilation, return = 0

Launching the linker/assembler...
C:\Program Files (x86)\Flowcode 7\compilers\avr\batchfiles\avrb.bat "C:\FLOWCO~1\FORSG~1\I2C SCREEN TEST.elf" "C:\FLOWCO~1\FORSG~1\I2C SCREEN TEST.hex" "C:\FLOWCO~1\FORSG~1\I2C SCREEN TEST.cof"

C:\FLOWCO~1\FORSG~1>"C:\PROGRA~2\FLOWCO~1\COMPIL~1\avr\BATCHF~1\..\bin\avr-objcopy" -O ihex -R .eeprom "C:\FLOWCO~1\FORSG~1\I2C SCREEN TEST.elf" "C:\FLOWCO~1\FORSG~1\I2C SCREEN TEST.hex"

HEX file creation successful!

C:\FLOWCO~1\FORSG~1>"C:\PROGRA~2\FLOWCO~1\COMPIL~1\avr\BATCHF~1\..\bin\avr-objcopy" -O coff-avr -R .eeprom "C:\FLOWCO~1\FORSG~1\I2C SCREEN TEST.elf" "C:\FLOWCO~1\FORSG~1\I2C SCREEN TEST.cof"

COFF file creation successful!


FINISHED


Br Jorgen

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: i2c LCD problem

Post by medelec35 »

Hi Jorgen,
jgu1 wrote:I have also downloaded this and overWrite these files in the directories, But I still have V. 7.3.0.6

Please have I miss something?
When you updated V7, if you look in Flowcode folder you will see three Flowcode exe files:
Flowcode exe.png
(8.03 KiB) Downloaded 4881 times
You can see from the file names what versions the flowcode will be if ran the executables, except for

Code: Select all

FlowcodeV7.exe
That will be

Code: Select all

V7.3.0.7
.
So seems like you have a shortcut to the wrong executable.

Martin
Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: i2c LCD problem

Post by jgu1 »

Hi Martin!
yes, it work. Thank´s again for your always fast and perfect help. :D

Andy, again sorry for the break, concerning your display. As I wrote earlyer, I am able to compile your program..

Br Jorgen,.

andy.reynolds
Posts: 13
Joined: Fri May 18, 2018 3:42 pm
Contact:

Re: i2c LCD problem

Post by andy.reynolds »

Thanks to all that are helping, I've tried re configuring the pins but still no joy. :?

Post Reply