Posts from — September 2007
Write Microsoft .NET code faster with Boo
even if you’re using C# or VB.NET. How? By using Boo’s interpreter to try out ideas, test usage of .NET framework functions, and interact with components (COM, .NET). Then when you’re comfortable, you can write the polished code in the language of your choice.
This is one use for mixed language programming, mentioned by me here, but where the final software might not use both languages.
In fact, any .NET interpreter such as IronPython or IronRuby could be used. And it’s a great technique for other than .NET – I’ve used it a lot with Python on Win32, and you can use it in Java with JRuby, Jython, Groovy, etc. This approach could be very useful for embedded and factory software development.
On .NET IronPython and IronRuby have advantages because they’re official Microsoft languages (and IP has a book coming out – IronPython In Action) and the languages are already in wide use (Win32, *nix, Java). I’m using Boo because it comes with the open source SharpDevelop IDE, and right now it integrates better with .NET (IP does not support attributes well, and it’s not easy to make an IP assembly callable by other .NET languages, etc).
Short example – interactively using DirectoryInfo in Boo (text I typed in bold):
>>> di = DirectoryInfo(“C:\\Download”)
C:\Download
>>> files = di.GetFiles()
(AdbeRdr80_en_US.exe, AdbeRdr80_en_US_Nosso_error.log, Firefox Setup 2.0.0.1.exe, SharpDevelop_2.2.1.2648_Setup.msi, TortoiseSVN-1.4.3.8645-win32-svn-1.4.3.msi)
>>> files = di.GetFiles(‘t*’)
(TortoiseSVN-1.4.3.8645-win32-svn-1.4.3.msi)
Interactively calling a COM object in Boo:
>>> ieType = System.Type.GetTypeFromProgID(‘InternetExplorer.Application’)
System.__ComObject
>>> ie = System.Activator.CreateInstance(ieType)
System.__ComObject
>>> ie.Visible
false
>>> ie.Visible = true
true
>>> ie.Visible
true
So far I haven’t had to use InvokeMember to call COM functions. At least for C# and VB.NET (and probably Boo) it appears you need to use it if you are using late binding. BTW, it is possible to use late binding with COM events, but it is significant extra work.
Tony
September 26, 2007 No Comments
CANOpen Annoyances – I
Updated 12/14/2007 with more vendors
It’s obvious I like CANOpen, but it does have its downside. Areas that could be much improved include:
- Too many connector types. OK, I can see a need for more than one connector type. But 20 types? Powering isolated CANOpen transceivers is not consistent either – I am going to design and build some interface boards to make it easier. Just giving examples from my favorite vendors:
- My CANOpen interfaces both have DB9M CAN connectors, but do not provide any power. (The PEAK dongle can be easily modified to provide +5VDC on pin 1 and/or pin 9).
- The DB9M connector seems standard for CAN interfaces – Kvaser, Ixxat, Softing, Peak, and Gridconnect all use it. The Ixxat USB/CAN interface has RJ-45 connectors, with RJ45/DB9 adapter.
- The AMC DX15 uses a DB9M connector, and requires 7.5-13VDC on pin 9.
- The Wago 750-337 has a removable screw terminal connector, and its isolated CAN transceiver is powered internally. (The 750-338 has a DB9 connector).
- Copley Accelnet Panel drives (ACP-xxx-xx) use RJ-45 CAN connectors, and look like they need +5VDC on pin 8.
- Copley Accelnet Micro Panel drives (ACJ-xxx-xx) use Samtec 10-pin crimp and poke connectors, and need power on pins 1 and 6.
- IMS CANOpen MDrives (stepper motor + drive) use either DB9 or 5-pin micro (M12F) connectors, and look like they require 7-30VDC on pin 9.
- Elmo’s Cello and Harmonica drives use a RJ-45 connector, are isolated, but don’t require external power.
- Kollmorgen S200 Series uses 5-pin removable terminal block.
- Technosoft IDM680 uses DB9M, and needs +24V.
- Technosoft IDM240 and IDM640 uses what looks like a RJ-11 connector.
- Faulhaber MCDC3003C and MCDC3006C drives use DB9M with no power.
- Maxon EPOS uses a 4-pin Molex Micro-Fit connector, no power, and a Molex to DB9M cable available.
- Raw CANOpen is pretty primitive – certainly not a good basis for rapid development. This is a bit better than I thought.
- Copley’s CMO (ActiveX) is free for use with their drives. CML has a license fee which is reasonable. Both are higher level interfaces, and would make working with a Copley and Wago only system easier. However, as far as I can tell, the libraries only work with Copley drives and Wago I/O modules, so if you need to mix and match, it won’t work.
- Elmo’s Maestro Multi-Axis Supervisor and Composer software look interesting (might make CANOpen development much quicker), but I’m pretty sure they only work with Elmo’s drives.
- Software needs much more standardization – what works with what is still too restricted. To give some examples:
- IMS requires Peak CAN interfaces (resold as the MD-CC500) to download firmware updates.
- Copley’s CMO and CML software only supports interfaces from Copley, Ixxat, Kvaser, NI, and Vector, and only supports Wago I/O.
- Elmo’s Interlude software supports Ixxat, Softing, and Kvaser.
- AMC’s Driveware configuration and setup software works with CAN interfaces from Advantech, Ixxat, Kvaser, Vector, and ESD.
- Faulhaber’s Motion Manager software only supports Ixxat.
- Maxon supports Ixxat, Vector, and NI.
- Wago appears to supply no software, just the EDS files.
- Most CAN interfaces do not include CANOpen software – it’s either not available or is yet another cost (Kvaser was the exception IIRC). Softing includes a free CANOpen API (LeanCANOpen).
So if you need to mix and match (one of CANOpen biggest advantages), you are going to have fun. Think about a system needing a high power AMC drive, some Copley Accelnet drives, and some IMS MDrives. You’d need a Peak CAN interface to update the MDrives, but a Ixxat, Kvaser, or Vector interface to setup the AMC and Copley drives. You’d have to use different GUI software to setup the AMC and Copley drives. And you could drive using Copley’s higher level CMO or CML libraries with AMC and IMS, but there’s no guarantee that they will work (and I’m pretty sure no support). You would have to deal with different connectors (DB-9, RJ45) and different, incompatible voltages to power the CAN bus.
Tony
September 12, 2007 No Comments