LUT Component not working with PIC30F3012

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Dirk Bubley
Posts: 99
Joined: Fri Feb 02, 2007 3:54 pm
Location: Germany
Has thanked: 14 times
Been thanked: 12 times
Contact:

LUT Component not working with PIC30F3012

Post by Dirk Bubley »

Hello FC Team,


I belive I discovered a Problem with FC6.1.3.2 and 16bit dsPIC30F3012.

If you compile the attached FC file you will get the follwing error message:

PIC30F3012 LUT Error bigger 0xff.c:74: warning: large integer implicitly truncated to unsigned type

The message will dissapear if all LUT values stay below 0xFF.

I belive this is not correct because it should be possible to store LUT values up to 0xFFFF.


I tried this compile (LUT values up to 0xFFFF) with a 8Bit PIC device like PIC18F6722. This works without any Problems.

It would great if someone could take a look at this issue.


BR
Dirk
Attachments
PIC30F3012 LUT Error bigger 0xff.fcfx
(4.49 KiB) Downloaded 233 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by LeighM »

Hi Dirk,
Please try this updated LUT component, to replace the file in your Flowcode installation components directory.
You will see that the data size is now selectable.
Attachments
lut.fcpx
(6.25 KiB) Downloaded 231 times

Dirk Bubley
Posts: 99
Joined: Fri Feb 02, 2007 3:54 pm
Location: Germany
Has thanked: 14 times
Been thanked: 12 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by Dirk Bubley »

Hello Leigh,

many thanks!! Great Support!! It works perfect the new LUT component file.

BR

Dirk

Steven_SS
Posts: 46
Joined: Wed Jul 18, 2018 6:33 pm
Has thanked: 18 times
Been thanked: 3 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by Steven_SS »

Hello!

I'm having a fairly similar issue on this LUT Component. First off, I'm using Flowcode V8.0.0.6. When I compile my program, it gives me that same "warning: large integer implicitly truncated to unsigned type" message for each value larger than 255. So I am probably going to try this version of LUT that Leigh has provided.

However the main problem is: I have this macro where I initialize the Modbus registers from a LUT setting the holding registers and then read those holding registers to set these variables for a calculation later on. When the program runs thru the calc, it tells me error "division by zero"; that variable is not getting initialized or its value properly. All the indexing seems fine. Any ideas please would be great!
Thank you.

Steven
I'm just trying to keep learning & growing in a infinite loop... unless I wanna break. Cheers :)
Steven

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: LUT Component not working with PIC30F3012

Post by Benj »

Hi Steven,

Please can you attach your program so we can investigate for you, the latest component fixes from Leigh should already be in the v8 component.

Steven_SS
Posts: 46
Joined: Wed Jul 18, 2018 6:33 pm
Has thanked: 18 times
Been thanked: 3 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by Steven_SS »

Hey Ben,

I unfortunately cannot attach it due to this project being part of intellectual property. But I managed to get rid of the 'division by zero' error by digging into the Modbus properties panel. Yet the LUT will still not hold values larger than 255. I'm stuck at trying to figure out why. I feel like it has something to do with the Bit count but I'm not sure. Any help would be appreciated. Thanks!

--
Steven
I'm just trying to keep learning & growing in a infinite loop... unless I wanna break. Cheers :)
Steven

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by LeighM »

Hi Steven,
I've re-checked the (latest updated) LUT component and don't see any problem with it.
Could you either generate a small Flowcode project that demonstrates the issue, or PM your project?
In either case, please include both the Flowcode .fcfx and generated .c file.
Thanks,
Leigh
btw, If you are using V8 please use the update feature, not the previously attached V6 component.

Steven_SS
Posts: 46
Joined: Wed Jul 18, 2018 6:33 pm
Has thanked: 18 times
Been thanked: 3 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by Steven_SS »

Hey Leigh,

I just downloaded the most recent updated LUT component and I still get the "warning: large integer implicitly truncated to unsigned type" msg when compiled. So I changed the storage type to 16-bit and those msgs were gone, cool. But in the program the value isn't getting called correctly(being over 255).

As of now when I compile I have the "error: redefinition of '___vector_25'" msg. Do you know how to get rid of this? I have no idea what/where/why this is.
But I will PM you.


Thanks a lot,
Steven
I'm just trying to keep learning & growing in a infinite loop... unless I wanna break. Cheers :)
Steven

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by LeighM »

Hi Steven,

Glad the LUT is working for you now.

The truncation to 8 bit is due to the use of a byte variable (.value) in your Init_Modbus_Registers() it needs changing to an integer.

The Modbus Slave uses an RX interrupt, and as this is set for Channel 1 it uses UART RX0.
Your compiler error is due to the setup in main of another interrupt for UART RX0
The two cannot coexist

Hope that helps.
Leigh

Steven_SS
Posts: 46
Joined: Wed Jul 18, 2018 6:33 pm
Has thanked: 18 times
Been thanked: 3 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by Steven_SS »

LeighM wrote:The Modbus Slave uses an RX interrupt, and as this is set for Channel 1 it uses UART RX0.
Your compiler error is due to the setup in main of another interrupt for UART RX0
The two cannot coexist
I'm running into this issue once more where the compiler comes back with "error: redefinition of '__vector_25'".
There is only one interrupt in the whole program I believe, so that can't be it. And it needs to be on UART0.
What else could be triggering this error?? Thanks
This program was working perfectly fine in Flowcode 7.

Edit->Leigh I sent you a pm
I'm just trying to keep learning & growing in a infinite loop... unless I wanna break. Cheers :)
Steven

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by LeighM »

Hi,
The Modbus slave component is already using the UART, so you don't need the UART component, it can be removed.
You will first need to remove the call to initialise it in Init_Hardware()

In your Main macro you are enabling the RX interrupt, which calls UART_Handler()
and in the UART_Handler() you are defining the interrupt vector,
which is clashing with the Modbus component one.
You need to remove both of these (the RX interrupt enable icon and the UART_Handler macro),
as the Modbus slave component has its own interrupt handler that writes into the circular buffer.

btw. What version of Flowcode are you using?

Steven_SS
Posts: 46
Joined: Wed Jul 18, 2018 6:33 pm
Has thanked: 18 times
Been thanked: 3 times
Contact:

Re: LUT Component not working with PIC30F3012

Post by Steven_SS »

Okay I'll do that, remove the interrupt and the UART Handler macro and see how that goes. Because I'm not able to read the modbus registers.
And I'm using Flowcode V8

-So I removed the interrupt, UART Handler() and took out the initialize UART0 in the macro Init_Hardware()
Yet i'm still not reading the Modbus registers values...It's for a MEGA2560
I'm just trying to keep learning & growing in a infinite loop... unless I wanna break. Cheers :)
Steven

Post Reply