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

Postby andy.reynolds » Tue May 22, 2018 8:31 am

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: 3111
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 397 times
Contact:

Re: i2c LCD problem

Postby Steve » Wed May 23, 2018 11:10 am

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

Postby andy.reynolds » Thu May 24, 2018 12:42 pm

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: 514 times
Been thanked: 467 times
Contact:

Re: i2c LCD problem

Postby dazz » Thu May 24, 2018 12:45 pm

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

Postby andy.reynolds » Thu May 24, 2018 1:30 pm

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8603
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2475 times
Been thanked: 3558 times
Contact:

Re: i2c LCD problem

Postby medelec35 » Thu May 24, 2018 2:08 pm

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
These users thanked the author medelec35 for the post:
Benj (Thu May 24, 2018 2:34 pm)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: i2c LCD problem

Postby dazz » Thu May 24, 2018 2:18 pm

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
These users thanked the author dazz for the post (total 2):
medelec35 (Thu May 24, 2018 2:20 pm) • Benj (Thu May 24, 2018 2:34 pm)
Rating: 10%
 
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

Postby andy.reynolds » Thu May 24, 2018 3:29 pm

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: 14669
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4273 times
Contact:

Re: i2c LCD problem

Postby Benj » Thu May 24, 2018 4:07 pm

Hi Andy,

Which Arduino are you using? Does it say R3 on the PCB?

ArdR3.jpg
ArdR3.jpg (36.65 KiB) Viewed 4791 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

Postby andy.reynolds » Thu May 24, 2018 4:40 pm

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: 2008
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 480 times
Been thanked: 688 times
Contact:

Re: i2c LCD problem

Postby LeighM » Fri May 25, 2018 9:35 am

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.45 KiB) Downloaded 51 times

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

Re: i2c LCD problem

Postby andy.reynolds » Fri May 25, 2018 11:46 am

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 55 times

User avatar
Benj
Matrix Staff
Posts: 14669
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4273 times
Contact:

Re: i2c LCD problem

Postby Benj » Fri May 25, 2018 12:11 pm

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

Postby andy.reynolds » Fri May 25, 2018 12:44 pm


User avatar
Benj
Matrix Staff
Posts: 14669
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4273 times
Contact:

Re: i2c LCD problem

Postby Benj » Fri May 25, 2018 1:13 pm

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

Postby andy.reynolds » Fri May 25, 2018 1:32 pm

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: 514 times
Been thanked: 467 times
Contact:

Re: i2c LCD problem

Postby dazz » Fri May 25, 2018 3:01 pm

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
These users thanked the author dazz for the post:
LeighM (Fri May 25, 2018 3:07 pm)
Rating: 5%
 
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

Postby andy.reynolds » Fri May 25, 2018 3:48 pm

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: 514 times
Been thanked: 467 times
Contact:

Re: i2c LCD problem

Postby dazz » Fri May 25, 2018 3:59 pm

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
These users thanked the author dazz for the post:
medelec35 (Fri May 25, 2018 4:14 pm)
Rating: 5%
 
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

Postby andy.reynolds » Fri May 25, 2018 4:15 pm

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

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

Re: i2c LCD problem

Postby dazz » Fri May 25, 2018 7:48 pm

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
original flowchart.png (64.31 KiB) Viewed 4699 times


Second is with pins changed

working.png
working.png (20.48 KiB) Viewed 4699 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: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: i2c LCD problem

Postby jgu1 » Sat May 26, 2018 8:19 pm

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8603
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2475 times
Been thanked: 3558 times
Contact:

Re: i2c LCD problem

Postby medelec35 » Sat May 26, 2018 9:40 pm

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
Flowcode exe.png (8.03 KiB) Viewed 4653 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
These users thanked the author medelec35 for the post:
jgu1 (Sun May 27, 2018 7:26 am)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: i2c LCD problem

Postby jgu1 » Sun May 27, 2018 7:31 am

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,.
These users thanked the author jgu1 for the post:
medelec35 (Sun May 27, 2018 12:50 pm)
Rating: 5%
 

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

Re: i2c LCD problem

Postby andy.reynolds » Thu May 31, 2018 7:20 am

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