Page 1 of 1

4D Visi / Visi Genie Component

Posted: Sat Aug 24, 2013 3:09 pm
by Benj
Hello,

Here is an updated component to allow the 4D systems Visi interface to function from a PC connected via a 4D USB2Serial cable or via a Embedded microcontroller device.

The component will be included in the next patchset (3) so until this is released you will need to copy the .fcpx file into the "Flowcode v6 Beta/Components" directory before loading any of the example files.

Let me know how you get on. The examples use rockerswitches but all the other Visi components should work in the same way.

The first example shows how to wait for incoming reports with two LEDs on the dashboard panel to represent the state of the switches.

The second example demonstrates adding control to allow you to control one of the switches from either the display or the PC/Embedded device.

The console window is very useful during simulation so please remember to open this up and have a look at the Visi and Data bytes tabs. You can view them side by side by right clicking and adding a new tab group.

When calling the readobject or writeobject macros there is a drop down menu next to the ObjectID which provides all the Objects as constants. These can also be referred to in decisions if need be.

Let me know if I have missed any tricks or if there are any bugs and I will get them fixed.
Visi.zip
(121.05 KiB) Downloaded 468 times
Be sure the COM port is selected correctly for your device, if you still have the 4D serial interface open in the 4D software then Flowcode will be unable to see the channel and connect.

Re: 4D Visi / Visi Genie Component

Posted: Sun Aug 25, 2013 1:17 pm
by acestu
Hi Benj,

I have tried to program my pic16f877A with your rockerswitch example but it gives me this error:
Visierror2.png
(10.6 KiB) Downloaded 8499 times
Do you have any idea what might be causing this because the leads in the board are all in the same place and I haven't really touched anything..

P.S. I have tried the console window and opened up another tab but if you set the tabs that you want to view as soon as you start the simulation they change to the default is this supposed to happen ?


Thanks
Acestu

Re: 4D Visi / Visi Genie Component

Posted: Sun Aug 25, 2013 1:29 pm
by acestu
Hi Benj,

I have just opened the rockerswitch2 demo and tried programming with that and the same result, Invalid Device, so I am going to try something in FC5 to see if it is the programmer or chip, also when I opened the console in this chart there was no visi tab.

Thanks
Acestu

Re: 4D Visi / Visi Genie Component

Posted: Sun Aug 25, 2013 3:01 pm
by acestu
Hi Benj,

Ok I have got over that disaster, a faulty PGD lead me thinks, so I have now successfully programmed the 877A with the rockerswitch demo however it is still not working so I am going to check to see if I am using the correct TX & RX on the display.

cheers
Acestu

Re: 4D Visi / Visi Genie Component

Posted: Sun Aug 25, 2013 3:48 pm
by acestu
Hi Benj,

Fantastic, It is running now, I have also tested the 4D Workshop file of mine and can say that the EVENTS on the switches must be REPORT MESSAGE.

I have taken a video of it here: http://www.youtube.com/watch?v=dGk9GqAv ... ERnCxvQamQ



Also I will enclose the working 4DW file if anybody else wants to try this.

Thank You So Much Benj Your Efforts Are Greatly Appreciated *
Acestu
Visi4DW.rar
(1013 Bytes) Downloaded 497 times

Re: 4D Visi / Visi Genie Component

Posted: Sun Aug 25, 2013 5:00 pm
by acestu
Hi Benj,

Now that I have completed the "On OFF" switch test for the Visi component, I would like to try a simple slider project and capture the "On Change" and "On Changing" data, do you have any example charts of this please.

Thanks
Acestu

Re: 4D Visi / Visi Genie Component

Posted: Sun Aug 25, 2013 9:27 pm
by Benj
Hi Stu,

Should be exactly the same but the ObjectID will be different and the data will be 0-?? instead of 0 or 1. If you output the value to a display then you can see what value is being returned. Glad the embedded side is also working correctly I only tested the sim interface but both should work equally well (it's basically the same code just pointed at different interfaces - CAL UART or COM Port)

Re: 4D Visi / Visi Genie Component

Posted: Sun Aug 25, 2013 11:47 pm
by acestu
Hi Benj,

Could I just ask you please what these two lines are in the "Read Byte From Message"

3 = value MSB

4 = value LSB


What is the MSB & LSB ?


Thanks
Acestu

Re: 4D Visi / Visi Genie Component

Posted: Mon Aug 26, 2013 12:10 am
by acestu
Hi Benj,

This pic makes remembering the Object ID's easy:
Object-Summary.png
(44.87 KiB) Downloaded 8476 times
So the Object ID and the Object Index are simple really, I just need to know more about 1,command 3,valueMSB 4,valueLSB

P.S. Couuld you also tell me what this calculation is saying please:
calculation.png
(3.42 KiB) Downloaded 8455 times


Thanks
Acestu

Re: 4D Visi / Visi Genie Component

Posted: Mon Aug 26, 2013 10:08 pm
by Benj
Hi Stu,

The command is 7 for an incoming report and there is another option which I can't remember.

The data high and data low is combined together into the 16-bit data variable. For a switch this is 0 to 1. For other more analogue Visi components the value will be allowed to go much higher, max 0 to 65535. This is what the calculation is doing.

Re: 4D Visi / Visi Genie Component

Posted: Mon Aug 26, 2013 10:41 pm
by acestu
Hi Benj,

I have modified your Visi-Demo chart to show the data from the display on the screen here:

http://www.youtube.com/watch?v=diP0ndGp ... ERnCxvQamQ

However because the data goes to 100 on the slider the video looks fine but if you turn the slider right up to 100 the last digit 0 stays on the display and it looks as if you are getting data readings in the 3 figure range, I have tried a few different ways to prevent this but not had very good results, any tips would be appreciated, I am posting the chart with this post..

cheers
Acestu
SliderDemo.fcfx
(14.24 KiB) Downloaded 423 times

Re: 4D Visi / Visi Genie Component

Posted: Mon Aug 26, 2013 11:08 pm
by Benj
Hi Stu,
However because the data goes to 100 on the slider the video looks fine but if you turn the slider right up to 100 the last digit 0 stays on the display and it looks as if you are getting data readings in the 3 figure range
The previous number is not being cleared if the digit count drops from 3 to 2 and again from 2 to 1. You can get around this by first printing a string in the same location with three spaces to ensure all three characters always get reset.

Re: 4D Visi / Visi Genie Component

Posted: Mon Aug 26, 2013 11:51 pm
by acestu
Hi Benj,

Thanks for the tip, I put the 3 spaces in and it worked like a charm.... :D
SliderDemo.fcfx
(14.54 KiB) Downloaded 423 times
Thanks
Acestu