09-24-2021 05:36 AM
The attached project (done in LV17) is a simple check out tool for verifying if the connected VFD ( Bonfiglioli brand ) is working fine.
I created simple sub VIs to generate the required Read and Write commands instead of using any library. Bonfiglioli uses some special function codes and 32 bit register commands and hence this is easier for me
Apart from the VFD there is also a Oil Particle counter which only needs to be read once every minute.
Right now the 45KW VFD and the Particle counter are working fine. But If I try to also start the 65KW VFD then the loop hangs and both drives stop.
There are enough comments on the BD to indicate the flow of Modbus commands - I am sure there is something going wrong as with this code I am able to run either the 45KW or 65KW drive but not both.
The cabling is a two core twisted type and with one termination resistor on the 65KW drive which is the last in the daisy chain.
Any idea why it cannot control both VFDs at a time ?
Solved! Go to Solution.
09-24-2021 07:29 AM
Hi Mogaraghu,
thanks for attaching the whole project.
Please mark the mainVI in your project more clearly, I couldn't locate it just from its filename or location in the project…
On your mainVI:
Please don't maximize any windows of all (!) the subVIs to fullscreen: this is just annoying…
09-24-2021 11:51 PM
Heloo GerdW
Sorry about not naming the main VI and the fact about maximized sub VIs. ( Never realized till you mentioned this !)
Now for the code itself ...
This snippet is part of a much larger code for a complete machine and I hence created this just for the sake of posting here. And also wanted to emphasize the flow of the Serial Task to see if there is any hiccup in that. Otherwise it is part of a larger SM.
Could you see any issue in the way the Serial interface code is implemented ? I always get into knots when the project has a heavy dependence on serial comm.
And the one other point I could not understand is the left - to right and top-down data flow. I thought that was the most natural way we implement ?? Maybe I am missing something here.
03-03-2022 10:47 AM
OK I have got it going now !
it all started with reading the Bonfig manual where one page it says : The VFD does not respond before 10ms after a command and if the CPU is busy, this can reach upto 500ms.
So then got down to work and created two state machines - one for each drive - but this time around the RPM read cases also went inside the state machine. Created a data flow by threading the Error wire from the first state machine to second state machine. Ensured the required timing with properly placed delays.
Even then it did not work. In fact the code crashed.
What made it work is this : Created a stacked sequence structure with two frames and in the first one kept the SM for the 45kw drive and in the second frame kept the 65kw drive. Now there is no case of any fighting for the Serial port resource and the control is great. Runs good with a 100ms timing.
Thanks to all the inputs which set me thinking in the right direction !
03-04-2022 04:25 AM - edited 03-04-2022 04:26 AM
Also wanted to share the Modbus Read SUB VI that I had used in the code. This just handles the VISA Write / read part over Serial. The required Modbus command is generated externally and fed to this ( CmdArray) . The reason I cannot use a standard Modbus library is that I need to send some non standard functions ( 100 for 32 bit read and 101 for 32 bit write in this application ) So instead of taking a standard library and editing it, I thought of creating my own for this. No problems so far.
Also In the VISA Read I am using a fixed byte read. (10 in this case ) . Being a Modbus RTU mode I cannot send a Termination Char which is the preferred method instead of a fixed byte wait.
03-04-2022 04:21 PM
@MogaRaghu wrote:
OK I have got it going now !
...
Created a stacked sequence structure...
"stacked sequence structure" is *never* the answer 😱
03-04-2022 04:26 PM
Wait... your are sending your command,
then throwing away the answer,
then waiting for a response?
That just cannot end well!
BTW. the sequence structure is redundant.
03-08-2022 01:10 AM - edited 03-08-2022 01:11 AM
@Frozen wrote:
Wait... your are sending your command,
then throwing away the answer,
then waiting for a response?
That just cannot end well!
BTW. the sequence structure is redundant.
1. The sequence structure is part of development history when there were some fixed delays between Read / Write etc. You are right - now its redundant.
2. The code works. As I mentioned this whole code is to control more than one VFD over a single Serial Bus. And this particular VFD model has a 10ms (minimum ) delay before sending out the response. So what is being is flushed from the Receive buffer is any leftover bytes ( if any ) from a previous transaction.