JackHamilton Posted August 22, 2003 Report Posted August 22, 2003 Don, Attached is the Simple Simon game I showed at the LAVA User Group at NI Week. It employs 'Large Code Architecture' features to demonstrate how even a small application can be written with this structure. I use what I call a "Mono-Cluster State Machine" where there is only one data shift register which passes a Type Def 'Mono-Cluster'. This allows all cases on the State Machine to have access to all the parameters. It also allows you to write very 'pretty' code in that you can resolve each case into one VI - passing the cluster in & out. The code is pretty efficient: 1. The sound is generated in only state and is triggered via Queue communication between Simon and the User Console. 2. There is very little usage of local and NO Global variable usage. Another great strenght of this architecture is you break funtions into logical blocks - making it easier to code (smaller tasks to work on). >Easier to test - you can pass parameters into it's input cluster. >Less likely to break other parts of the code when implementing changes- because you be working on a single peice of code not a VI buried in a huge loop. I simply love the Queue-Driven State Machine. I had a 1 year software development project that near the end the client wanted to control in Visual Basic. We decided to link the code using TCP/IP. It took me about 2+ hours to modify the code to accepts commands and allow full control of the software via TCP/IP - because my architecture was already built on a String based command;argument structure. I dropped an addtional TCP/IP link & poll state in the code and handed him my command manual and voila! PS: the Simple Simon game was written at the request of a potential client who wanted to see a sample of coding style. It took me about 3+ hours to write and I think it is a marvelous way to assess coding style. Download File:post-12-1073108130.zip Quote
donroth Posted August 23, 2003 Author Report Posted August 23, 2003 Hi Jack: The architecture looks very elegant and by virtue of the fact that you require action every 50 msec, you have shown a nice way to use the event structure while still polling as well as using the event structure just to handle user interface events. With the event structure in LV7 and user events, a number of other possibilties for architectures become available. I was able to add my NI_week slides by zipping up the file rather than sending as .llb in case anyone wants to see how I used the event structure with user events to create a nested tab control example using only the event structure and with no polling. Also, FYI, your .llb did not contain the .wav files so actually playing the game was a little difficult (kept asking to find the sounds directory). Sincerely, Don Quote
JackHamilton Posted August 24, 2003 Report Posted August 24, 2003 Don Oops! Attached is the llb with the sound files. Download File:post-12-1073108220.zip Quote
JackHamilton Posted December 9, 2003 Report Posted December 9, 2003 Oops! The Simple Simon State Machine game requires this sound file directory. This file is attached. Jack Hamilton Download File:post-12-1073108834.zip Quote
Michael Aivaliotis Posted January 3, 2004 Report Posted January 3, 2004 With the event structure in LV7 and user events, a number of other possibilties for architectures become available. I was able to add my NI_week slides by zipping up the file rather than sending as .llb in case anyone wants to see how I used the event structure with user events to create a nested tab control example using only the event structure and with no polling. Don, Could you re-post the attachment called "NI week interface slides lv7.zip"? While upgrading the forums I discovered that this file was not uploaded properly and was in fact blank! Quote
donroth Posted January 5, 2004 Author Report Posted January 5, 2004 Will do but I am out on leave and will get to this at the end of the week.... I remember having problems posting it and had to do it several times; I thought the last time it showed up properly. If I can't get it to post properly, I will just email it to you and let you do it. Sincerely, Don Quote
donroth Posted January 8, 2004 Author Report Posted January 8, 2004 I am reposting the attachment showing how to use event structure to create nested tab control architecture. Don Download File:post-12-1073591615.zip Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.