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 ?

Similar Messages

  • How to access the serial port in Java?

    How can I initialise and access the serial port for writing and reading data from it? Are there any code examples available?

    I tried that and I tried compiling and executing one of its examples, the one below:
    import java.io.*;
    import java.util.*;
    import javax.comm.*;
    public class SimpleWrite {
    static Enumeration portList;
    static CommPortIdentifier portId;
    static String messageString = "Hello, world!\n";
    static SerialPort serialPort;
    static OutputStream outputStream;
    public static void main(String[] args) {
    portList = CommPortIdentifier.getPortIdentifiers();
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier) portList.nextElement();
    if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    if (portId.getName().equals("COM1")) {
    //if (portId.getName().equals("/dev/term/a")) {
    try {
    serialPort = (SerialPort)
    portId.open("SimpleWriteApp", 2000);
    } catch (PortInUseException e) {}
    try {
    outputStream = serialPort.getOutputStream();
    } catch (IOException e) {}
    try {
    serialPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {}
    try {
    outputStream.write(messageString.getBytes());
    } catch (IOException e) {}
    But when I execute this I get the error:
    Exception in thread "main" java.lang.NoClassDefFoundError: SimpleWrite
    What is wrong with this example??

  • How to use the serial port

    hello
    I would like to know if there is other library than comm to use to establish communication with the serial port ..
    can we do this with pure java ,I mean without the need of using any library ???
    if not then what is the best library to use ???
    any examples ??
    I have other question
    when i use the library comm
    I use the public void serialEvent(SerialPortEvent event) to get my data
    but that data comme line by line
    is there a way to get all the data at once ???
    than kyou in advance

    There you go
    http://java.sun.com/products/javacomm/
    Some extra resources
    http://www.google.co.in/search?q=java+access+serial+po
    rt&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.
    mozilla:en-US:officialmaybe I was not clear ,I know the comm lib
    Im already using it
    but am asking if there any other lib that will work for windows
    thank you

  • How can detect the serial port is active

    I made a program. It can read datas via serial port. But the datas wont came all the time, so the other part of the program not need to run. I want to put before the "reading serial port" a detection about the serial port is get a data. So the reading is wont start before datas are not coming. Can anybody help me how can i solve this problem?

    Hi Zoyo, if you use the VISA- VIs, the functionyou need is "VISA Bytes at serial port". It shows, how many Bytes are available in the input buffer. You can find it here:
    greets, Dave
    Message Edited by daveTW on 11-22-2006 02:01 PM
    Greets, Dave
    Attachments:
    Bytes at serial port.png ‏20 KB

  • [SOLVED] How to set non-root access to serial ports?

    I have this device which is listed as
    /dev/ttyUSB0
    I need to
    sudo chown sms /dev/ttyUSB0
    every time I reboot. Normally I would think to add myself to some group but "tty" group is not doing the trick... proof:
    [sms@sms-linux ~]$ groups sms
    tty wheel sms
    [sms@sms-linux ~]$ MinOZW
    Starting MinOZW with OpenZWave Version 1.0.758
    2014-03-15 06:32:07.921 Cannot find a path to the configuration files at ../../../config/, Using /usr/local/etc/openzwave/ instead...
    2014-03-15 06:32:07.928 mgr, Added driver for controller /dev/ttyUSB0
    2014-03-15 06:32:07.929 Opening controller /dev/ttyUSB0
    2014-03-15 06:32:07.931 Trying to open serial port /dev/ttyUSB0 (attempt 1)
    2014-03-15 06:32:07.933 ERROR: Cannot open serial port /dev/ttyUSB0. Error code 13
    2014-03-15 06:32:07.935 ERROR: Failed to open serial port /dev/ttyUSB0
    2014-03-15 06:32:07.936 WARNING: Failed to init the controller (attempt 0)
    ^C
    [sms@sms-linux ~]$ sudo MinOZW
    [sudo] password for root:
    Starting MinOZW with OpenZWave Version 1.0.758
    2014-03-15 06:32:23.776 Cannot find a path to the configuration files at ../../../config/, Using /usr/local/etc/openzwave/ instead...
    2014-03-15 06:32:23.782 mgr, Added driver for controller /dev/ttyUSB0
    2014-03-15 06:32:23.784 Opening controller /dev/ttyUSB0
    2014-03-15 06:32:23.786 Trying to open serial port /dev/ttyUSB0 (attempt 1)
    2014-03-15 06:32:23.794 Serial port /dev/ttyUSB0 opened (attempt 1)
    Edit: yes, it was after logout and even reboot.
    Last edited by smsware (2014-03-15 15:07:15)

    Hi,
    I also have a similar problem. I added myself to uucp group, but I still cannot access the serial port.
    [manjaro@mycomp work]$ sudo gpasswd -a manjaro uucp
    [sudo] password for manjaro:
    Adding user manjaro to group uucp
    [manjaro@mycomp work]$ groups manjaro
    lp wheel uucp network video audio storage users
    [manjaro@mycomp work]$ ls -l /dev/ttyUSB0
    crw-rw---- 1 root uucp 188, 0 23.06.2014 21:32 /dev/ttyUSB0
    [manjaro@mycomp work]$ lpc21isp firmware.hex /dev/ttyUSB0 19200 11059
    lpc21isp version 1.97
    File firmware.hex:
    loaded...
    Start Address = 0x00004F9C
    converted to binary format...
    image size : 30304
    Image size : 30304
    Can't open COM-Port /dev/ttyUSB0 ! (Error: 13d (0xD))
    But when I try as root, it works:
    [manjaro@mycomp work]$ sudo lpc21isp firmware.hex /dev/ttyUSB0 19200 11059
    [sudo] password for manjaro:
    lpc21isp version 1.97
    File firmware.hex:
    loaded...
    Start Address = 0x00004F9C
    converted to binary format...
    image size : 30304
    Image size : 30304
    Synchronizing (ESC to abort)..... OK
    Read bootcode version: 13
    Download Finished... taking 27 seconds
    Now launching the brand new code
    Do you have any idea what I am doing wrong?
    Last edited by manjaro (2014-06-23 19:57:40)

  • How can I use the output value from SIMPLE PID to write something to the serial port?

    I am working on my Senior Design Project that requires the use of incoming compressed air, propotional valves, continuous servo motors, and a serial servo motor microcontroller.  I have figured out how to send byte sequences to the microcontroller through LabVIEW using the VISA serial write function.  The motors are attached to the valves to control the flow rate.  I have created my own simple feedback system using a bunch of case structures but I realized that I am basically trying to recreate the wheel (I basically was writing my own PID VI).   I have an older version of LabVIEW (7.0 Express) and theres no way to upgrade or buy the PID toolkit, so I am stuck using the Simple PID VI.  Also, the only way the motor works is sending an array of bytes to tell it to turn on/off, direction, and speed.  Is there any way I can use the Simple PID VI in conjunction with the VISA SERIAL write function, or is there any other way I can communicate with the serial port using this pid vi?  Any information would be appreciated.

    Hi gpatel,
    you know how to communicate to serial port, but you don't know how to send a value from SimplePID to serial port???
    You know how to communicate, but then you don't know how to communicate???
    You should explain this in more detail...
    Edit:
    From you first post you know what values your motor driver is expecting. You know which values the PID.vi is providing. Now all you need is a formula to reshape the values from PID to the motor. It's up to you to make such a formula. Unless you provide any details we cannot give more precise answers...
    Message Edited by GerdW on 02-28-2010 08:35 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • I want to transfer data through the serial port in the same coding that hyperterminal uses. How can i do it?

    The serial port seems to be working, and labview seems to be sending the data, but the problem is in which format does it send the data, because in hyperterminal i just input the string "JDX" and it sends it to my device, with labview it sends something but my device does not recognize it.

    nobuto wrote:
    > I want to transfer data through the serial port in the same coding
    > that hyperterminal uses. How can i do it?
    >
    > The serial port seems to be working, and labview seems to be sending
    > the data, but the problem is in which format does it send the data,
    > because in hyperterminal i just input the string "JDX" and it sends it
    > to my device, with labview it sends something but my device does not
    > recognize it.
    Hyperterminal adds the carriage return/line feed to the string which is
    generated by the return key to send out the current line. LabVIEW simply
    sends out what you tell it, so try to set the string to "Show \ Display"
    format and add a \r or \n or \r\n to the command you want to send out.
    Assumes of course that you set the right baudr
    ate/bits/parity etc in
    LabVIEW with the VISA property node, when opening the serial port.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

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

  • How can an image be displayed by using raw data read from the serial port?

    Hi there,
    I am using an embedded camera to take photos. To operate it i send commands to it via the serial interface. I have received all of the image data back through the serial port and can view it as hex data in a string. The image data is 16bit colour RAW data at 160x120 resolution meaning i have 38400 bytes of data (160x120 = 19200. 19200*16 = 307200. 307200/8 = 38400). I want to be able to display this data as a picture, but cannot figure out how to do it. Can someone please point me in the right direction? i have been fiddling about with lots of the pixmap functions but no luck. Do i need to put this data in to a 2D array first?

    Yes, first convert it into a 2D array of pixel values. From there you can convert it into an image to display it in a picture control.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Iphone disabled, i cannot access the serial number to get support , how do i unlock with  no service provider?

    iphone disabled, i cannot access the serial number to get support , how do i unlock with  no service provider?
    i just got my iphone i set it up with icloud but didnt sync with itunes yet, i dont have a service provider yet either but i have been locked out for foregetting my passcode which i now remember ...... also i have tried calling apple support but get a busy signal after going through prompts.........PLEASE HELP

    http://support.apple.com/kb/ht1212

  • How can I control a HP 33120A waveform generator with the serial port of my PC?

    Hello,
    I want to control a HP 33120A waveform generator with my PC using the serial port. I don't have any idea about how to do it. If you've done it or if you know how I can do it, please give me some indications.
    Thanks
    Jean-Baptiste Paillet
    PS: I don`t have G PIB port

    The answer to your cross-post in the LabVIEW General group seems to be right on the money:
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=50650000000800000032200000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0
    Regards,
    John Lum
    National Instruments

  • How to detect if my external device is connected to the Serial port

    Hi,
    If I remove the cable from the serial port in my pc or either remove the serial cable from my external device, then when I send a request to open the serial port from my program, it basically does nothing, it just sits there.
    I want to be able to show some sort of message or any other way of indicating to the user that they should check the cable.
    below is the bit of code to open and set serial port params:
         public void openPort() {
              // Initialise the drivers
              System.setSecurityManager(null);
              String driverName = "com.sun.comm.Win32Driver";
              try {
                   CommDriver commdriver = (CommDriver) Class.forName(driverName)
                             .newInstance();
                   commdriver.initialize();
              } catch (Exception e2) {
                   e2.printStackTrace();
              // port will be set in Store Operations.
              String wantedPortName = Configuration
                        .getParameter(ConfigSetting.EFT_COM_PORT);
              //System.out.println("wantedPortname : " + wantedPortName);
              Enumeration portIdentifiers = CommPortIdentifier.getPortIdentifiers();
              CommPortIdentifier portId = null; // will be set if port found
              while (portIdentifiers.hasMoreElements()) {
                   System.out.println("counter");
                   CommPortIdentifier pid = (CommPortIdentifier) portIdentifiers
                             .nextElement();
                   System.out.println(pid.getName());
                   if (pid.getPortType() == CommPortIdentifier.PORT_SERIAL
                             && pid.getName().equals(wantedPortName)) {
                        portId = pid;
                        System.out.println("found a macth");
                        break;
              } // end of while
              if (portId == null) {
                   System.err.println("Could not find serial port " + wantedPortName);
                   //System.exit(1);
              try {
                   port = (SerialPort) portId.open("EFTDriver", // Name of the
                                                                               // application
                                                                               // asking for the
                                                                               // port
                             10000 // Wait max. 10 sec. to acquire port
              } catch (PortInUseException e) {
                   e.printStackTrace();
                   System.err.println("Port already in use: " + e);
                   //System.exit(1);
              // Now we are granted exclusive access to the particular serial
              // port. We can configure it and obtain input and output streams.
              try {
                        port.setSerialPortParams(9600, SerialPort.DATABITS_8,
                             SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
              } catch (UnsupportedCommOperationException usc) {
                   System.err.println("Unsupported operation" + usc);
              }Please advise what method can I use for this purpose.
    Thanks
    Abhi

    You mean it hangs in the open() method despite the timeout?

  • How to get a signal from the serial port to start a labview program?

    I need to synchronize the data obtained from a program (which is not in Labview)with the data collected with Labview on a different computer. I can send some data strings to the serial port of the computer running the Labview program when the other program starts. However, I need to be able to read the trigger in my Labview program. Do you know what I should do? Thanks.

    If you don't have any other programs listening on the COM port, you need to let a LV program run BEFORE the signal comes, otherwise you won't be able to read it. You can have the program wait in a slow timed loop so that it doesn't use up too much CPU time, and when the required "trigger" comes, to move into the main part of the program.
    You basically need a while loop waiting for a certain string in the serial buffer. Once the string is found the while loop is exited, and the data acqquisition or whatever else you require from the progam can be performed.
    In the example attached the program wait for ANY text to be sent to the COM port. Please note that you need to configure the VISA resource before using it. Once there is something at the COM port, the loop will exit and the rest of the program will be executed.
    Hope this helps
    Shane
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
    Attachments:
    Wait for serisl message.vi ‏17 KB

  • How to unbundling binary structure coming through the serial port

    Hi to all
    I have a board that is transmitting a binary stream. This stream is a structure repeated constantly ... the payload of this structure looks like this
    I have no problem reading the serial port and disaplying ASCII data but this is not my application.
    ANALOG_COUNT is (2)
    typedef struct
    uint16_t light;
    float TempAmbient;
    float TempTarget;
    uint16_t ADC[ANALOG_COUNT];
    int16_t AccX;
    int16_t AccY;
    int16_t AccZ;
    }StreamContext_t
    The idea is for me to, once I get the 20 bytes that comprise the strcture I want to brake it into its elements to feed it to graphs or what ever.
    Thanks
    Alejandro
    Solved!
    Go to Solution.

    You are still making life to difficult.  Try this.  It is much simpler to understand and it will work correctly.  Ok, there may be some debugging.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Start.vi ‏18 KB

  • How to retrieve data from the serial port and decode it each 2 bytes is a long variable and 1 frame is about 6 bytes

    I send the frame by a microcontroller ( 8bits) the fram contains 6 bytes, 2bytes conform a long variable, I want to decode the frame and make operations with these long variables and then plot them

    Hey jpvans,
    I would first suggest using NI-VISA to talk to the serial port. Then, you can use the LabVIEW Type Cast or the Flatten to String and UnFlatten From String VIs to convert the data.
    You can setup the read so that it reads just two characters at a time to form an individual long or you can set the read up to read it all and then use the string functions like String Subset to cut the information into chunks.
    I hope this helps out.
    JoshuaP

Maybe you are looking for

  • Memory Leak in Crystal Report XI

    We are using Crystal Reports XI Licensed Developer version for web based application. The generated reports are getting accessed by multiple users from web interface. After continuos access of reports, at some point it reaches the maximum limit of Ap

  • New EN symbol - BB Curve 8900

    Recently an EN sybol has appeared in the top right hand corner of my BB in my BBM/SMS/MMS/emails etc. It wasnt there before but has all of a sudden appeared. I think it happened when i accidently clicked the switch input language shortcut keys (alt +

  • Tracking mouse over 3d member

    please, i `m trying show information beside to mouse pointer in a effect of roll over, bad a haved a promblem with overlaping of sprites, the text sprite aways appear back to 3d sprite, and i need that the text apear over the 3d members trackin the m

  • "Plug-ins not currently available" keeps popping up.  Cannot edit old or new files.

    I just downloaded Illustrator CC a few days ago off of the creative cloud for my Mac OS X.  I was able to work on projects and everything just fine.  Today I tried opening the projects I had been working on, but what came up on all the files when I t

  • Bad Performance - 4.12E Firmware on 33x0 arrays

    Any thoughts?! We just bought two StorEdge 3320, dual controller, 512MB cache each, to replace some 3rd party Ultra160 arrays. These things write 3x slower then the arrays we are trying to replace. Is this possible? So far from Sun Solutions, thier r