![]() ![]()
If( output=47) // checking of string termination 47 ascii for "/" Output=UART1_Read() // storing each character in an array Void interrupt() // Interrupt service routine Unsigned int count,countt,i,del,d1,d2,d3,d4,j Labview test serial connection code#Now everything is configured and here is the code which is compiled in MikroC. Now to burn the code ,by loading the hex file by right clicking on controller selecting the program file and also change the controller frequency to 2OMhz. It has to be configured by editing its properties (Right click on the symbol), COM3 is selected and baud rate is set 9600. There is PIC16F877A connected to DB9 connector (COMPIN in proteus library). Now we come to proteus and below is the image showing the connections. I have used COM4 for labview and COM3 for proteus. Labview test serial connection software#In the software just click add pair and a pair will be created. Since there is no physical connection between labview and proteus, using the above mentioned tool a pair of virtual serial ports are created which both labview and proteus can read. Labview test serial connection download#Now after this next thing is to download ” virtual serial port driver”. There is a delay in serial communication case so as to smooth the things a little bit because controller is already busy with controlling motor and if you poke it by sending data continuously it gets pissed and stops working properly. Now whenever the switch is pressed then data is sent to controller. So if you select motor 3 and value 7 using the slider then data that is sent is ‘3+7/’.Instead of sending the string together, I’ll send it character by character which makes the handling of string easier on controller side.So for this task I’ll use “String Subset vi” to take out the characters from the string and then send it. , the value to be sent and also the sign of value and string terminator”/”. Now only string can be sent through serial communication so everything has to be converted into string which includes motor no. In each case same thing happens i.e input from slider is checked whether it is greater or equal to 0 if yes then ‘+’ is sent or else a ‘-‘ is sent(the other case selector). Flowchart for this piece of code is that a motor switch selects the motor and accordingly a case is selected therefore in all there are 5 cases one for each motor. ![]() In block diagram as you can see everything is enclosed in a while loop. But the whole magic happens in block diagram so here is the image of that. ![]() There is a button to control the flow of data. There is a knob for selecting the motor and a slider to select value to be sent to motor and it varies from -9 to +9. The front panel includes control for serial communication like selecting the COM port, parity bits and some other controls. Below is the image of labview front panel. ![]() Labview test serial connection driver#So for serial communication there is already a built in VI in labview and we will be using that only and also some general string and integer functions.For serial communication VISA driver has to be installed. Labview is graphic programming language and is really easy to use as everything is already done by folks at national instruments. This whole thing will be simulated on proteus which is an excellent simulation tool.As far as controlling the motor goes, it is explained clearly in my tutorial on servo motor.Now next task is to prepare labview for serial communication and then create the link between labview and proteus. The objective of this tutorial is to control 5 servo motors interfaced with PIC16F877A by sending commands serially using Labview. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |