Building a diagnostic tool to monitor serial port events

Hi,
I'm writing a diagnostic tool. I have two Windows machines communicating via serial ports. I need to treat the software on both machines as "black boxes." I would like to peek at both the sent and received data at one machine and save to a file without emptying the buffers.
Does have LabVIEW have access to these data? Can we look at it without emptying buffers?
Thanks,
FgH...

You can access to the data you like by wiring from the sent or
received data
bufferd line. But, cabablity of this way quite depends on the data
sampling rate
because the monitor is the most time consuming process on LV.
As I've experienced, you can do it in less than 100Hz rate per one data.
And saving to a file may be done after some interval repeatedly. The
files are
better smaller sized ones, so the data is to be storaged in a couple
of data files.
As for more practical method, i have to know your diagnostic tool in
detail
as far as possible. Tom
haibach wrote:
> Hi,
>
> I'm writing a diagnostic tool. I have two Windows machines
> communicating via serial ports. I need to treat the software on both
> machines as "bla
ck boxes." I would like to peek at both the sent and
> received data at one machine and save to a file without emptying the
> buffers.
>
> Does have LabVIEW have access to these data? Can we look at it
> without emptying buffers?
>
> Thanks,
> FgH...

Similar Messages

  • How do I monitor serial port activity without first sending a command?

    In my application I am sending a command through the serial interface and I want to monitor the response. The response is not instant, in fact it is a timeout response indicating the requested action did not work. How do I monitor so I can parse what is coming in over the serial port without necessarily sending a command?

    You can always place a loop where you monitor the number of bytes at the serial port.
    After configuring your VISA serial port session, you can create a Property Node to get the number of bytes available at serial port.
    You can then process this information, for instance:
    1. Establish a timeout because you never get a response.
    2. Do serial port read if there is data available.
    You can exit the loop with a timeout condition or having processed the data.
    -JLV-

  • Too many Serial Port events...?

    I've written Java code to connect to a serial port and receive data, and it's all working fine. But why when I send a message such as "msg from nicks PC" do three events get fired instead of a single event? That means my application interprets it as three messages
    1 -> msg from
    2 -> nicks P
    3 -> C
    I've tried
    mySerialPort.enableReceiveTimeout(500);
    but it doesn't seem to change anything...
    Anything else I can try?
    Cheers
    Paul

    It would help to see some code and know what kind of events are getting fired.

  • Serial port events

    I have a serialport dataRecived event with 3 methods inside it. The LogFile is loging dana, drawSetpoint is drawing a graph on a chart based on the input form the user. DrawInput is drawing a second graph which come from my Arduino.
    public void serialPort1_DataRecived (object sender, SerialDataReceivedEventArgs e)
    DateTime time = DateTime.Now;
    string Rdata = serialPort1.ReadLine();
    textFile(Rdata, (int)numericSetpoint.Value);
    drawSetpoint(time,numericSetpoint.Value.ToString());
    drawInput(time, Rdata);
    Console.WriteLine(Rdata);
    The numericSetpoint keypress looks like this:
    public void numericSetpoint_KeyPress(object sender, KeyPressEventArgs e)
    if (e.KeyChar == 13)
    if (serialPort1.IsOpen)
    int setpoint = (int)numericSetpoint.Value;
    string stp = setpoint.ToString("D3");
    char[] set = stp.ToCharArray();
    char[] dataSend = new char [6];
    dataSend[0] = Convert.ToChar("<");
    dataSend[1] = Convert.ToChar("S");
    dataSend[2] = set[0];
    dataSend[3] = set[1];
    dataSend[4] = set[2];
    dataSend[5] = Convert.ToChar(">");
    serialPort1.Write(dataSend, 0, 6);
    PrintCharArray(dataSend);
    else
    MessageBox.Show("Port not open");
    As you can notice both LogFile and drawSetpoint take one argument from the numericSetpoint control (numericUpDown). The problem is drawSetpoint starts to draw immediately when i start typing, it doesn't wait until i press ENTER. So if i wanted to set 150
    it would draw 1,15 and then 150 on the chart (as I'm entering numbers on the keyboard). The same behaviour can be seen in the LogFile. Files are being saved in a text file which looks like: 00.00,00 and after entering it would look like
    0.00,7
    0.00,7
    0.00,70
    0.00,70
    Same problem, it logs while i'm typing. I would like for both function to take the argument after i press ENTER to avoid this. How should i proceed ?

    Why fixing it? It works correctly..
    btw, as it seems that your problem is more general WinForms related, start with a button which sets your data. Don't try to use the key press event of your text box.
    Wrong term, i meant how to change it. Adding a button doesn't help, datareceived event still fires when i try to enter something in my numericUpDown control.

  • Thinkpad with serial port (RS232)

    For my job I need a laptop with a serial (RS232) port.
    I have the choice of the following laptops: Lenovo Thinkpad X230, X230T, T430, T530, W530.
    Neither of them have a serial port, right?
    I saw some mention of an adapter for the ultrabay slim bay, that would support an RS232 adapter.
    Does that work for all the above mentioned models?
    And if so, would the RS232 port work in the same way as the regular one? I need to program e.g. an Agilent datalogger with Labview to measure and recieve the measured data through the serial port.
    Kind regards,
    Rachel.

    thare are two ways :
    1. you can buy a usb to seial cable converter.
    2. if your laptop have a Docking Station. there is a serial port in the Docking station.  Put your laptop on the Docking station, the windows system will automatically recognizes the serial port.
    For example, my laptop is thinkpad x61t,  Itself does not have any serial port, But there is a serial port on the Docking station.
    I am a volunteer, don't work for Lenovo. I am a software engineer.
    thinkpad x61t, os:win7 Awavo Software com port monitor serial port monitor

  • Port event mechanism and full dupex socket -AIO with Completion Port

    Hi,
    I just started to port code from Windows OS to Solaris. I need a way to implement something similar to AIO with Completion Port from Windows on Solaris OS. After initial investigation I have discovered port - events API.
    It is quite elegant.
    The problem is that I can't figure out if it is possible to use single port to achieve full duplex socketing.
    This means is it possible to serve both POLLIN & POLLOUT for given socket ( PORT_SOURCE_FD ) with single port ?
    From port_associate man pages it seems that it is not possible to achieve something like that.
    "... If the specified object is already
    associated with the specified port, the port_associate()
    function serves to update the events and user arguments of
    the association. ..."
    Does this means that I need to create two separate ports - one for POLLIN events and the other for POLLOUT events in order to be able to achieve full duplex concurrent socket ?
    Since I'm quite new in Solaris development I would kindly ask you to give me a hint what would be the best way to implement something similar to Windows Asynchronous IO With Completion Port on Solaris OS.
    Many thanks
    Mirko

    Hi,
    Yes, it can't use single port to achieve full duplex socketing, under win32, there have some tools, for example [serial port splitter|http://www.softsea.com/review/Serial-Port-Splitter.html], can allow you to share one serial port among several applications, but Slaris can't support this, and the funcation port_associate() need use two separate ports.

  • Can I build a full-duplex serial port?

    I want to build a full-duplex serial port with PCI-6533, main features are:
    software: LabView
    hardware: PCI-6533
    serial port: full-duplex,synchronized
    clock: 13MHz, external feed
    control lines: 3
    data: about 1k bytes to be transfered
    Thanks and best regards,

    You can build it, but it won't be easy. Transmitting should be OK. But, for receiving, you are going to have to parse the information out of your incoming bitstream to get the information from the frame.
    Also, there is a peculiarity when usng the 2 timing sections together on the 6533. If you use any data width greater than 8 bits, you are only going to get 10MHz on each 'side', since the data has to be split between them by word. However, since you are serial and only using one bit, you don't have to worry.

  • TROUBLE BUILDING VISA Configure Serial Port .vi

    I posted by mistake in DAQ.  My application Builds fine in LV 7.0, however in LV 8.2 using the Project folder, I receive the following :
    Polymorphic VIs cannot be used as Startup/Exported or Dynamic VIs for applications or shared libraries.
    C:\NEM DS18S20 TEST-8.20\NEM0775B\NEM0775B.llb\VISA Configure Serial Port
    Visit the Request Support page at ni.com/ask to learn more about resolving this problem. Use the following information as a reference:
    Error 1035 occurred at ABAPI Dist Check if PolyVI.vi -> ABAPI Load All Libraries And VIs.vi -> ABAPI Dist Build LLB Image.vi -> ABAPI Copy Files and Apply Settings.vi -> EBEP_Invoke_Build_Engine.vi -> EBUIP_Build_Invoke.vi -> EBUIP_Build_Rule_Editor.vi -> EBUIP_Item_OnDoProperties.vi -> EBUIP_Item_OnDoProperties.vi.ProxyCaller
    Possible reason(s):
    LabVIEW:  Operation is invalid for this type of VI.
    I am using, Polymorphic VI = VISA Configure Serial Port to configure my serial port and then count bytes received for certain serial Port CmDs.
    I am only using the Serial Port (Instr) of the Polymorphic VI.  What is the easiest way to BUILD a application that will work????   I've used this method back to 4.1.  Can I change VISA Configure Serial Port .vi from a Polymorphoric to a Non Polymorphic and still initialize the Serial port??  This new BUILD/PROJECT METHOD is not good. 
    Please Help
    Brian Campbell

    Briancam-
    Have you set the VISA Configure Serial Port as a startup VI in your build specification? If you are using that VI as a subVI in one of your VI's, then you do not need to manually add it to the startup list, LabVIEW should automatically add it as a dependency.
    Xaq

  • Serial port monitor

    Does anyone know if there's some code / a program which would allow me to monitor what is going on with my computer's serial ports. I have been asked to write a program to replace the current program being used, that commumicates with a piece of hardware on a serial port. I can only find out what the command codes are by looking at what is sent between the existing application and the port (as there is no documentation / source code / anything useful).
    Many thanks,
    JB

    Please visit
    http://java.sun.com/products/javacomm/javadocs/API_user
    _guide.html
    http://java.sun.com/products/javacomm/javadocs/javax.co
    m.SerialPortEvent.html
    javacom allows you to intercept traffic on a serial port?

  • Serial port CTS monitoring

    I would like to know how to read the status of the Clear To Send (CTS) line.
    I need this in order to implement a write with timeout vi, required when
    using the RTS/CTS handshaking protocol.
    Thanks
    Gilles

    Hallo, Gilles,
    Du meintest am 21.09.99 zum Thema serial port CTS monitoring:
    > I would like to know how to read the status of the Clear To Send
    > (CTS) line.
    advanced/memory/in port
    If you run LabView under Windows NT, you need "hwaccess" from the NI ftp-
    server for direct port access.
    CTS is line 4 (2^4) at (port base + 6), the MSR (modem status register).
    Ralf Browns interrupt list (especially the "ports.lst") shows many
    details.
    Viele Gruesse!
    Helmut

  • I want to build an array using the data that I get through the serial port

    I am reading data through the serial port, but I want to buffer these data. I have seen a function, but i think that i can use this if I am reading data from I/O intrument, so I don´t how can I fill an array, with the data that I am reading!!!
    Thank you!!!

    I'll hazard a guess that you are reading data with VISA as a string. Then you want to convert that (probably with Scan From String) into a number. Then, you want to collect those numbers into an array.
    We don't really have enough information to tell you the best way to do this. Here are some ideas.
    If you are reading all the numbers from the instrument at once (e.g., a waveform from a scope), you might consider using "Spreadsheet string to array". Most scopes return the data as ASCII with commas between the values, so you'd wire a "," to the "delimiter" input of the "Spreadsheet string to array" function.
    If, however, the instrument is returning a single point at a time, there are more questions. Do you want to do this continuously, or do you want t
    o collect only a certain number of data points, and then process them as a block?
    If the latter, then you'd just acquire each data point, convert it to a number, and then use output indexing on the for loop to create your array.
    If the former, then you may want to store the data in a queue, and read it from the queue elsewhere in your program.
    If you let us know what you want to do, we can probably provide more precise help.
    Brian

  • How to access the serial port on sdk 3.1.3 ?

    Hi all,
    I know that accessing serial port is not possible on firmware 2.x for non jailbroken iPhones.
    But what about firmware 3.0?
    Apple has focused firmware 3.0 on accessories, through bluetooth or through serial port. So, accessing serial port should be possible.
    But I can't find any documentation / sample code for that.
    Would you please help me?
    Regards,
    Alx
    PS: I tried to read the port /dev/cu.iap and get this message:
    Error opening serial port /dev/cu.iap - Permission denied(13).
    Looks bad.

    Yes I am enregistred in the Mad For iPod program?
    And I try to communique with my accessorie
    So the Code
    +*// SerialPortsModuleAppDelegate.m*+
    +*// SerialPortsModule*+
    +*// Created by BPO iMac on 08/02/10.*+
    +*// Copyright _MyCompanyName_ 2010. All rights reserved.*+
    +*#import "SerialPortsModuleAppDelegate.h"*+
    +*#import <fcntl.h>*+
    +*@implementation SerialPortsModuleAppDelegate*+
    +*@synthesize window;*+
    +*- (void)applicationDidFinishLaunching:(UIApplication *)application {*+
    +*// Override point for customization after application launch*+
    +*[window makeKeyAndVisible];*+
    +* portSerie = [SerialManager alloc];*+
    +* [portSerie init];*+
    +* int nb_port;*+
    +* nb_port = [portSerie findRS232Ports];*+
    +* NSString path_port;+
    +* path_port = [NSString alloc];*+
    +* int num_port;*+
    +* if(nb_port!=0)*+
    +* {*+
    +* num_port=0;*+
    +* path_port=[portSerie pathAtIndex:num_port];*+
    +* int resultat= [portSerie openInput:path_port baudrate:9600 bits:8 parity:0 stopbits:1 flags:O_RDONLY];*+
    +* if(resultat==-1)*+
    +* {*+
    +* NSLog(@"Communication Error");*+
    +* }*+
    +* resultat= [portSerie openOutput:path_port baudrate:9600 bits:8 parity:0 stopbits:1];*+
    +* if(resultat==-1)*+
    +* {*+
    +* NSLog(@"Communication Error");*+
    +* }*+
    +* }*+
    +* [path_port release];*+
    +* *+
    +*- (void)dealloc {*+
    +*[window release];*+
    +*[super dealloc];*+
    @end
    +*// SerialPortsModuleAppDelegate.h*+
    +*// SerialPortsModule*+
    +*// Created by BPO iMac on 08/02/10.*+
    +*// Copyright _MyCompanyName_ 2010. All rights reserved.*+
    +*#import <UIKit/UIKit.h>*+
    +*#import "SerialManager.h"*+
    +*@interface SerialPortsModuleAppDelegate : NSObject <UIApplicationDelegate> {*+
    +*UIWindow window;+
    +* SerialManager portSerie;+
    +*@property (nonatomic, retain) IBOutlet UIWindow window;+
    @end
    +*// SerialManager.m*+
    +*// K3 Tools*+
    +*// Created by Kok Chen on 4/28/09.*+
    +*// Copyright 2009 Kok Chen, W7AY. All rights reserved.*+
    +*#import "SerialManager.h"*+
    +*#include <unistd.h>*+
    +*#include <termios.h>*+
    +*#include <sys/ioctl.h>*+
    +*#include <IOKit/IOKitLib.h>*+
    +*#include <IOKit/serial/IOSerialKeys.h>*+
    +*#import <fcntl.h>*+
    +*#import <UIKit/UIKit.h>*+
    +*@implementation SerialManager*+
    +*- (id)init*+
    +* self = [ super init ] ;*+
    +* if ( self ) {*+
    +* termiosBits = -1 ;*+
    +* inputfd = outputfd = -1 ;*+
    +* useTermiosThread = NO ;*+
    +* needsNotification = NO ;*+
    +* termioLock = [ [ NSLock alloc ] init ] ;*+
    +* }*+
    +* return self ;*+
    +*static int findPorts( CFStringRef *stream, CFStringRef *path, int maxDevice, CFStringRef type )*+
    +*kernreturnt kernResult ;*+
    +*machportt masterPort ;*+
    +* ioiteratort serialPortIterator ;*+
    +* ioobjectt modemService ;*+
    +*CFMutableDictionaryRef classesToMatch ;*+
    +* CFStringRef cfString ;*+
    +* int count ;*+
    +*kernResult = IOMasterPort( MACHPORTNULL, &masterPort ) ;*+
    +*if ( kernResult != KERN_SUCCESS ) return 0 ;*+
    +* *+
    +*classesToMatch = IOServiceMatching( kIOSerialBSDServiceValue ) ;*+
    +*if ( classesToMatch == NULL ) return 0 ;*+
    +* *+
    +* // get iterator for serial ports (including modems)*+
    +* CFDictionarySetValue( classesToMatch, CFSTR(kIOSerialBSDTypeKey), type ) ;*+
    +*kernResult = IOServiceGetMatchingServices( masterPort, classesToMatch, &serialPortIterator ) ;*+
    +* // walk through the iterator*+
    +* count = 0 ;*+
    +* while ( ( modemService = IOIteratorNext( serialPortIterator ) ) ) {*+
    +* if ( count >= maxDevice ) break ;*+
    +*cfString = IORegistryEntryCreateCFProperty( modemService, CFSTR(kIOTTYDeviceKey), kCFAllocatorDefault, 0 ) ;*+
    +*if ( cfString ) {*+
    +* stream[count] = cfString ;*+
    +* cfString = IORegistryEntryCreateCFProperty( modemService, CFSTR(kIOCalloutDeviceKey), kCFAllocatorDefault, 0 ) ;*+
    +* if ( cfString ) {*+
    +* path[count] = cfString ;*+
    +* count++ ;*+
    +* }*+
    +* }*+
    +*IOObjectRelease( modemService ) ;*+
    +* IOObjectRelease( serialPortIterator ) ;*+
    +* return count ;*+
    +*// return number of ports*+
    +*- (int)findPorts:(CFStringRef)type*+
    +* CFStringRef cstream[64], cpath[64] ;*+
    +* int i ;*+
    +* *+
    +* numberOfPorts = findPorts( cstream, cpath, 64, type ) ;*+
    +* for ( i = 0; i < numberOfPorts; i++ ) {*+
    +* stream = [ [ NSString stringWithString:(NSString*)cstream ] retain ] ;*+
    +* CFRelease( cstream ) ;*+
    +* path = [ [ NSString stringWithString:(NSString*)cpath ] retain ] ;*+
    +* CFRelease( cpath ) ;*+
    +* }*+
    +* return numberOfPorts ;*+
    +*- (int)findPorts*+
    +* return [ self findPorts:CFSTR( kIOSerialBSDAllTypes ) ] ;*+
    +*- (int)findModems*+
    +* return [ self findPorts:CFSTR( kIOSerialBSDModemType ) ] ;*+
    +*- (int)findRS232Ports*+
    +* return [ self findPorts:CFSTR( kIOSerialBSDRS232Type ) ] ;*+
    +*- (NSString)streamAtIndex:(int)n+
    +* if ( n < 0 || n >= numberOfPorts ) return nil ;*+
    +* return stream[n] ;*+
    +*- (NSString)pathAtIndex:(int)n+
    +* if ( n < 0 || n >= numberOfPorts ) return nil ;*+
    +* return path[n] ;*+
    +*// common function to open port and set up serial port parameters*+
    +*static int openPort( NSString *path, int speed, int bits, int parity, int stops, int openFlags, Boolean input )*+
    +* int fd, cflag ;*+
    +* struct termios termattr ;*+
    +* *+
    +* fd = open( [ path cStringUsingEncoding:NSASCIIStringEncoding], openFlags ) ;*+
    +* if ( fd < 0 ) return -1 ;*+
    +* *+
    +* // build other flags*+
    +* cflag = 0 ;*+
    +* cflag |= ( bits == 7 ) ? CS7 : CS8 ; // bits*+
    +* if ( parity != 0 ) {*+
    +* cflag |= PARENB ; // parity*+
    +* if ( parity == 1 ) cflag |= PARODD ;*+
    +* }*+
    +* if ( stops > 1 ) cflag |= CSTOPB ;*+
    +* *+
    +* // merge flags into termios attributes*+
    +* tcgetattr( fd, &termattr ) ;*+
    +* termattr.c_cflag &= ~( CSIZE | PARENB | PARODD | CSTOPB ) ; // clear all bits and merge in our selection*+
    +* termattr.c_cflag |= cflag ;*+
    +* *+
    +* // set speed, split speed not support on Mac OS X?*+
    +* cfsetispeed( &termattr, speed ) ;*+
    +* cfsetospeed( &termattr, speed ) ;*+
    +* // set termios*+
    +* tcsetattr( fd, TCSANOW, &termattr ) ;*+
    +* return fd ;*+
    +*- (int)openInput:(NSString*)pathname baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops flags:(int)openFlags*+
    +* return ( inputfd = openPort( pathname, speed, bits, parity, stops, openFlags, YES ) ) ;*+
    +*- (int)openInput:(NSString*)pathname baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops*+
    +* return ( inputfd = openPort( pathname, speed, bits, parity, stops, ( O_RDONLY | O_NOCTTY | O_NDELAY ), YES ) ) ;*+
    +*- (int)openOutput:(NSString*)pathname baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops flags:(int)openFlags*+
    +* return ( outputfd = openPort( pathname, speed, bits, parity, stops, openFlags, NO ) ) ;*+
    +*- (int)openOutput:(NSString*)pathname baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops*+
    +* return ( outputfd = openPort( pathname, speed, bits, parity, stops, ( O_WRONLY | O_NOCTTY | O_NDELAY ), NO ) ) ;*+
    +*- (void)closeInput*+
    +* if ( inputfd > 0 ) close( inputfd ) ;*+
    +*- (void)closeOutput*+
    +* if ( outputfd > 0 ) close( outputfd ) ;*+
    +*- (int)inputFileDescriptor*+
    +* return inputfd ;*+
    +*- (int)outputFileDescriptor*+
    +* return outputfd ;*+
    +*- (int)getTermios*+
    +* int bits ;*+
    +* *+
    +* if ( inputfd > 0 ) {*+
    +* [ termioLock lock ] ;*+
    +* ioctl( inputfd, TIOCMGET, &bits ) ;*+
    +* [ termioLock unlock ] ;*+
    +* return bits ;*+
    +* }*+
    +* return 0 ;*+
    +*- (void)setRTS:(Boolean)state*+
    +* int bits ;*+
    +* if ( inputfd > 0 ) {*+
    +* [ termioLock lock ] ;*+
    +* ioctl( inputfd, TIOCMGET, &bits ) ;*+
    +* if ( state ) bits |= TIOCM_RTS ; else bits &= ~( TIOCM_RTS ) ;*+
    +* ioctl( inputfd, TIOCMSET, &bits ) ;*+
    +* [ termioLock unlock ] ;*+
    +* }*+
    +*- (void)setDTR:(Boolean)state*+
    +* int bits ;*+
    +* if ( inputfd > 0 ) {*+
    +* [ termioLock lock ] ;*+
    +* ioctl( inputfd, TIOCMGET, &bits ) ;*+
    +* if ( state ) bits |= TIOCM_DTR ; else bits &= ~( TIOCM_DTR ) ;*+
    +* ioctl( inputfd, TIOCMSET, &bits ) ;*+
    +* [ termioLock unlock ] ;*+
    +* }*+
    +*// IO Notifications*+
    +*// prototype for delegate*+
    +*- (void)port:(NSString*)name added:(Boolean)added*+
    +* if ( delegate && [ delegate respondsToSelector:@selector(port:added:) ] ) [ delegate port:name added:added ] ;*+
    +*// this is called from deviceAdded() and deviceRemoved() callbacks*+
    +*- (void)portsChanged:(Boolean)added iterator:(ioiteratort)iterator*+
    +* ioobjectt modemService ;*+
    +* CFStringRef cfString ;*+
    +* while ( ( modemService = IOIteratorNext( iterator ) ) > 0 ) {*+
    +* cfString = IORegistryEntryCreateCFProperty( modemService, CFSTR( kIOTTYDeviceKey ), kCFAllocatorDefault, 0 ) ;*+
    +* if ( cfString ) {*+
    +* [ self port:(NSString*)cfString added:added ] ;*+
    +* CFRelease( cfString ) ;*+
    +* }*+
    +* IOObjectRelease( modemService ) ;*+
    +* }*+
    +*// callback notification when device added*+
    +*static void deviceAdded(void *refcon, ioiteratort iterator )*+
    +* ioobjectt modemService ;*+
    +* *+
    +* if ( refcon ) [ (SerialManager*)refcon portsChanged:YES iterator:iterator ] ;*+
    +* else {*+
    +* while ( modemService = IOIteratorNext( iterator ) ) IOObjectRelease( modemService ) ;*+
    +* }*+
    +*static void deviceRemoved(void *refcon, ioiteratort iterator )*+
    +* ioobjectt modemService ;*+
    +* *+
    +* if ( refcon ) [ (SerialManager*)refcon portsChanged:NO iterator:iterator ] ;*+
    +* else {*+
    +* while ( modemService = IOIteratorNext( iterator ) ) IOObjectRelease( modemService ) ;*+
    +* }*+
    +*- (void)startNotification*+
    +* CFMutableDictionaryRef matchingDict ;*+
    +* *+
    +* notifyPort = IONotificationPortCreate( kIOMasterPortDefault ) ;*+
    +* CFRunLoopAddSource( CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource( notifyPort ), kCFRunLoopDefaultMode ) ;*+
    +* matchingDict = IOServiceMatching( kIOSerialBSDServiceValue ) ;*+
    +* CFRetain( matchingDict ) ;*+
    +* CFDictionarySetValue( matchingDict, CFSTR(kIOSerialBSDTypeKey), CFSTR( kIOSerialBSDAllTypes ) ) ;*+
    +* *+
    +* IOServiceAddMatchingNotification( notifyPort, kIOFirstMatchNotification, matchingDict, deviceAdded, self, &addIterator ) ;*+
    +* deviceAdded( nil, addIterator ) ; // set up addIterator*+
    +* IOServiceAddMatchingNotification( notifyPort, kIOTerminatedNotification, matchingDict, deviceRemoved, self, &removeIterator ) ;*+
    +* deviceRemoved( nil, removeIterator ) ; // set up removeIterator*+
    +*- (void)stopNotification*+
    +* if ( addIterator ) {*+
    +* IOObjectRelease( addIterator ) ;*+
    +* addIterator = 0 ;*+
    +* }*+
    +* if ( removeIterator ) {*+
    +* IOObjectRelease( removeIterator ) ;*+
    +* removeIterator = 0 ;*+
    +* }*+
    +* if ( notifyPort ) {*+
    +* CFRunLoopRemoveSource( CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource( notifyPort ), kCFRunLoopDefaultMode ) ;*+
    +* IONotificationPortDestroy( notifyPort ) ;*+
    +* notifyPort = nil ;*+
    +* }*+
    +*// prototype for delegate or subclass*+
    +*- (void)controlFlagsChanged:(int)termbits*+
    +* if ( delegate && [ delegate respondsToSelector:@selector(controlFlagsChanged:) ] ) [ delegate controlFlagsChanged:termbits ] ;*+
    +*- (void)termiosThread*+
    +* NSAutoreleasePool *pool = [ [ NSAutoreleasePool alloc ] init ] ;*+
    +* int termbits ;*+
    +* while ( 1 ) {*+
    +* if ( useTermiosThread == NO ) break ;*+
    +* if ( inputfd > 0 ) {*+
    +* if ( [ termioLock tryLock ] ) {*+
    +* ioctl( inputfd, TIOCMGET, &termbits ) ;*+
    +* if ( termiosBits != termbits ) [ self controlFlagsChanged:termbits ] ;*+
    +* termiosBits = termbits ;*+
    +* [ termioLock unlock ] ;*+
    +* }*+
    +* [ NSThread sleepUntilDate:[ NSDate dateWithTimeIntervalSinceNow:0.25 ] ] ;*+
    +* }*+
    +* else {*+
    +* [ NSThread sleepUntilDate:[ NSDate dateWithTimeIntervalSinceNow:1.0 ] ] ;*+
    +* }*+
    +* }*+
    +* [ pool release ] ;*+
    +*// If delegate is set, setDelegate also starts a termiosThread if delegate responds to -controlFlagsChanged:*+
    +*- (void)setDelegate:(id)object*+
    +* delegate = object ;*+
    +* if ( delegate == nil ) {*+
    +* useTermiosThread = NO ;*+
    +* if ( needsNotification ) {*+
    +* needsNotification = NO ;*+
    +* [ self stopNotification ] ;*+
    +* }*+
    +* }*+
    +* else {*+
    +* if ( [ delegate respondsToSelector:@selector(controlFlagsChanged:) ] ) {*+
    +* useTermiosThread = YES ;*+
    +* [ NSThread detachNewThreadSelector:@selector(termiosThread) toTarget:self withObject:nil ] ;*+
    +* } *+
    +* if ( [ delegate respondsToSelector:@selector(port:added:) ] ) {*+
    +* needsNotification = YES ;*+
    +* [ self startNotification ] ;*+
    +* }*+
    +* }*+
    +*- (id)delegate*+
    +* return delegate ;*+
    @end
    +*// SerialManager.h*+
    +*// K3 Tools*+
    +*// Created by Kok Chen on 4/28/09.*+
    +*// Copyright 2009 Kok Chen, W7AY. All rights reserved.*+
    +*//#import <Cocoa/Cocoa.h>*+
    +*#import <Foundation/Foundation.h>*+
    +*#import <UIKit/UIKit.h>*+
    +*#import <CoreData/CoreData.h>*+
    +*//#import <IOKit/IOKitLib.h>*+
    +*//#import <IOKitLib.h>*+
    +*#include <IOKit/IOKitLib.h>*+
    +*typedef int FileDescriptor ;*+
    +*@interface SerialManager : NSObject {*+
    +* NSLock *termioLock ;*+
    +* FileDescriptor outputfd ;*+
    +* FileDescriptor inputfd ;*+
    +* id delegate ;*+
    +* // serial ports in system*+
    +* NSString *stream[64] ;*+
    +* NSString *path[64] ;*+
    +* int numberOfPorts ;*+
    +* *+
    +* // termios*+
    +* int termiosBits ;*+
    +* Boolean useTermiosThread ;*+
    +* *+
    +* // IO notifications*+
    +* IONotificationPortRef notifyPort ;*+
    +* ioiteratort addIterator, removeIterator ;*+
    +* Boolean needsNotification ;*+
    +*- (void)setDelegate:(id)sender ;*+
    +*- (int)findPorts ;*+
    +*- (int)findModems ;*+
    +*- (int)findRS232Ports ;*+
    +*- (NSString*)streamAtIndex:(int)n ;*+
    +*- (NSString*)pathAtIndex:(int)n ;*+
    +*- (FileDescriptor)openInput:(NSString*)path baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops ;*+
    +*- (FileDescriptor)openInput:(NSString*)path baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops flags:(int)openFlags ;*+
    +*- (FileDescriptor)openOutput:(NSString*)path baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops ;*+
    +*- (FileDescriptor)openOutput:(NSString*)path baudrate:(int)speed bits:(int)bits parity:(int)parity stopbits:(int)stops flags:(int)openFlags ;*+
    +*- (void)closeInput ;*+
    +*- (void)closeOutput ;*+
    +*- (FileDescriptor)inputFileDescriptor ;*+
    +*- (FileDescriptor)outputFileDescriptor ;*+
    +*- (int)getTermios ;*+
    +*- (void)setRTS:(Boolean)state ;*+
    +*- (void)setDTR:(Boolean)state ;*+
    +*- (void)setDelegate:(id)object ;*+
    +*- (id)delegate ;*+
    +*// delegates*+
    +*- (void)port:(NSString*)name added:(Boolean)added ;*+
    +*- (void)controlFlagsChanged:(int)termbits ;*+
    @end
    Could you help me ?

  • Occasional freeze when reading serial port

    I've a labview application which is a gui for a remote device via RS422.  The host computer is a quad core running XP SP3.  Initially I was developing with labview 7.1.1.  At random intervals (anywhere between 10 minutes and 5 hours observed), labview will freeze.  Using a port monitor during this freeze, I'm able to observe repeating calls for IOCTL_SERIAL_GET_COMM_STATUS followed by IRP_MJ_READ.  VISA is configured for 0.5s timeout.  The serial card is a MOXA, CP-114EL (4port RS422).  During the freeze, Labview cannot be closed.  Sometimes it will try by displaying the "Resetting..." text but it never completes.  A hard reset is then required.  After the freeze, processor usage is 25% (on average, 1 processor working full time for labview, but bouncing between cores).  Before the freeze, its less than 2%.
    At first I investigated the serial card driver via emails with MOXA.  After running a terminal emulation program and a loopback connector they gave me for several days without their program freezing, they're confident the problem isn't with their card or driver.  During discussions with them, I installed the evaluation of LabVIEW 2009.  The program still freezes except now I have less access to the VI (I used to be able to switch to the block diagram and via the highlighter tool observe it stuck in the read operation.  In either version though, the above mentioned port monitor output is the same.
    My instinct is that the source of the problem is in the multi-core application, some kind of timeout race condition.  My VI is fairly simple in summary, write a command (read temps, read status, write new params, etc) and wait for reply timing out if there's a problem.  Repeat.  Serial port is configured for 115kbps and transfers are in binary.  Before the freeze, the communication works well.
    I appreciate any suggestions.  I've looked around the net and this forum and didn't find anything similar.  Long time reader, first time poster.  I've a lot of experience in labview but can't solve this - the random interval doesn't help.  I think I'll start logging all serial transfers and see if anything always occurs before the freezing.

    This morning I updated the labview drivers to the most recent online (I hadn't done that yet when I installed LV2009, download was large).  It was something I planned to try if the LV2009 change alone did not resolve things.  The update also did not solve the serial freezing problem.
    I've attached two captures from NI Spy, one during normal operation and one of the last capture (up to the arrow).  I did a brief probing of a different VI that isn't a part of this afterward.  You can see the Read request of Com 2 for 266 bytes.  In the before image, red lines are timeouts.  So this read request is hung up waiting for bytes and never timing out.  That's at least my interpretation.
    I appreciate your and tbob's suggestions.  I've a new serial card (Brainboxes PX-310 card) to try coming soon, not that I don't want to solve this, I just can't spend too much time on it.  If it still gets hung up on the new card, I'll look into the motherboard PCIe port, maybe a failing transaction.  I would've went with the NI card but I need electrical isolation and 8 ports is excessive.
    Attachments:
    NI Spy - before freeze.JPG ‏104 KB
    NI Spy - after freeze.JPG ‏108 KB

  • After Effects scripting: Serial port access?

    Hi,
    Does any one know if it's possible to access the computer's serial port using an After Effectsc script?
    I'm building a motion control script and I'm wondering if I can use a script to read the values of a keyframed parameter(e.g. a slider effect on a solid layer) to send serial port commands to move my rig.
    Regards,
    Ihab Ali

    I don't think that ExtendScript for AE ships with a way to do that out of the box, but in the Javascript Tools Guide for CS5, there is a section titled "Integrated External Libraries" which reads:
    You can extend the JavaScript DOM for an application by writing a C or C++ shared library, compiling it for the platform you are using, and loading it into JavaScript as an ExternalObject object. A shared library is implemented by a DLL in Windows, a bundle or framework in Mac OS, or a SharedObject in UNIX.
    You can access the library functions directly through the ExternalObject instance, or you can define an interface that allows your C/C++ code to create and access JavaScript classes and objects.
    All Adobe Creative Suite 4 applications support this feature.
    So you can probably write an app in C or C++ which communicates directly to the machine's port, and then call functions you declare in that code via ExtendScript.  Sorry I couldn't be of much help here, but that's where I would start.
    --Arie

  • Fieldpoint serial port communication?

    Hi,
      I am a researcher from School of Biotechnology, Dublin City University, Ireland. I have been using Labview programming (version 8.2) for bioprocess monitor and control. I am using Fieldpoint (FP2010) module for data acquistion and control.  I've connected analog outputs from various controllers to appropriate channels and found data acquistion working fine using respective VI's. We have few instrument outputs which are need to be connected through serial interface on filedpoint's serial port. We are using  a multiplexer (B & B electronics) for channeling all serial outputs (of instruments) to serial port of Filedpoint. VI's developed for all serial interface of multiplexer ports  found working (data logging ok!) , when it is connected directly to COM1 port of PC. But when multiplexer serial interface is connected to serial port of Fieldpoint, the data values fails to log on the PC. Ethernet cable is used for interfacing filedpoint with PC. It seems the PC recognises COM1 port for serial interface but not serial port of Field point.
    We have a driver software for multiplexer, where we already configured all serial input and output ports as required. How to configure PC to serial port present in Filedpoint instead of it using COM1?
    I tried playing with MAX configuration as wells device manager of PC, but system couldn't recognise serial port of filed point.
    kindly provide me a solution.
    Thanks
    Regards,
    Senthil

    Hi,
    There is a software component that normaly would provide the feature you are looking for. It is the VISA Server. Unfortunately this component is not installable by default on cFP 20x0 controllers because of memory limitations.
    Your controller has enough memory, so you could try  to install the Server by hacking the driver installation configuration file for the NI-VISA server. Keep in mind that this is not an official feature and the usability could be limited.
    Go to your   \\Program Files\National Instruments\RT Images\NI-VISA Server\4.x    folder and open the "install_81xx.cdf" file with your wordpad.
    Add the bold line to the file as shown below:
    <?xml version="1.0"?>
    <?CDF VERSION="1.1"?>
    <SOFTPKG NAME="{E62A7BA2-8ED9-4C4A-AFA1-0DE33A188D61}" VERSION="4.4" TYPE="VISIBLE">
        <TITLE>NI-VISA Server</TITLE>
        <ABSTRACT>Remote VISA Server -- Shares VISA resources over the network.</ABSTRACT>
        <IMPLEMENTATION>
            <DEVICECLASS VALUE="PXI"/>
            <DEVICECLASS VALUE="Desktop"/>
            <PROCESSOR VALUE="7002"/>
            <PROCESSOR VALUE="7063"/>
            <PROCESSOR VALUE="7151"/>
            <PROCESSOR VALUE="7175"/>
            <PROCESSOR VALUE="E002"/>
            <PROCESSOR VALUE="E001"/>
    Save and close the file and close and reopen MAX. Go to your remote target and open the software installation tool. Now you should have the VISA server as an option for installation.
    After installing it and reboot, go back to your remote target in max and go to Software/NI-VISA 4.x and choose VISA Options at the right page. Go to Aliaes and choose "ADD Alias".
    Now enter ASRL1::INSTR into "Ressource Name" and "COM4" as Alias name for example. Now go to VISA Server /Security and add a * to allow access for every Host connected to your target.
    Save your settings and change to MySystem/Software/NI-VISA 4.x and go to VISA Options at the right page. Go to Aliaes and choose "ADD Alias".Now enter visa://your remote IP address/ASRL1::INSTR into "Ressource Name" and "COM4" as Alias name for example. Save your settings.
    Now you should be able to access your remote COM4 interface from your HOST, by using the COM4 alias within the VISA ressource control.
    DirkW

Maybe you are looking for

  • Printer Drivers for HP LaserJet CP1515N using Windows 7 64 bit

    I am repeating the message as it is shown as solve below and this is not correct. I am trying to find drivers for the HP LaserJet  CP1515N that work for network printing. The HP site shows drivers are available but when you try to load them it shows

  • How to avoid time out error in abap program

    How to avoid time out error in abap program based on performance wise i want please help

  • Looking for an advice in changing to archive mode my DB

    Hello buddies! I'm going to change a DB from no archive mode to archive mode. It's a RAc with ASM, 2 nodes. What I need that somebody verify these steps and give me suggestions. 1. Login to one of the nodes (i.e. linux1) and disable the cluster insta

  • Language Swithing

    Dear All, i am working on bilingual project. And my some of the fileds are in arabic. The problem i am facing is when ever i got focus on arabic field i use ALT+SHIFT key to change the input stat to arabic and when i go to english filed again then ag

  • Ultrabeat Patches/Presets Question

    I'm sure this will have been asked & probably answered before but i have done a search & found nothing on it. So I'll apologize now. Ok Ultrabeat patches or Ultrabeat presets. I know that Logic 8 already has an extensive library of presets for Ultrab