dsPIC30F5013 Switch ReadState Bug

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

dsPIC30F5013 Switch ReadState Bug

Post by ronaldlijs »

Hi guys,

Using Flowcode dsPIC 5.5.2.1.

Simples I get the following when compiling my little project (SWICTH0 on PORTG_H_0 and LED0 on PORTB_H_1), anmd the program doesn't run on hardware.

test.c: In function 'FCD_SWITCH0_WaitUntilHigh':
test.c:304: warning: comparison is always true due to limited range of data type
test.c: In function 'FCD_SWITCH0_WaitUntilLow':
test.c:333: warning: large integer implicitly truncated to unsigned type
test.c:342: warning: comparison is always false due to limited range of data type
test.c: At top level:
test.c:293: warning: 'FCD_SWITCH0_WaitUntilHigh' defined but not used
test.c:331: warning: 'FCD_SWITCH0_WaitUntilLow' defined but not used

Compilation successful!
Return code = 0

Seems like a bug to me... and Flowcode won't read the status of PORTG_H_0 on hardware, I have chcked with the Flowcode debugger).

If I use an "Input" component in Flowcode to read PORTG_H_0, the program works fine.

Below the little program working and the one not working at all.

Thanks for looking into this!
Ronald
Attachments
Not Working Code
Not Working Code
not_working.jpg (48.85 KiB) Viewed 2554 times
Working Code
Working Code
working.jpg (46.91 KiB) Viewed 2554 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: dsPIC30F5013 Switch ReadState Bug

Post by kersing »

This is an issue for all processors with 16 bit ports. The switch component tries to read a 16 bit value into an 8 bit variable. Drop the attached file in the components directory to solve the issue.
Attachments
FC5_PIC16BIT_SWITCH.c
(7.53 KiB) Downloaded 219 times
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: dsPIC30F5013 Switch ReadState Bug

Post by ronaldlijs »

Thanks Jac!

Post Reply