Serial Port Interface

Please excuse me, as I am a EE student and all this Java is new to me. I am obtaining information via a TI MSP430F449 board and wish to transfer this data to my PC via the serial port. I have been told that Java is the way to go to to do this. I would like to get the data, and then a further Java program will use it to represent the data graphically. Where do I begin? I was told that there are some pre-written software that encompass a variety of avenues. Is there a pre-written program addressing this serial port read issue? If so, is it documented well so that I can make the changes to customize it to my situation? Any information you can provide will be most appreciated.

You don't need sockets for this, socket is for network cimmunications, but there is another API for sending/receiving dara through the ports, which is the Java Comm. API, it should be your starting-point...
download available from
http://java.sun.com/products/javacomm/downloads/index.html
and the user's guide is here
http://java.sun.com/products/javacomm/javadocs/API_users_guide.html
Good luck
Regards,
Mohammed Sleem

Similar Messages

  • [SOLVED] usb serial port emulation

    Hello
    I'm an Arch newbie. I just purchased an HP Neoware CA21 thin client, replaced the small DOM unit by a 1GB module, and installed Arch on it. I would like to use this device as a kind of data logger, 24x7 continuous operation.
      The device I'm reading is an ADC connected via a USB port, which provides a CDC/ACM interface. When I plug it into the CA21 USB port, /dev/ttyACM0 does appear. Under Ubuntu on a normal PC the same happens but I find I can only use it via the usbserial driver, which provides serial port emulation for a USB device, creating /dev/ttyUSB0. That's because I can't get the java serial port interface rxtx to recognise a ttyACMn device, for reasons I don't understand and am still investigating.
    So, I have a couple of newbie questions about Arch ...
    1/ is there an equivalent to usbserial, ie a serial port emulation for USB ports?
    2/ if not, or perhaps more correctly, how can my java app interface to ttyACM0? The Arduino crowd may know about this.
    3/ I'm kind of assuming rxtx works under Arch - is that right?
    Thanks for any help.
    Andrew
    Last edited by mistertransistor (2011-11-12 16:43:03)

    Well, kind of solved. I found that
    - adding the "options usbserial ..." line does not prevent ttyACM0 from appearing when the device is plugged in
    - once ttyACM0 is there, no amount of "modprobe usbserial ..." will make ttyUSB0 appear
    - however, if you "rmmod cdc-acm" and then "modprobe usbserial ..." you will get a ttyUSB0
    Having figured that out, I got a test app reading the USB port with no problems. However my real app gave some odd 'Main class not found  ...' error even though the exact same jarfile runs fine under Windows XP (you may be wondering why I develop there rather than under Ubuntu. Well, I have a dual-boot machine XP/Ubuntu and NetBeans runs *much* better under XP - quite puzzling).  Eventually I solved this by creating a new NetBeans project/application and copying in the code from the existing one - a total mystery to me).
    So now the device is in my garage collecting data from my seismograph. I'm writing to a USB stick, not sure about how long that will last but as I don't delete files much it's always writing in a new area and any given area gets very few write cycles.
    This is marked SOLVED but I still have not found how to read ttyACM0 and I would like to do that.
    Andrew

  • Any idea on what is causing my serial ports to lock up?

    I recently purchased the NI serial-usb 4 serial port interface box because I was having a problem of my serial ports locking up, and I thought the problem might be with my serial port card. Well, after a few days with the NI boxes 2 of my serial ports locked up. This is a big problem that I need to get resolved. If anyone has any ideas on what might be causing this please let me know.
    I am running Lookout 5.0 (build 7) and Logos 4.4.0.17 on a Dell Windows XP machine with 1GB RAM and a 2 GHz processor. I have already tried recompiling my Lookout file and clearing out my database but the problem still occurs. If I restart the file then the ports start working fine again, but I need to know what is causing this since this
    wasn't a problem until about 2 months ago.
    Any responses would be greatly appreciated.
    Thanks
    Jason
    Jason Phillips

    Thanks for the response, Ben.
    I have Laplink running on the computer all the time, and we do have 2 SCADA packs in the field at this time, but I don't run the Telepace program on this computer. This computer does not have a modem. As far as the serial port card, I was using a "Byterunner" 4 serial port card but I purchased the NI 4 serial port -usb interface because I thought the byterunner card might be the problem.
    Do you think Laplink could be causing the problem?
    Jason
    Jason Phillips

  • CPU load goes to 100% with IMAQ interface and 4 serial ports. Any trick?

    Hello to all,
    I am using an IMAQ interface in conjunction with 4 serial ports for data acquisition. Both systems run with different VI's. My problem comes when I run both at the same time. In this case the CPU goes to 100%, and both programs slow down drastically. I must keep a sample rate between 300 and 600 ms for the test (easily achieved by the IMAQ or when I run only the VI for the serial ports), but unfortunately the sample rate goes to 3-4 seconds when running both programs at the same time.
    I have put “Wait (ms)” in every single while loop, but the delay stays and the CPU is still on the 100%.
    Do you have any clue to overcome this? Any help will be greatly appreciated.
    Thanks in advance.
    Best regards,
    Alejo.

    Ok, this is my VI for the data aquisition through the 4 serial ports. The block diagram of the IMAQ sofware is password protected and I cannot send it at this time. I hope the problem is in the first one.
    Again, thanks.
    Alejo.
    Attachments:
    Micrometers.zip ‏111 KB

  • Using a PS/2 keyboard on a Sparc workstation through the serial port

    We have recently migrated an application that used to run on a PC, to now run on a Sparc Workstation. This is a SunBlade 1500, running Solaris 8. The application is running in a dedicated console which has a fitted keyboard and trackerball that have PS/2 connectors and cannot be changed.
    We need a way of connecting the PS/2 keyboards to the serial ports of the Sparc workstation. We already have a piece of software that will read ascii values from the serial port so we definately want to go through the serial ports.
    Can someone please suggest what converters will be required to get the output of the keyboard and trackerball as ascii input to the serial port.

    Actually, that's not a bit perverse, at all.
    Jonathan's suggestion is a standard method of connecting to a server.
    (null cable between the computer serial ports)
    ... see the Solaris man pages.
    man tip
    TeraTerm and Hyperterminal are customarily used on a PC running some dialect of Windows.
    The 'tip' command is all that's necessary between Solaris systems.
    PS/2 is not a serial connection, but is a keyboard/mouse interface 'invented' by IBM when they offered their XT-class PS/2 line of desktop systems, back in the 1980's.
    I found this next link by using Google:
    http://members.chello.at/theodor.lauppert/computer/ps2/
    The smaller DIN ports were more compact than the AT-class keyboard ports and the mouse moved from a serial port to a dedicated mouse port.
    Serial communication devices are not keyboards, per se,
    and keyboards are not serial communication devices.
    You need other hardware in between to translate what the human being sends, and another computer is a common method to accomplish that translation.
    Having said all that ...
    Since you cannot change the dedicated console hardware,
    I suggest you go to the manufacturer of that console equipment
    and have them suggest some sort of serial-to-serial interface lash-up.

  • Usb to serial port converter in lenova g560

    hi this is madhan. i m using lenova g560 ideapad. there is no serial port in my laptop. For my project i need a serial port. i heard tat in market USB to serial port converters are available. Does Lenova g560 support this change?? If so is there any driver to make support to serial port?????????

    If you buy a Serial-USB interface/cable you won't have any problem. Usually this accesory comes with drivers. If you have Windows 7, mayte it will detect all automaticaly.
    Regards.
    IPnaSh
    First Spanish Community Guru - Colaborador ad honorem

  • Usb to Serial port adapter

    I have a gilsson usb to serial port bi directional adapter cable which uses the Prolific pl-2303 chipset. I am attempting to use this cable to interface a Mac Mini with a Harsper PDP plasma television.
    I am attempting to control the functions of the television via the serial port on the television. i.e. Turn on, input, volume, etc.
    What I need is software, or source code that would allow me to send hexidecimal commands to the television and receive the task completed codes.

    ZTerm will allow serial communications. Get it to ensure that throughput is happening as expected.
    RealBasic will allow you to roll your own with a fair amount of ease.
    A long time ago I used the above to communicate with my cellphone to send and receive text messages via the serial port, so I know it can work. Understanding the protocols is the difficult part...

  • 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 ?

  • Writing bytes to serial port in each iteration of loop

    Hello everyone,
                      Well I am new to labview, my question might of beginner's level but i have searched the forums and didnt find content regarding it. Kindly help me through it as i am really stuck in it for last three days. 
                      I have to make a packet of bytes in each iteration depending upon the bytes i get from array which is input to for loop. Taking five bytes and then making packet according to protocol. Once packet is made i have to send it to serial port in the same iteration. So for each iteration i have to send packet to serial port. I have tried the shift registers, local variables, and also the autoindexing which returns the array at the end of loop. But these things dont solve my problem. Kindly help me solvng this issue.
    Many many thanks in advance
    Engr. Yasir Amin 

    First of all thanks alot for your reply.
                             The problem is that i have made separate subVI for this protocol stuffing and the output of that subVI is attatched to the serial visa write in another main  VI in which i am using this VI. I have sent parameters to subVI which makes the packet and then send the output, the output is then sent to visa serial write. Actually that visa serial write is common to many subVIs, On the interface its user's choice to select the request he wants to send. The based on the request the particular subVI is chosen and then that subVI generates the string which is in main VI. which is written to serial port. All other subVis are working fine becoz they dont have loop they simply make the string and send it to port. But this subVi with the loop has the problem as it sends only the last iteration string to port.
    I cant post the code as i am using my laptop in my room and the code is in office laptop But tomorrow i can share it from office
    Thanks
    Yasir

  • Connecting direct to serial port

    Hi to all!!
    I need to connect flash direct to serial port to send and
    receive data.
    I know that i have to look for some API, but all that i fund
    is some other software to do the interface, but i realy need is
    distribut only the flash and not the flash and other software...
    There is a way to connect direct to serial com?
    If yes, how it works, were can i found information to do
    this??
    Tanks in advance!
    Regards from, Portugal

    Yes, PCSuite supports a great deal of Bluetooth drivers. These are all built in so, give it a try.
    Windows Vista x32 en x64 editions:
    Microsoft Windows Bluetooth stack
    Toshiba Bluetooth stack, driver versie 5.10.12
    IVT BlueSoleil Bluetooth stack, driver versie 5.0.5
    Windows XP x64:
    Microsoft Windows Bluetooth stack
    Toshiba Bluetooth stack, driver versie 5.10.12
    IVT BlueSoleil Bluetooth stack, driver versie 5.0.5
    Windows XP:
    Microsoft Windows Bluetooth (enkel in Service Pack 2)
    Toshiba Bluetooth stack, driver versie 4.0, 5.0 and 5.10.12
    WIDCOMM Bluetooth stack, driver versie 1.4.2, 3.x, 4.x and 5.x
    IVT BlueSoleil Bluetooth stack, driver versie 2.x, 3.x and 5.0.5
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • Write data to serial port every two minutes

    Hi,
       I use VISA-Write to write data to serial port. I want to write a byte every two minutes. What should I do?
      Thanks!

    hengfo,
    that question is not connected to LV nor to VISA. Its more a systematic question....
    So let's view at this a bit more abstract:
    You want to "toogle" between two different messages sent to your interface. So you have to know:
    - What was the last state i sent?
    - When do i have top send the new state?
    Even more abstract:
    - How can i switch between the states?
    Since the states are known before your program is executed, you can insert them into an array. Next, you have to read out the appropriate index from the array which contains your new state. Send the state and go to the next state. Propably you want to change timing, but that's easy too.
    See attached screenshot for a possible solution:
    hope this helps,
    NorbertMessage Edited by Norbert B on 09-11-2007 07:57 AM
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.
    Attachments:
    StateSwitching.PNG ‏8 KB

  • USB to Serial port delay

    I have some LabVIEW code that communicates with a TI MSP430 development board via a USB serial port simulator. The hardware that does the serial to USB conversion is part of the development board. how the application works is the LabVIEW code sends a request using the VISA write VI, and the board responds.  The requests and responses are both about 5-6 bytes each, and are being sent at 115200 baud 8-N-1.
    Everything works, but there is a roughly 600ms delay between sending the request and receiving the first byte of the response. After the first byte is received, the other bytes are received within 1 ms.  I assumed the firmware in the develoment board was slow, but I put a scope on the RX and TX lines coming out of the microcontroller, and the firmware responds in less than 1 ms, so the microcontroller isn't the issue. So somewhere between the UART to USB hardware, and LabVIEW, there is a 600ms delay.  I have a feeling that it is the TI development board, or drivers that are holding things up. The USB to serial stuff seems to be kind of flaky generally on these boards.  However, I wanted to come on here, and see if anyone had any ideas about how I might figure this out, or what might be wrong.  I'm going to post on the TI forums also, and see if I get a resonse there.
    Has anyone seen an issue like this before using USB to serial converters?
    Is there something else I could try to narrow down where the issue is, or rule out some part of the system (like making sure that it isn't an issue with the VISA drivers)?

    Jeff·Þ·Bohrer wrote:
    What is the USB-Serial chipset?
    The FTDI drivers offer some latentcy optimizations.  Others do not.
    Most TI MSP430 boards have their own build in USB interface based on the TUSB3410 from TI and the according driver for it is the TUSBWINVCP package. Nothing to do with FTDI.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Can not access serial port while upgrading from LabVIEW 6.1 to 7.0

    Hi,
    I built an application under LabVIEW 6.0.2. few years ago. This application uses LabVIEW serial features. When I upgraded to LabVIEW 6.1, my application was still working correctly.
    Today, I upgraded to LabVIEW 7.0, mass compile all VIs and now my application can not communicate with my peripheral !!!
    The program is sending the command to the peripheral. The peripheral answers but LabVIEW serial driver does not see any datas on buffer even if datas are available ... "Bytes At serial port.vi" always returns 0. I am sure that datas are available, using a COM port psy.
    Does anyone has an idea?
    I saw a lot of solutions in the forum, but I would like to know the best solution with minimum work, te
    st, and so on ... on my program.
    Regards,
    Pascal.

    Hi Pascal,
    Which is your version of NI-VISA?
    Please see the link bellow :
    http://digital.ni.com/manuals.nsf/websearch/E8D86CD680B0753D86256D2C005D8EA0
    The first test to be made is to test the communication with your serial port using MAX (Measurement and Automation Explorer) :
    Open MAX, Go to "Devices and Interfaces", then "Ports", select COM1 (or ASRL1::INSTR). Right clic on it and select "Open VISA Session" the go the "Basic I/O" then Write data, execute, Read data, execute.
    Be sure that the communication is OK. Be sure that you use the same Alias existing in MAX in your LabVIEW program.
    Now, if all is OK, try to use Serial communication examples existing in LabVIEW Help>>Examples Finder. These examples use NI-VISA VIs.
    If all above is OK and you
    still have the same problem, try to follow these instructions :
    "In order to use the old Serial Compatibility VIs in LabVIEW 7.x, you must copy the following files from a previous version of LabVIEW to the LabVIEW 7.x directory:
    Replace the serial.llb in LabVIEW 7.x with the serial.llb from a previous version of LabVIEW. This file is found in C:\Program Files\National Instruments\LabVIEW\vi.lib\instr.
    Replace the _sersup.llb file in LabVIEW 7.x with the _sersup.llb from a previous version of LabVIEW. In LabVIEW 6i and 6.1 this file is located in C:\Program Files\National Instruments\LabVIEW\vi.lib\platform. In LabVIEW 7.x (and 5.x) this file is found in C:\Program Files\National Instruments\LabVIEW\vi.lib\instr.
    Copy the file serpdrv to the C:\Program Files\National Instruments\LabVIEW 7.x directory. This file is not installed with LabVIEW 7.x, so it only needs to be copied from a previous version of LabVIEW, not replaced."
    I hope that my answer will help you.
    Sa
    naa T
    National Instruments

  • How can I use LabVIEW to send the equivalent of a CTRL D (in VT 100 format) out the serial port of my computer?

    I am trying to write a vi that interfaces with a piece of OEM equipment that is set up to talk with a VT 100 terminal. I can't seem to locate the ASCII equivalent string (if there is such a thing) of a CTRL D. Is there a vi that emulates VT 100 commands?

    If I recall, CTRL-D is EOF on most ASCII tables.
    You'd probably have to use an escape sequence
    or if you can use an unsigned 8-bit that might be
    easier.
    In article <[email protected]>, TLS
    wrote:
    > How can I use LabVIEW to send the equivalent of a CTRL D (in VT 100
    > format) out the serial port of my computer?
    >
    > I am trying to write a vi that interfaces with a piece of OEM
    > equipment that is set up to talk with a VT 100 terminal. I can't seem
    > to locate the ASCII equivalent string (if there is such a thing) of a
    > CTRL D. Is there a vi that emulates VT 100 commands?

  • The "VISA Configure Serial Port" VI will only run at 9600 Baud

    I have written a Serial Port monitor "RS232 RW.vi"  that works for the most part. The problem is that it will not respond to alternate port configuration settings.... For instance: the default RS232 Serial port configuration is:
    (COM1,9600 baud,8 data bits,1 Stop bit, None no parity)
    As a test, I am using a Null Modem Cable to connect From my LabView Com1 port to another PC running RealTerm Serial Port Monitor.. Using my newly designed "RS232 RW.vi"  With port settings of (COM1,9600 baud,8 data bits,1 Stop bit, None no parity),  I can send and receive data back and forth all day long no problems....
    However, if I configure the "RS232 RW.vi"  port to any other configuration, such as (COM1,2400 baud ,7 data bits,1 stop bit, Odd parity).. It will not take the expected chances and continues to operate @ 9600 baud etc.
    I then changed the "RS232 RW.vi"  default settings to (2400,7,1,Odd)
    it still refuses to deviate from (COM1, 9600,8,1,None...)
    I also went into the Win XP  Device Manager on the LabView system and manually configured Com1 to 2400,7,1,Odd  
    and still,.... the "RS232 RW.vi"  will only operate @ 9600,8,1,None
    Can anyone else test drive my VI and see if they have the same problem of not being able to see new changes in the Port configuration settings ..other than (COM1, 9600,8,1,None...).... ?
    FYI.. Unfortunately my LabView is running on Version 6.0 so you may need to up-convert the attached vi
    Solved!
    Go to Solution.
    Attachments:
    RS232 RW.vi ‏102 KB

    Instead of just appreciating the comments, you need to implement them.
    Having the VISA close inside the loop is definitely the problem.  And Crossrulz is 100% correct about the problem being that the serial port gets reset to the default baud rate after closing the port.  Here is the proof.
    Note that while you may have set the port settings manually in device manager, those settings are revised by the VISA driver.  If you look in Measurement and Automation Explorer under Devices and Interfaces >> Serial and Parallel, you'll see the default settings that the VISA driver uses.  If you change the setting there, your program will work the way you want.  But that is not the correct fix.  The correct fix is to get the VISA close out of the while loop.
    The port settings are established in this order.
    1.  By the Windows device drivers.
    2.  By the VISA driver as established in MAX.  Since you are useing VISA, these settings will automatically override #1.
    3.  By the port settings you set programmatically in your LabVIEW program.
    Attachments:
    Example_VI.png ‏18 KB

Maybe you are looking for

  • Multidimensional Reporting

    Dear experts, I want to join an existing data model containing the following 2 data flows: 1) Content Flow from DataSource 1_CO_PAxx to Cube 0COPA_C01 (via Content InfoSource) 2) Customed Flow with Billing-Data to Cube from 2LIS_13_VDITM (via InfoSou

  • Installer problems - Could not find the main class

    Hello I am trying to install openmq on vista and having problems. I've had the same problem with a nightly build of 4.3 and stable 4.2 build. The install kicks off fine until I get to the part where the install happens and then I get: Java Virtual Ma

  • How can I crop a photo without losing quality?

    I am trying to crop photos and then have them printed to poster size. The pictures are all 1.2 mb or larger. When I crop them the resulting picture (jpeg) is so small it lacks the resolution for enlarging to poster size. Is there a way to crop a pict

  • Photoshop CS5 HDR Pro

    Can anyone help me with Photoshop CS5 HDR Pro screen, the problem is after merging photos using the HDR Pro merge, the HDR Pro screen is too large where I can't navigate to the "OK" or Cancel "button which are located at the bottom right. Called Adob

  • HT1766 how to know that what itunes take in action in back up

    How could i know what the itunes has taken in to backup???