4D Visi / Visi Genie Component

Forum for Flowcode v6 beta users

Moderator: Benj

User avatar
Benj
Matrix Staff
Posts: 14150
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4078 times
Contact:

4D Visi / Visi Genie Component

Postby Benj » Sat Aug 24, 2013 3:09 pm

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 192 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.
These users thanked the author Benj for the post:
acestu (Sun Aug 25, 2013 12:12 am)
Rating: 5.56%
 

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby acestu » Sun Aug 25, 2013 1:17 pm

Hi Benj,

I have tried to program my pic16f877A with your rockerswitch example but it gives me this error:

Visierror2.png
Visierror2.png (10.6 KiB) Viewed 6623 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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby acestu » Sun Aug 25, 2013 1:29 pm

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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby acestu » Sun Aug 25, 2013 3:01 pm

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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby acestu » Sun Aug 25, 2013 3:48 pm

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 195 times
These users thanked the author acestu for the post (total 2):
Benj (Sun Aug 25, 2013 9:24 pm) • medelec35 (Mon Aug 26, 2013 9:10 am)
Rating: 11.11%
 
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby acestu » Sun Aug 25, 2013 5:00 pm

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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Benj
Matrix Staff
Posts: 14150
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4078 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby Benj » Sun Aug 25, 2013 9:27 pm

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)
These users thanked the author Benj for the post:
acestu (Sun Aug 25, 2013 10:28 pm)
Rating: 5.56%
 

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby acestu » Sun Aug 25, 2013 11:47 pm

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
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby acestu » Mon Aug 26, 2013 12:10 am

Hi Benj,

This pic makes remembering the Object ID's easy:

Object-Summary.png
Object-Summary.png (44.88 KiB) Viewed 6600 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
calculation.png (3.42 KiB) Viewed 6579 times




Thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Benj
Matrix Staff
Posts: 14150
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4078 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby Benj » Mon Aug 26, 2013 10:08 pm

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.
These users thanked the author Benj for the post:
acestu (Mon Aug 26, 2013 10:48 pm)
Rating: 5.56%
 

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby acestu » Mon Aug 26, 2013 10:41 pm

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 151 times
These users thanked the author acestu for the post:
Benj (Mon Aug 26, 2013 11:08 pm)
Rating: 5.56%
 
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Benj
Matrix Staff
Posts: 14150
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4078 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby Benj » Mon Aug 26, 2013 11:08 pm

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.
These users thanked the author Benj for the post:
acestu (Mon Aug 26, 2013 11:43 pm)
Rating: 5.56%
 

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: 4D Visi / Visi Genie Component

Postby acestu » Mon Aug 26, 2013 11:51 pm

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 172 times


Thanks
Acestu
These users thanked the author acestu for the post:
Benj (Tue Aug 27, 2013 9:44 am)
Rating: 5.56%
 
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.