Page 1 of 2

i2c LCD problem

Posted: Tue May 22, 2018 8:31 am
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 ? :( :(

Re: i2c LCD problem

Posted: Wed May 23, 2018 11:10 am
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.

Re: i2c LCD problem

Posted: Thu May 24, 2018 12:42 pm
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

Re: i2c LCD problem

Posted: Thu May 24, 2018 12:45 pm
by dazz
Hi andy
can you post your flowcode file as it will enable others to better help
Regards
Dazz

Re: i2c LCD problem

Posted: Thu May 24, 2018 1:30 pm
by andy.reynolds
Thanks Dazz
Here you go.

Re: i2c LCD problem

Posted: Thu May 24, 2018 2:08 pm
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

Re: i2c LCD problem

Posted: Thu May 24, 2018 2:18 pm
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

Re: i2c LCD problem

Posted: Thu May 24, 2018 3:29 pm
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

Re: i2c LCD problem

Posted: Thu May 24, 2018 4:07 pm
by Benj
Hi Andy,

Which Arduino are you using? Does it say R3 on the PCB?
ArdR3.jpg
ArdR3.jpg (36.65 KiB) Viewed 59966 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.

Re: i2c LCD problem

Posted: Thu May 24, 2018 4:40 pm
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.

Re: i2c LCD problem

Posted: Fri May 25, 2018 9:35 am
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

Re: i2c LCD problem

Posted: Fri May 25, 2018 11:46 am
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 ?

Re: i2c LCD problem

Posted: Fri May 25, 2018 12:11 pm
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.

Re: i2c LCD problem

Posted: Fri May 25, 2018 12:44 pm
by andy.reynolds
Thanks Benj, please see link below.

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

Re: i2c LCD problem

Posted: Fri May 25, 2018 1:13 pm
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

Re: i2c LCD problem

Posted: Fri May 25, 2018 1:32 pm
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 ?

Re: i2c LCD problem

Posted: Fri May 25, 2018 3:01 pm
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

Re: i2c LCD problem

Posted: Fri May 25, 2018 3:48 pm
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.

Re: i2c LCD problem

Posted: Fri May 25, 2018 3:59 pm
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

Re: i2c LCD problem

Posted: Fri May 25, 2018 4:15 pm
by andy.reynolds
Thanks Dazz, I have tried the contrast.
See hex file attached.

Re: i2c LCD problem

Posted: Fri May 25, 2018 7:48 pm
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

Re: i2c LCD problem

Posted: Sat May 26, 2018 8:19 pm
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

Re: i2c LCD problem

Posted: Sat May 26, 2018 9:40 pm
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

Re: i2c LCD problem

Posted: Sun May 27, 2018 7:31 am
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,.

Re: i2c LCD problem

Posted: Thu May 31, 2018 7:20 am
by andy.reynolds
Thanks to all that are helping, I've tried re configuring the pins but still no joy. :?