Check out our OOP Code Repository Files or visit the LabVIEW Wiki OOP Portal.
![]() |
Jul 18 2008, 09:40 PM
Post
#1
|
|
|
Very Active Member Posts: 101 Joined: 26-January 07 From: Seattle, WA Member No.: 7603 Using LabVIEW Since:2006 LV:8.20 ,. ,.
|
Earlier I had a question regarding class design that MikaelH kindly answered. Now I have a related, but more complex problem. I have four "toasters" I need to test: Toast Magic, Super Toast 2k, Super Toast 3k, and Toast All. Three of the toasters communicate to the host computer via an I2C interface while one, the Toast All, communicates via a USB/serial UART. That creates an issue in that the TA toaster has a very different communication process. The I2C toasters continually check the state of the toast and update their internal registers to reflect the current state. The TA toaster continually checks the toast state and sends it out to the serial port. If the UART has been initialized each toast state is stored in a buffer that will be dumped all at once at my next read, which may not be for quite some time. Furthermore, there are potentially three different devices we will use for I2C communication. All can do basic read and writes, but each has it's own unique feature set. The 8451 can operate only in master mode, the Aardvark can do master or slave as well monitor the bus (in case the blender wants to talk to the food processor), and the Corelis do everything the Aardvark can as well as fiddle with low level bit timing. Here's a UML diagram of what I'm thinking of doing. (I don't really know UML, so some of the notation might be incorrect.) I've also attached a copy of the Visio diagram if anyone wants to modify it. Explanation: Each I2C interface class inherits from an abstract I2C Interface Base class. Each toaster class inherits from an abstract Toaster Base class, which inherits from an abstract I2C Slave Base class. The I2C Slave Base class contains the I2C Interface Base class as part of its private data. Whew! Enough with the problem description. On to the questions...
Any and all comments are welcome!
Attached File(s)
Tags
This content has not been tagged yet
|
|
|
|
| Ad |
Jul 18 2008, 09:40 PM
Post
#
|
|
|
Tags
This content has not been tagged yet
|
|
|
|
Jul 21 2008, 04:57 AM
Post
#2
|
||
![]() Very Active Premium Member ![]() Posts: 139 Joined: 1-November 04 From: Sydney Member No.: 941 Using LabVIEW Since:1995 LV:8.5.1 ,8.6 ,.
|
Hi
I've made a quick UML diagram of how I would have solved the design. When I get more time I'll try to give you more feed back. Remember that all base class methods should makes sense to the child classes. Cheers, Mikael -------------------- Tags
This content has not been tagged yet
|
|
|
|
||
Jul 21 2008, 12:58 PM
Post
#3
|
|
|
Certified Kool-Aid Kid Premium Member ![]() Posts: 1133 Joined: 6-December 02 From: Pittsburgh PA USA Member No.: 29 Using LabVIEW Since:1998 LV:7.1 ,. ,.
|
Thanks for that reply Mikael! For self-taught (ah-hem, cough cough) OO types like myself, snippets like this are "Golden Nuggets". Thank you! Ben Tags
This content has not been tagged yet
|
|
|
|
Jul 21 2008, 02:43 PM
Post
#4
|
||
|
Very Active Member Posts: 101 Joined: 26-January 07 From: Seattle, WA Member No.: 7603 Using LabVIEW Since:2006 LV:8.20 ,. ,.
|
Hi I've made a quick UML diagram of how I would have solved the design. When I get more time I'll try to give you more feed back. Remember that all base class methods should makes sense to the child classes. Cheers, Mikael Thanks for the response Mikael. I ended up implementing most of the structure over the weekend and did almost exactly what you suggested. The only difference is that I didn't create a Toaster I2C and Toaster Serial class. Instead I just made the I2C Slave class a member of the Toaster classes that use I2C and I'll implement the serial protocol directly in the Toast All class. I think this will work okay. The only problem I can see right now is how to configure the I2C interfaces and Toasters. You suggested a pop-up configure dialog box in the other thread so I'll probably go that route. Tags
This content has not been tagged yet
|
|
|
|
||
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
11 | Jim Kring | 3643 | 17th January 2008 - 05:01 PM Last post by: Aristos Queue |
|||
![]() |
14 | PJM_labview | 6188 | 2nd January 2007 - 07:08 PM Last post by: brian175 |
|||
![]() |
2 | PJM_labview | 2148 | 7th July 2008 - 08:50 PM Last post by: rolfk |
|||
![]() |
3 | Deep_Blue | 1755 | 28th May 2004 - 12:39 PM Last post by: rolfk |
|||
![]() ![]() |
| Time is now: 7th October 2008 - 07:58 AM |