11-11-2011 03:36 PM
Hey, so i tried putting in a wait, and that didnt make a difference... it's running off of a custom made program called GenScheme. It's written in ironpython. We're looking on switching over to labview to replace genscheme. Im on the engineering side of this so i dont know a whole lot about the programing... im going to try to attatch the portion of code related to the atomlab...
11-11-2011 03:37 PM
import System import struct from SerialType import SerialType class AtomLab300(SerialType): """The Serial Dose Calibrator type that contains methods for communicating with Atomlab 300 dose calibrators.""" def __init__(self, vss): SerialType.__init__(self) self.name = "AtomLab300" self.vss = vss self.activity = 0.0 self.isotope = "" self.unit = "Ci" self.reader = System.Timers.Timer(1000) self.reader.Elapsed += self.readerTick def get(self, item): if item == "activity": #Return the last activity read. return self.activity if item == "isotope": #Return the last isotope read. return self.isotope if item == "unit": #Return the last unit read. return self.unit def open(self): self.vss.SelectedSubsystem.serialdevice.configurePort(baudrate=4800, newline='', recvdelay=50) self.updateReadStatus("REQ", 0.0, True) #Requesting data... self.reader.Start() def readerTick(self, sender, event): response = self.vss.SelectedSubsystem.serialdevice.sendrecvline("\x31") if response == "": self.updateReadStatus("ERR", 0.0) #AtomLab300 is not responding. return None if not response.startswith("~"): self.updateReadStatus("ERR", 0.0) #Incomplete record received. return None fields = response.split() if len(fields) < 4: return None isotope = fields[1] dialvalue = fields[2] activity = fields[3] unit = fields[4] self.isotope = isotope self.activity = activity self.unit = unit.strip() self.updateReadStatus("OK", 100.0) def close(self): self.reader.Stop()
11-11-2011 03:38 PM
Like I said, our ex-programmer wrote this code, so I'm not overly familiar with it, but if there is other code that might be helpful I can look!! This was just what was listed under serial dose calibrator... And thanks for everyones help!!
11-11-2011 03:52 PM
Drill down into "updateReadStatus" to see what characters are sent that trigger the device to return data.
11-11-2011 04:10 PM
ok so i ran it with breakpoints and it looks like it returns 4 values? one of which is activity (the value i need), is there some way to access all of them individually?
and just below the code in this last picture all of the fields are broken up individually to display them in-program.
11-14-2011 04:24 PM
Hi Sundown,
So one thing that I would suggest doing is making sure that you are reading the correct number of bites in your VISA program. You could be waiting for bites that will never come and therefore you time out. One way to do that is to use a VISA Bites at Port Property Node. This tells you how many bites are sitting at the write port and you can wire it to the read. Please see below for example code. Also, have you tried to communicate with this device in Measurement and Automation Explorer?
Good luck,
Kira
Applications Engineer
National Instruments
11-14-2011 07:36 PM
It looks like call-and-respond. Send a few specific Bytes to the instrument to get it to send interesting data. To see what commands to send, either "sniff" the com port (such as with PortMon) while the Python app is running, or find where the com port writes are happening in the Python source.
11-15-2011 01:15 PM
Well, sort of good news... I added in the part Kira suggested and for the first time got a response in the read buffer, as you can see in the top... However, it returned gibberish!! Same affect with the IDN command. So would this imply that I need different commands like Todd said? I tried finding other commands for the Atomlab but havent had any luck so far... And thanks for everyones help by the way!!
11-15-2011 02:13 PM
Looks like the baud rate setting is wrong.
11-15-2011 02:33 PM
yep just caught this error after i posted : p
changed to 4800 and finnally "good" responses... it now flashes all 4 elements ( the reading, units, etc.) very quickly... is there an easy way to break up these four elements?
But other than that I think I can make the rest of it work, so thanks everyone!!!