[SOLVED] Switch array and led array Atmega problem

A forums to allow bugs and problems with Flowcode v6 to be reported and resolved.

Moderator: Benj

Post Reply
EtsDriver
Posts: 444
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 345 times
Been thanked: 227 times
Contact:

[SOLVED] Switch array and led array Atmega problem

Post by EtsDriver »

When using component macro "read_all" and trying to send the value to led array "write value"... The simulation works fine, but sending code to chip returs many errors of not declared items.

This bug prevents use of some items on Flowcode and affects the code generated.

Chip used : Atmega168 and 328P

Ports on led array (8) Custom PINS: C5 C4 C3 C2 C1 C0 B1 B2
Ports on switch array (8) Custom PINS: B0 d7 D6 D5 D4 D3 D2 D0

Program structure (to reproduce):

Start
|
|
Forever loop
_|
Call component macro
sw_status=switch_array::ReadAll()
_|
Call component macro
Led_Array::WriteValue(sw_status)
_|
LOOP FOREVER-
|
End

Try to compile to chip/hex.

LOG:
Flowcode.msg.txt wrote: Tuodaan kääntäjää...
C:\Program Files (x86)\Flowcode 6\compilers\avr\batchfiles\avra.bat atmega168 "C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.elf" "C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c" "C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.lst"
Launching compiler...

C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01>"C:\PROGRA~2\FLOWCO~1\COMPIL~1\avr\BATCHF~1\..\bin\avr-gcc.exe" -mmcu=atmega168 -Os -funsigned-char -o "C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.elf" "C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c" -lm
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c: In function 'FCD_03d9a_led_base1__TurnOn':
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:592: error: 'FCP_TRIS_A' undeclared (first use in this function)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:592: error: (Each undeclared identifier is reported only once
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:592: error: for each function it appears in.)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:592: error: 'FCP_PORT_A' undeclared (first use in this function)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c: In function 'FCD_03d9a_led_base1__TurnOff':
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:602: error: 'FCP_TRIS_A' undeclared (first use in this function)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:602: error: 'FCP_PORT_A' undeclared (first use in this function)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c: In function 'FCD_05261_switch_base1__ReadState':
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:1509: error: 'FCP_PIN_A' undeclared (first use in this function)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:1509: error: 'FCP_TRIS_A' undeclared (first use in this function)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c: In function 'FCD_05261_switch_base1__WaitUntilHigh':
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:1547: error: 'FCP_PIN_A' undeclared (first use in this function)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:1547: error: 'FCP_TRIS_A' undeclared (first use in this function)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c: In function 'FCD_05261_switch_base1__WaitUntilLow':
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:1585: error: 'FCP_PIN_A' undeclared (first use in this function)
C:\Users\Jari\DOCUME~1\FLOWCODE\PLC-01\Hitachiohjelma.c:1585: error: 'FCP_TRIS_A' undeclared (first use in this function)

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

C:\Program Files (x86)\Flowcode 6\compilers\avr\batchfiles\avra.bat reported error code 1
Last edited by EtsDriver on Tue Dec 23, 2014 11:40 pm, edited 1 time in total.
Ill just keep the good work up!

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: Switch array and led array Atmega problem

Post by Benj »

Hello,

This is a problem we have now resolved and so should be fixed in the next update. To fix the problem for now simply involves changing the connection property of the internal hidden component inside the array components.

To do this click on View -> Component Debugger.

Tick the tick box "Expose full component tree"

In the properties window click the drop down at the top of the window.

Each of the array components has two internal components, the one that will need changing is the none array component.
Arrays.jpg
Arrays.jpg (28.33 KiB) Viewed 3226 times
Select the component e.g. led_5mm and then change the connection from pin A0 to a valid pin on your target device.

Once you have removed all references to port A then it should work correctly.

Another way to fix this would be to go into the project options and add these defines to the supplementary code window.

Code: Select all

#define PORTA PORTB
#define PINA PINB
#define DDRA DDRB

Post Reply