FIRST SAMPLE PROJECT
Plan for first sample project.
- Generate a random number, store in a array and publish the array over network.
Tools I need
- Labview
- SCCT 3.0
Before start this project, I checked the examples supplied by TSM4. So that I can make use of it as a template for mine.
Fortunately I found a example project similar to one I want to develop. publisher-subscriber-demo.lvproj. this example is exact match to my plan of sample example project with little extra vi's. So I am going to make my simple from this supplied example.
The publisher-subscriber-demo.lvproj project contained two files named publisher and subscriber. from the name it is clear that publisher vi will have the code for generating the data and publish it. Subscriber vi will have code for connect to the publisher and present the data received.
In a Publisher.Vi, Five stages of code was documented,
1. Create configuration for subscribers
2. start publisher
3. publish data
4. check active subscribers count
5. terminate publisher
now we got a template from this vi to prepare our publisher vi. 2nd,3rd & 5th vis are must have vis in any project it seems. we will use those vis remaining thing let us go in details right now.
Fortunately I found a example project similar to one I want to develop. publisher-subscriber-demo.lvproj. this example is exact match to my plan of sample example project with little extra vi's. So I am going to make my simple from this supplied example.
The publisher-subscriber-demo.lvproj project contained two files named publisher and subscriber. from the name it is clear that publisher vi will have the code for generating the data and publish it. Subscriber vi will have code for connect to the publisher and present the data received.
In a Publisher.Vi, Five stages of code was documented,
1. Create configuration for subscribers
2. start publisher
3. publish data
4. check active subscribers count
5. terminate publisher
now we got a template from this vi to prepare our publisher vi. 2nd,3rd & 5th vis are must have vis in any project it seems. we will use those vis remaining thing let us go in details right now.
- First I saved this project in my project folder in the name of RandomData_Sample.lvproj
- Opened the publisher.vi, deleted the 1st & 4th stage vis and saved vis after correcting all the wires.
two column & hundred rows Random number array is generated and connected to PublishData.vi for publishing the data
In the front panel, port and API-key controls are the input to the StartPublish.vi. The details of the port & API-Key will be explained later in the project. So whatever used in the supplied example is used as it is without any change.
It was ran and stopped. There is no any error in the vi.
Now, let us look in to subscriber vi. There is no need of change in this vi. we can use it as it is. Before proceeding let us understand what is there in this vi.
Subscriber vi contains OpenConnection.vi, TransferStatus.vi, ReadAnalogData.vi & CloseConnection.vi all these vi's are important for any subscriber vi that we develop except there will be changes ReadAnalogData.vi based on the type of data that we get.
Subscriber vi contains OpenConnection.vi, TransferStatus.vi, ReadAnalogData.vi & CloseConnection.vi all these vi's are important for any subscriber vi that we develop except there will be changes ReadAnalogData.vi based on the type of data that we get.