Listen to serial port open by another applicatio​n
I have a test setup where another application is communicating with a device over a serial port and I want my Labview gui to be able to listen to the communication. Since two applications cannot have the same serial port open I can't just open the port and do a visa read. Is there any way to do an unreserved open and only listen to communication on the serial port or do I physically have to break out the receive line in hardware and add a second serial port in order to do this?
A better solution would be to have your reader post a message to a queue with the data. You can have a separate task that handles the UI updates. Depending on the type and amount of data you may not need to post all of the data.
The answer to your specific question though is no, you cannot have two readers on the same connection.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Similar Messages
-
Permission denied on Serial port open
Hi all!
I'm trying to open a serial port in a Linux machine and I get a RuntimeException in the open() method of CommPortIdentifier:
Error opening "/dev/ttyS0"
Permission deniedHow can i run the program as root or with root permissions?
I'm running it from Eclipse.
Thanks!I am trying to set this to the Mac (Admin) owner. The folder that is being shared over the network via samba was created on Mac OS
-
Java bean to get information from serial port
we are migrating from 6i to 10g. In 6i, we used mscomm32.ocx to access to com port. Now in 10g we need a java bean. Anybody has a java bean to access to serial port or anything similar?
My email is [email protected]
Thanks in advance.we set properties to the serial port, open the port, read (listen) from port, ... Here there are some pieces of code to you see it:
-- Si está abierto el puerto puedo leer
IF (MsCommLib_ImsComm.PortOpen(:ITEM('IF_OCX_COM').INTERFACE)=-1) THEN
-- Miro si hay caracteres
a:=MsCommLib_ImsComm.InBufferCount(:ITEM('IF_OCX_COM').INTERFACE);
IF a>0 THEN
set_item_property('COMUNICACION_ICS.ESPERA',DISPLAYED,PROPERTY_FALSE);
--Datos de un bloque nuevo, hay que insertar la fecha
IF :global.estado = 0 THEN
--Leo la fecha en la que se ha leído los datos
--SELECT SYSDATE INTO fecha
--FROM DUAL;
fecha := To_Date(:System.Current_Datetime,'dd-mon-yyyy hh24:mi:ss');
-- Borro la pantalla si hay mas de 1920 caracteres
:global.tc := :global.tc + 21;
IF :global.tc > 1920 then
:comunicacion_ics.if_txt_com_rec :='';
:global.tc := 0;
end if;
--Introduzco la fecha en el control de texto, para su posterior proceso
:comunicacion_ics.if_txt_com_rec := :comunicacion_ics.if_txt_com_rec||CHR(10)
||'__' || To_Char(fecha,'DD-MM-YYYY,HH24:Mi:SS')||chr(10);
guarda := Fichero.Escribe(:global.fic,CHR(10)||'__' || To_Char(fecha,'DD-MM-YYYY,HH24:Mi:SS')
||chr(10));
if guarda < 0 then
raise e;
end if;
END IF;
-- Indico que se están recibiendo datos de este bloque
:global.estado := 2;
--Leo la cadena
linea_ics := Var_To_Char(MsCommLib_ImsComm.Input(:item('IF_OCX_COM').INTERFACE));
linea_ics := replace(linea_ics,chr(13),CHR(10)); -- CHR(10)
--La añado al control de texto para que se vea
-- Borro la pantalla si hay mas de 1920 caracteres
:global.tc := :global.tc + a;
IF :global.tc > 1920 then
:comunicacion_ics.if_txt_com_rec :='';
:global.tc := 0;
end if;
:comunicacion_ics.if_txt_com_rec := :comunicacion_ics.if_txt_com_rec||
linea_ics;
--Escribo la linea en el fichero
-- Propiedades de Buffers
-- Tamaño del Buffer de Entrada
:prop_com.txt_in_buf := MsCommLib_ImsComm.InBufferSize(:ITEM('IF_OCX_COM').INTERFACE);
-- Tamaño del Buffer de Salida
:prop_com.txt_out_buf := MsCommLib_ImsComm.OutBufferSize(:ITEM('IF_OCX_COM').INTERFACE);
-- Tamaño de la cadena de Entrada
:prop_com.txt_input_len := MsCommLib_ImsComm.InputLen(:ITEM('IF_OCX_COM').INTERFACE);
-- RThreshold
:prop_com.txt_rthres := MsCommLib_ImsComm.RThreshold(:ITEM('IF_OCX_COM').INTERFACE);
-- SThreshold
:prop_com.txt_sthres := MsCommLib_ImsComm.SThreshold(:ITEM('IF_OCX_COM').INTERFACE);
-- EOF Enable
:prop_com.chk_eof_enable := MsCommLib_ImsComm.EOFEnable(:ITEM('IF_OCX_COM').INTERFACE);
-- Propiedades Hardware
-- Parity replace
:prop_com.txt_par_repl := MsCommLib_ImsComm.ParityReplace(:ITEM('IF_OCX_COM').INTERFACE);
-- NULL Discard
:prop_com.chk_null_discard := MsCommLib_ImsComm.NULLDiscard(:ITEM('IF_OCX_COM').INTERFACE);
-- RTS Enable
:prop_com.chk_rts := MsCommLib_ImsComm.RTSEnable(:ITEM('IF_OCX_COM').INTERFACE);
-- NULL DTR
:prop_com.chk_dtr := MsCommLib_ImsComm.DTREnable(:ITEM('IF_OCX_COM').INTERFACE);
Thanks. Inma -
Control Camera Attibutes through serial port using VISA commands
Hi there,
I'm using a Basler acA2000-340kc camera through an PCIe-1473R FPGA as frame grabber.
I would like to be able to configure the camera through the serial port just in LabView, not using a third-party as Pylon (which I can do now).
According to this forum post
http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/My-Basler-acA2040-180km-NIR-is-not-visible-in...
this is possible just taking the VI posted here
https://decibel.ni.com/content/docs/DOC-5049
and converting from IMAQ to VISA, as RIO frame grabbers cannot use IMAQ. I have been trying to do this by changing the IMAQ vi to their VISA equivalents, but I have no good results.
Does anyone know which are the steps to go from that piece of code to one that can be used to control the camera in my case?
Thanks a lot,Hi i.popa,
Basler makes the Basler Binary Protocol Library for serial communication with their cameras. If you make sure you're running the serial server section of your FPGA code to keep the serial port open, you should be able to use calls from this library to communicate with your camera. We have a community example with more information on using the Call Library Function Node to call a DLL. This DLL will take care of all the processes needed to write from and read to the registry, so this implementation will probably be similar to the example program you listed above, using calls to this library instead of the IMAQ Serial functions.
Good luck with your application!
Emily C
Applications Engineer
National Instruments -
Finder message: serial port in use by another application
After giving a print command, I had a power outage with my application open. The computer tells me I
cannot print my document because the serial port is in use by another application. I have opened and closed each application to no avail. The printer has nothing in the cache. I suspect the power outage
left me in limbo with the original command, but I don't know how to get out of it to print the document.
Just so you know, I am not a computer wiz kid. I don't understand how or why anything works. I can,
however follow instructions. Can anyone one help?Have you tried a Shut Down & Restart? This will close all applications.
Haven't booted into OS 9 for a long time, but try moving Appletalk to remote under Control Panels.
Cheers, Tom -
RxtxSerial library multiple serial ports listener
Hello All,
I am using rxtxSerial library (import gnu.io.*; compatible with previousely available from Sun import javax.comm.*;) for my bridge application. Th example provided in the library's web site with nulltest.java employs only one serial port. It is powerful since it is threaded and detects incomming/outgoing streams.
However, I would like to bridge between servers so multiple ports will be employed. Do you heave any suggestion how to obtain multiple port handling (reading/writing) within the same class. The null test code is presented as follows. Simplest idea is to use arrays, but more details are required.
// derived from SUN's examples in the javax.comm package
import java.io.*;
import java.util.*;
//import javax.comm.*; // for SUN's serial/parallel port libraries
import gnu.io.*; // for rxtxSerial library
public class nulltest implements Runnable, SerialPortEventListener {
static CommPortIdentifier portId;
static CommPortIdentifier saveportId;
static Enumeration portList;
InputStream inputStream;
SerialPort serialPort;
Thread readThread;
static String messageString = "AT";
static OutputStream outputStream;
static boolean outputBufferEmptyFlag = false;
public static void main(String[] args) {
boolean portFound = false;
String defaultPort;
// determine the name of the serial port on several operating systems
String osname = System.getProperty("os.name","").toLowerCase();
if ( osname.startsWith("windows") ) {
// windows
defaultPort = "COM5";
} else if (osname.startsWith("linux")) {
// linux
defaultPort = "/dev/ttyS0";
} else if ( osname.startsWith("mac") ) {
// mac
defaultPort = "????";
} else {
System.out.println("Sorry, your operating system is not supported");
return;
if (args.length > 0) {
defaultPort = args[0];
System.out.println("Set default port to "+defaultPort);
// parse ports and if the default port is found, initialized the reader
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals(defaultPort)) {
System.out.println("Found port: "+defaultPort);
portFound = true;
// init reader thread
nulltest reader = new nulltest();
if (!portFound) {
System.out.println("port " + defaultPort + " not found.");
public void initwritetoport() {
// initwritetoport() assumes that the port has already been opened and
// initialized by "public nulltest()"
try {
// get the outputstream
outputStream = serialPort.getOutputStream();
} catch (IOException e) {}
try {
// activate the OUTPUT_BUFFER_EMPTY notifier
serialPort.notifyOnOutputEmpty(true);
} catch (Exception e) {
System.out.println("Error setting event notification");
System.out.println(e.toString());
System.exit(-1);
public void writetoport() {
System.out.println("Writing \""+messageString+"\" to "+serialPort.getName());
try {
// write string to serial port
outputStream.write(messageString.getBytes());
} catch (IOException e) {}
public nulltest() {
// initalize serial port
try {
serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
} catch (PortInUseException e) {}
try {
inputStream = serialPort.getInputStream();
} catch (IOException e) {}
try {
serialPort.addEventListener(this);
} catch (TooManyListenersException e) {}
// activate the DATA_AVAILABLE notifier
serialPort.notifyOnDataAvailable(true);
try {
// set port parameters
serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {}
// start the read thread
readThread = new Thread(this);
readThread.start();
public void run() {
// first thing in the thread, we initialize the write operation
initwritetoport();
try {
while (true) {
// write string to port, the serialEvent will read it
writetoport();
Thread.sleep(1000);
} catch (InterruptedException e) {}
public void serialEvent(SerialPortEvent event) {
switch (event.getEventType()) {
case SerialPortEvent.BI:
case SerialPortEvent.OE:
case SerialPortEvent.FE:
case SerialPortEvent.PE:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.RI:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;
case SerialPortEvent.DATA_AVAILABLE:
// we get here if data has been received
byte[] readBuffer = new byte[20];
int numBytes = 0;
try {
// read data
while (inputStream.available() > 0) {
numBytes = inputStream.read(readBuffer);
// print data
String result = new String(readBuffer);
System.out.println("Bytes read: "+numBytes+", Read contents: "+result);
} catch (IOException e) {}
break;
}Kujtim
Edited by: Kujtim on Jul 12, 2009 1:41 PM
Edited by: Kujtim on Jul 12, 2009 1:43 PM
Edited by: Kujtim on Jul 13, 2009 1:57 PMAs an off the wall suggestion, check the usb "power save settings" under "control Panelower Options:Edit Plan Settings:Advanced Settings:USB settings" You want the USB selective suspend setting to be Disabled. Another possible idagnostic tool might be to do a Power Efficiency Diagnostics Report which we have found has occasionally pointed us to usb hanging issues.
Using the same type usb-serial adapters doesn't guarantee anything, but I have run into issues where a vendor's driver was implemented incorrectly. It ended up being a wrapper around the FTDI driver, and the wrapper dll wasn't correctly made multi-threaded safe. I browbeat the vendor (I was working at a LARGE corporation, with a prospective LARGE purchase of the devices) into telling me what calls their wrapper made. I then used the FTDI dll directly, not using the "simplified interface" of the vendor's dll. FTDI's dll was thread safe, no more random lockups/BSOD.
Good Luck, these are incredibly painful!
Putnam
Certified LabVIEW Developer
Senior Test Engineer
Currently using LV 6.1-LabVIEW 2012, RT8.5
LabVIEW Champion -
Open and configure serial port
Hi,
when i use the function configured serial port, i can work with it.
for which case i need the function open port. do i need both an in which order?
thanks florianHi florian
check the help examples
Attached png file shows the example.
chow
xseadog
Attachments:
serial.PNG 39 KB -
Java ME 8 Permission check failed when opening a serial port
I have a larger Jave ME8.1 application that was going well until I tried to add one last piece, reading and writing data from a serial port. This was left to last because it is trivial, at least in most programming languages. The is IDE NetBeans 8.0.2 running on a Windows 7 PC. The platform is a Raspberry Pi B or B+ (I have tried both) with the most current Raspbian (12/24/2014 I believe). To simplify the process I created a new app with just the open and close code and this generates the same error I am experiencing in the larger application. The program is as follows:
package javamecomapp;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.microedition.io.CommConnection;
import javax.microedition.io.Connector;
import javax.microedition.midlet.MIDlet;
* @author ****
public class JavaMEcomApp extends MIDlet {
static int BAUD_RATE = 38400;
static String SERIAL_DEVICE = "ttyAMA0";
static CommConnection commConnection = null;
static OutputStream os = null;
static InputStream is = null;
static String connectorString;
private int rtnValue = -1;
@Override
public void startApp() {
java.lang.System.out.println("Opening comm port.");
try {
rtnValue = JavaMEcomApp.openComm();
} catch (IOException ex) {
Logger.getLogger(JavaMEcomApp.class.getName()).log(Level.SEVERE, null, ex);
@Override
public void destroyApp(boolean unconditional) {
java.lang.System.out.println("Closing comm port.");
try {
rtnValue = JavaMEcomApp.closeComm();
} catch (IOException ex) {
Logger.getLogger(JavaMEcomApp.class.getName()).log(Level.SEVERE, null, ex);
private static int openComm()throws IOException {
java.lang.System.out.println("Opening comm port.");
connectorString = "comm:" + SERIAL_DEVICE + ";baudrate=" + BAUD_RATE;
commConnection = (CommConnection)Connector.open(connectorString);
is = commConnection.openInputStream();
os = commConnection.openOutputStream();
return 0;
private static int closeComm()throws IOException {
java.lang.System.out.println("Closing comm port.");
is.close();
os.close();
commConnection.close();
return 0;
If I comment out the JavaMEcomApp.openComm and closeComm lines it runs fine. When they are included, the following error is dumped to the Raspberry Pi terminal:
Opening comm port.
Opening comm port.
[CRITICAL] [SECURITY] iso=2:Permission check failed: javax.microedition.io.CommProtocolPermission "comm:ttyAMA0;baudrate=38400" ""
TRACE: <at java.security.AccessControlException: >, startApp threw an Exception
java.security.AccessControlException:
- com/oracle/meep/security/AccessControllerInternal.checkPermission(), bci=118
- java/security/AccessController.checkPermission(), bci=1
- com/sun/midp/io/j2me/comm/Protocol.checkForPermission(), bci=16
- com/sun/midp/io/j2me/comm/Protocol.openPrim(), bci=31
- javax/microedition/io/Connector.open(), bci=77
- javax/microedition/io/Connector.open(), bci=6
- javax/microedition/io/Connector.open(), bci=3
- javamecomapp/JavaMEcomApp.openComm(), bci=46
- javamecomapp/JavaMEcomApp.startApp(), bci=9
- javax/microedition/midlet/MIDletTunnelImpl.callStartApp(), bci=1
- com/sun/midp/midlet/MIDletPeer.startApp(), bci=5
- com/sun/midp/midlet/MIDletStateHandler.startSuite(), bci=246
- com/sun/midp/main/AbstractMIDletSuiteLoader.startSuite(), bci=38
- com/sun/midp/main/CldcMIDletSuiteLoader.startSuite(), bci=5
- com/sun/midp/main/AbstractMIDletSuiteLoader.runMIDletSuite(), bci=130
- com/sun/midp/main/AppIsolateMIDletSuiteLoader.main(), bci=26
java.security.AccessControlException:
- com/oracle/meep/security/AccessControllerInternal.checkPermission(), bci=118
- java/security/AccessController.checkPermission(), bci=1
- com/sun/midp/io/j2me/comm/Protocol.checkForPermission(), bci=16
- com/sun/midp/io/j2me/comm/Protocol.openPrim(), bci=31
- javax/microedition/io/Connector.open(), bci=77
- javax/microedition/io/Connector.open(), bci=6
- javax/microedition/io/Connector.open(), bci=3
- javamecomapp/JavaMEcomApp.openComm(), bci=46
- javamecomapp/JavaMEcomApp.startApp(), bci=9
- javax/microedition/midlet/MIDletTunnelImpl.callStartApp(), bci=1
- com/sun/midp/midlet/MIDletPeer.startApp(), bci=5
- com/sun/midp/midlet/MIDletStateHandler.startSuite(), bci=246
- com/sun/midp/main/AbstractMIDletSuiteLoader.startSuite(), bci=38
- com/sun/midp/main/CldcMIDletSuiteLoader.startSuite(), bci=5
- com/sun/midp/main/AbstractMIDletSuiteLoader.runMIDletSuite(), bci=130
- com/sun/midp/main/AppIsolateMIDletSuiteLoader.main(), bci=26
Closing comm port.
Closing comm port.
TRACE: <at java.lang.NullPointerException>, destroyApp threw an Exception
java.lang.NullPointerException
- javamecomapp/JavaMEcomApp.closeComm(), bci=11
- javamecomapp/JavaMEcomApp.destroyApp(), bci=9
- javax/microedition/midlet/MIDletTunnelImpl.callDestroyApp(), bci=2
- com/sun/midp/midlet/MIDletPeer.destroyApp(), bci=6
- com/sun/midp/midlet/MIDletStateHandler.startSuite(), bci=376
- com/sun/midp/main/AbstractMIDletSuiteLoader.startSuite(), bci=38
- com/sun/midp/main/CldcMIDletSuiteLoader.startSuite(), bci=5
- com/sun/midp/main/AbstractMIDletSuiteLoader.runMIDletSuite(), bci=130
- com/sun/midp/main/AppIsolateMIDletSuiteLoader.main(), bci=26
java.lang.NullPointerException
- javamecomapp/JavaMEcomApp.closeComm(), bci=11
- javamecomapp/JavaMEcomApp.destroyApp(), bci=9
- javax/microedition/midlet/MIDletTunnelImpl.callDestroyApp(), bci=2
- com/sun/midp/midlet/MIDletPeer.destroyApp(), bci=6
- com/sun/midp/midlet/MIDletStateHandler.startSuite(), bci=376
- com/sun/midp/main/AbstractMIDletSuiteLoader.startSuite(), bci=38
- com/sun/midp/main/CldcMIDletSuiteLoader.startSuite(), bci=5
- com/sun/midp/main/AbstractMIDletSuiteLoader.runMIDletSuite(), bci=130
com/sun/midp/main/AppIsolateMIDletSuiteLoader.main(), bci=26
I have tried this with three different serial ports, /dev/ttyAMA0 (yes I did disable the OS from using it), an arduino board /dev/ttyACM0, and a USB to RS485 adaptor /dev/ttyUSB0. All of these ports could be connected and use normally with both a C program and terminal program in the Pi. The API Permissions were set in the project properties / Application Descriptor / API Permissions to jdk.dio.DeviceMgmtPermission "/dev/ttyAMA0". This of course was changed as I tested different devices.
I found a reference suggesting adding the line "authentication.provider = com.oracle.meep.security.NullAuthenticationProvider" to the end of the jwc_properties.ini file. This had no effect. I found references that during development in eclipse and NetBeans, the app is already elevated to the top level so this should not be an issue until deployment. This does not appear to be the case.
I am out of time and need a solution quickly. Any suggestions are welcome.Terrence,
Thank you for responding and confirming the issues I'm having with static addressing. As far as the example above, I do have the standard LEDs working correctly, however, the example I'm referring to above is from the JavaME samples using the GPIO Port for the LEDS, according to the Device I/O Preconfigured List you referenced:
GPIO Ports
The following GPIO ports are preconfigured.
Devicel ID
Device Name
Mapped
Configuration
8
LEDS
PTB22
PTE26
PTB21
direction = 1 (Output only)
initValue = 0
GPIOPins:
controllerNumber = 1
pinNumber = 22
mode = 4 (Push-pull mode)
controllerNumber = 4
pinNumber = 26
mode = 4 (Push-pull mode)
controllerNumber = 1
pinNumber = 21
mode = 4 (Push-pull mode)
So is the assumption that using GPIOPort for accessing the GPIO port for Device ID 8 as listed in the Device I/O Preconfigured list not supported? -
Hi I am trying to write to an ADAM 4571 Ethernet to RS422 converter. Using the software provided by the vendor Ver. 1.49. I can setup the device properly, than configure it as a virtual com port. The problem is LabView sees the port but can not open it. Visa Open Fails every time. There is very little information about this problem.
Thanks,Hey Thanks for replying so fast. I know the error code would be helpful, but I don't have access to the equipment at this time. Let me tell you a little more history; Two different computers one is a laptop, has the runtime LabView 11 SP1, NIDAQ951f1_downloader and niser370 installed. This machine the software works as it should running an executable. The second computer has LabView 11 SP1 Developer installed. This is the development station, this machine is the one that I can not open the Virtual com port. Vender software is installed on both machines and configured the same. The executable source code will not run on the development computer. It fails when it tries to talk to the serial port. To trouble shoot this problem I opened a blank VI dropped Visa Open and Visa Close in it wired a control to Comport selection and indicator to error out, connected error terminals and com out to com in. The error said that it could see the com port but could not talk to it. This error was generated by the open routine.
-
Can't open Serial port in notebook (use Serial to USB)
OTL
use Serial to USB and java communication 2.0, windows 2003
and notebook which has no RS232C port
testing desktop it is done.
notebook does not work....
How can i open serial port in notebook ...Saludos
tengo el mismo problema, aunque he encontrado algunas
API pero solo tienen soporte para LINUX:
* jsr80 y
* jUSB API
Si tienen alguna solucion haganmela saber.In English via Babelfish (and a little common sense), in case anyone knows a solution:
Greetings, I have the same problem, although I have found some API but they only have support for LINUX:
* jsr80
and
* jUSB API
If they have some solution I'd like to know. -
I don't know what I've done.
When I try to open COM1 I get:
"Error -1073807202 occurred at Property Node in VISA Configure Serial Port (Instr).vi->Untitled 1
This error code is undefined. No one has provided a description for this code, or you might have wired a number that is not an error code to the error code input."
"VISA FInd Resources" reports 0 resources found.
any ideas?It should show up in Measurement and Automation Explorer (MAX) click the Software folder to expand it, then click on NI-VISA. It should show the versions installed in the right panel.
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~ -
Open serial port each time to communicat​e
Hello,
I am upgrading an old serial I/O communications system. With the old system, any communications were begun by re-opening the serial port and getting a new visa resource name. The old visa resource name was never closed, but new names were continually created. In the new communications I only open the port once and use the same visa resource name. The trouble is that the new system is incredibly slow, taking almost 3 seconds to complete a message. Note: prior to reading, I do query for number of bytes at the port and then read the corresponding amount. The old system is much, much faster. Why?
Many thanks,
SteveHello,
Here is a copy of both communications vis. The old one works much faster, I don't know why.
Thanks!
Steve
Attachments:
OLDSend&Recieve Data.vi 41 KB
NEWSend&Recieve Data.vi 40 KB -
Installing v240 via serial port of another v240
Hello!
We have two SunFire v240 running. Both were installed by connecting a Linux client via the "NET MGT" port.
Now I want to reinstall one of the mashines. My question: Is it possible to use the serial port of the other server to do this using tip?
Planned steps: Connecting a RJ-45 cable to the "NET MGT" port of the mashine which should be reinstalled. Then plugging that cable to the serial port of the other mashine using the shipped adapter. "tip hardwire" would use /dev/term/b
TIA
StephanYeah. This is the steps you would take:
1. Brew a can of coffee. (Or tea, if you prefer that.)
2. Power up your computer.
3. Sit down in front of your computer
4. Code.
5. Drink coffee (or tea.) Repeat 1 when the pot runs empty.
6. Code some more
7. Code even more.
But no, I can't tell you how the code should be. It's not something I know much about. And I wouldn't have done it anyway, you say you are a final year programming student, it's about time you start doing your own programming. -
How do I process serial port strings as bits
In response to my commands, my instrument is sending bytes to my serial
port. In one instance, 2 bytes are received. I want to treat these 2 bytes
as a group of 16 bits.
The VISA and Compatibility Serial functions return these bytes from the
serial port to Labview clearly labelled a "string".
Everything I can find in the way of Labview functions and .vis don't want to
do bit twiddling, bit swapping, and bit dropping, with "string" data.
I thought "hex string to number" could be used here, but I can't find a way.
The 2 Bytes in question can be represented as hex, but the data are not the
ASCII codes for the hex representation of a binary number, they are the
binary number. This "hex string to number" seems to want ASCII c
odes.
You can feed a hex number typed into a "control" box wired into "hex string
to number" and you get a meaningful number. You can feed the 2 bytes from
the serial port into an "indicator" set to read in hex and you get a hex
number that is a correct representation. But that is Labview handing them
around to itself. I need to get my "hands" on them.
I can't feed those same bytes that show up as a correct hex representation
in an indicator into the "hex string to number" or anything else, so far,
and get a number that is useful for further processing.
I thought "variant to data", but I can't find enough reference material to
understand how to use it. A boolean array seems like a bit of a weird
approach, so I thought I'd ask before I looked into that.
I'm used to dealing directly with binary numbers on the processor stack, I
call them whatever I want, and turn them into anything I feel like.
I'm sure I'm staring the solution in the face, but I can't find any way to
persuade
Labview to treat this "string" data as 16 bits.
I've got the 16 bits, which is better than not having them, but I don't have
much hair left.duh, well I finally discovered the "Unflatten from String" function. A guy
just feeds in the bytes he's collected from his serial port that Labview
thinks are a "string", and out come lovely little unsigned 16 bit numbers,
or whatever other type of number he wants to turn the bytes into. And there
are great little bit twiddlers available after that, like "swap bytes", and
you can mask out bits with the logic operators, why this is fun. There's
nothing like being a moron...... fly me to the moon...................
"David Lewis" wrote in message
news:[email protected]..
> The two bytes would come from a serial port read.vi in Labview, classed as
a
> string. For instance, D3 and 02. The output wou
ld swap the two bytes,
i.e.
> to 02 and D3, consider the two swapped bytes as 16 bits, drop the six most
> significant bits, and output the ten bits that are left as an integer
> classed by Labview as some kind of number, not a string.
>
> Your example StringToBits_Converter.vi I found on the ni.com site
> unfortunately gives an error message and refuses to open on my system
saying
> it comes from a newer version of Labview 6 than I am running. Mine says
> 6.0.1b3. Thank you very much anyway.
>
> "FightOnSCTrojan" wrote in message
> news:[email protected]..
> > In another words, you want to create a VI in which the input is 2
> > strings (i.e. AB) and the output is the converted array bits (e.g.
> > 1010101010101010)?
>
> -
Write to serial port asyncronously
I am trying to write a commands to a serial port but my problem is that the operation is tedious so it is freezing up my UI. What makes it more complicated is that I must call this procedure when the form loads I want to ask if anyone can provide an alternative
way to get the same or better result I was thinking of running it asynchronously but I don't know how to?
This is the code I am calling on load
If lblConnected.Text = "" Then
MsgBox("Please connect to port.", MsgBoxStyle.OkOnly, "Validation")
Exit Sub
End If
RichTextBox1.Text = ""
Try
With SerialPort1
rcvdata = ""
.Write("AT" & vbCrLf)
Threading.Thread.Sleep(1)
.Write("AT+CMGF=1" & vbCrLf)
Threading.Thread.Sleep(1)
.Write("AT+CPMS=""SM""" & vbCrLf)
Threading.Thread.Sleep(1)
.Write("AT+CMGL=""ALL""" & vbCrLf)
Threading.Thread.Sleep(1)
.Write("AT+CNUM" & vbCrLf)
Threading.Thread.Sleep(2000)
Dim lineoftext As String
Dim arytextfile() As String
Dim myString As String
lineoftext = rcvdata.ToString
arytextfile = Split(lineoftext, "Your number is", CompareMethod.Text)
myString = "Your number is"
lineoftext = lineoftext.Substring(lineoftext.IndexOf("Your number is"), 40)
lineoftext = lineoftext.Replace("Your number is", "")
lineoftext = lineoftext.Substring(0, 13)
txtDonglePhoneNumber.Text = LTrim(lineoftext)
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
I am trying to extract the phone number from this whole routine and it works but its freezing up my UI. How can I run from another thread.
If you think it you can achieve itImports System.IO.Ports
Imports System.Threading
Public Class Form1
Private comport As SerialPort
Private sending As Boolean
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
sending = False
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
comport = CreateComport(comport)
If sending = False AndAlso OpenComport(comport) = True Then
Dim t As Threading.Thread = New Threading.Thread(AddressOf SendData)
t.IsBackground = True
t.Start(comport)
End If
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
CloseComport(comport)
End Sub
Private Function CreateComport(ByVal port As SerialPort) As SerialPort
If port Is Nothing Then
port = New SerialPort("COM4", 9600, Parity.None, 8, StopBits.One)
End If
Return port
End Function
Private Function OpenComport(ByVal port As SerialPort) As Boolean
Try
If (Not port Is Nothing) AndAlso (port.IsOpen = False) Then
port.Open()
End If
Return True
Catch ex As Exception
MessageBox.Show(String.Format("Exception :{0}", ex.ToString()))
Return False
End Try
End Function
Private Sub CloseComport(ByVal port As SerialPort)
Try
If (sending = False) AndAlso (Not port Is Nothing) AndAlso (port.IsOpen) Then
port.Close()
MessageBox.Show("Port closed")
End If
Catch ex As Exception
MessageBox.Show(String.Format("Exception :{0}", ex.ToString()))
End Try
End Sub
Private Sub SendData(ByVal port As Object)
Dim buffer(1023) As Byte
For i As Int32 = 0 To buffer.Length - 1
buffer(i) = i Mod 256
Next
sending = True
Try
DirectCast(port, SerialPort).Write(buffer, 0, buffer.Length)
Catch ex As Exception
CloseComport(DirectCast(port, SerialPort))
MessageBox.Show(String.Format("Exception :{0}", ex.ToString()))
Finally
sending = False
End Try
End Sub
End Class
在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。
Maybe you are looking for
-
Here is the breakdown. I just bought my wife a new iPhone 4s and I'm trying to decide how to set it up for her. Should she have her own Apple ID or use mine? If she uses my Apple ID, will that cause issues with iMessage - say when I'm chatting wit
-
How do I restore the contacts on my Iphone?
I cleaned up my contacts on my MacBook Pro (deleted duplicates, deleted old numbers, etc) and then synced to my Iphone. Now my Iphone contact has no contacts. How Do i sync the newly edited address book on my MacBook to my Iphone?
-
Hard Drive Issues (Both new and old)
I'm trapped in a HDD nightmare with my MacBook Pro mid-2012. I updated to Yosemite 10.10.3 (with the Photos app). A couple of days after the update, I was watching a movie on my TV screen via HDMI. In the middle of the movie I removed the HDMI cable
-
Customer Service/Service Management Issues
Could anyone suggest me that where can I create the Customer Service/Service Management Discussions? I hope it will be in Enterprise Asset Management, if not please guide me. Anandkumar KS
-
Somtimes, Preview 5.0.3 will hide my text annotations, forcing me to find them 1 by 1 and double click on them to show their text. After clicking on the Pen icon on the sidebar, i can see what slide numbers they are on, and have to go through 1 by 1