Page 1 of 1

LUT Component not working with PIC30F3012

Posted: Thu Feb 01, 2018 1:34 am
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

Re: LUT Component not working with PIC30F3012

Posted: Thu Feb 01, 2018 9:56 am
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.

Re: LUT Component not working with PIC30F3012

Posted: Fri Feb 02, 2018 12:48 am
by Dirk Bubley
Hello Leigh,

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

BR

Dirk

Re: LUT Component not working with PIC30F3012

Posted: Wed Jul 18, 2018 7:13 pm
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

Re: LUT Component not working with PIC30F3012

Posted: Thu Jul 19, 2018 9:53 am
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.

Re: LUT Component not working with PIC30F3012

Posted: Mon Jul 23, 2018 5:31 pm
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

Re: LUT Component not working with PIC30F3012

Posted: Tue Jul 24, 2018 8:17 am
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.

Re: LUT Component not working with PIC30F3012

Posted: Wed Jul 25, 2018 5:15 pm
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

Re: LUT Component not working with PIC30F3012

Posted: Thu Jul 26, 2018 8:40 am
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

Re: LUT Component not working with PIC30F3012

Posted: Fri Feb 15, 2019 1:15 am
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

Re: LUT Component not working with PIC30F3012

Posted: Fri Feb 15, 2019 11:52 am
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?

Re: LUT Component not working with PIC30F3012

Posted: Fri Feb 15, 2019 3:19 pm
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