Page 1 of 1

dsPIC30F5013 Switch ReadState Bug

Posted: Thu May 16, 2013 4:25 pm
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

Re: dsPIC30F5013 Switch ReadState Bug

Posted: Fri May 17, 2013 10:52 am
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.

Re: dsPIC30F5013 Switch ReadState Bug

Posted: Sat May 18, 2013 11:50 pm
by ronaldlijs
Thanks Jac!