02-21-2011 11:00 AM
Hi Everyone,
After a few weeks' struggling, I have finally worked the vi of FPGA program for Brooks MFC.
Here I would like to share it with all of you, in case anyone will have troubles like I had (which was really painful..).
I have a system like this:
a) cRIO 9073 chassis.
b) NI 9807 FPGA serial 4-port module, with RS232 protocal.
c) four Brooks MFC in parallel.
Now, what I want to do is to control all the MFC through a real-time project. You may ask why do I bother, just use the VISA communication, and there already are a bounch of vis that I can download!
Well, I need to use FPGA because... Because I bought a 9870 serial port module, and at that time I did not expect it to be a FPGA one! I thought I can simply plug the MFC and then use the as-downloaded VISA-based VIs, holy shit (I was a labview idiot before, and actually I still am)....
Okay, enough jabbing, I will get back to course,
1) first, in order to use Brooks MFC, we need a RS232 to RS 485 converter, which is rather simple.
2) then, we will need to download some examples from the internet, i recommend the NI 9870 - Continuous Serial Read - On-Demand Write http://zone.ni.com/devzone/cda/epd/p/id/6366, which is really good to begin with. http://zone.ni.com/devzone/cda/epd/p/id/6166 is NOT recommended, since it could make a beginner confused. The only problem is, in this example, you still have to do a subvi of ¨Read from FIFO¨. But if you look a bit carefully into the example, it will be really easy to creat one. I remind you that the format and depth of ¨FIFO write and read¨ may be a little tricky.
3) After you modify the downloaded example (because you may have different FPGA module or cRIO chassis, but the principle will be the same), you can test the constant read and write example with a loopback test. That is to say, connect your RS232 port pin 2 and pin 3. For more information of it, please refer to http://fr.wikipedia.org/wiki/RS-232.
4) If you are careful enough, you will have already been able to recieve the data that you send from one certain port. Congratulations! You have done 1/3 the job.
5) Next step to do download some other example, of course, it is the VISA based programme for Brooks MFC.
6) Unfortunately, the VISA vi is not very perfectly done, we still have to do some more works, but that is not our current job. What we have to do is now modify all the VISA read and Write into FIFO write and FIFO read. Sounds no clues at all? That's normal, you have to go step by step. Fist you need to know how the VISA/FIFO works, in summerise, VISA or FIFO is a buffer where you put your data temporarily. So, we have to get some configuration for this buffer, that are VISA configuration and/or FPGA configuration, in order to set up the Baud Rate, Parity, etc. For VISA, it's common and built-in in labview. But FPGA not, so, we need to modify the example in 2), to get your FIFO read and write, as well as the FPGA bitfile (or FPGA reference) done. I think you can probably figure out how it works, since a stupid guy as I could also have done it :-)... I remind you that in the example in 2), there is no FPGA read, you have to do it by your self.
Here, I have to say sth, when you debug the FPGA programme, there could be a popping-out window, saying that an -61395 error has been occurred, followed by ¨Communication Error Occured¨ followed by ¨Warning: Connection to the Real-Time target ((Ni-cRioXXXXXX) has been lost." Actually; this is possiblely (also could be some other problem) because of your software mismatch, please check your diver for your cRIO and your Labview, even a 0.0.1 mismatch could cause this shit. (Labview is shit from this point of view, it wasted me 2 weeks to fix it, because I did not know what happened).
And, I want to say sth else, when you are doing FPGA program, do not debug sub vis seperately, especially when you push the small yellow bulb to see if there are errors, there possiblely will be some -61395 error at the end of FPGA debug. But, do not worry, that is because you did not give your subvi a correct FPGA reference.
7) Ooops, now what? Yes, now you have already modified all VISA into FPGA, and please open both the VISA vi and FPGA vi in your PC, just for comparison, and modify all the BROOKS reference into FPGA reference (do not tell me you don't how to do it), this is boring, but still you have to do it. After that, it's almost 2/3 done.
😎 The last step is to debug your program to see if you can read sth from the Brooks MFC, let's say use the ¨Read Flow Rate¨ example in VISA vi, if you can get the feed back, you already succeeded in the whole job. But, what if you cannot? I will recommend you to borrow an osilloscope, to monitor your data flow form and to the RS232 port (That is how I did it). When you read and write from the MFC, there will be some signal in the osilloscope. If not, that is to say, you have got some error in your vi. And again I remind you that, the read and write rate could not be too fast for MFC, especially in the case of 9870 module, if you run the vi too fast, there would be no response from the MFC. The way to solve this problem is to bring a time delay between every read and write. And, it seems that the brooks read and write sould work in group.
9) The final step is to optimise all your vis, make them more sexy and enjoy using the MFCs! To get some other functions that the VISA example does not have, you have to refer to the manual book of Brooks MFC, to figure out the command and data bits, believe me, this is not very difficult, since as a stupid guy as I could also understand it :-).. The manual book is too large to be included in the attachment, you can ask from me by email.
The labview program I did for FPGA controlling of Brooks MFC is also larger than the maximum size in this forrum(5.12 KB), I just put part of it in the attachment. I tested it in my system, it worked. If you want to have it, just email me zhenghan1985@gmail.com.
Vitto
2011-02-21
02-22-2011 02:57 AM
Actually I can upload the full files in several parts 🙂
Here is the full program, part 1
This file is ZIP file, but inside is an RAR file, because this forum does not support .rar files...
02-22-2011 02:57 AM
Part 2
02-22-2011 02:57 AM
Part 3
02-22-2011 03:00 AM
And the manual book.