Sending binary data over RS232 without conversion to ascii

I need to send binary data to a PIC without the data being converted to ascii. With the VISA vi's, when I want to send 11111111, it gets converted to a string "255", and is sent as "2","5","5" in ascii.
How can I send it as one byte?

r_keller wrote:
@tbob: I probably shouldnt tell my customer that he's an idiot, and obviously 9 bit addressing/signalling modes seem to be not so uncommon in industry, so ur post does not really contribute to solve the problem.
Well I wouldn't call my customer an idiot either.  I didn't know he was your customer.  Sorry.  Not every comment posted here is intended to directly solve a problem.  We are a fun loving group, and occasional ribbings take place here.  I still think that trying to use 9 bits over an 8-bit protocol is not a good way to go.  But if it is the only way, then so be it.
r_keller wrote:
 Does the Mark or Space parity bit add another 10th bit to the command or can i only use either ODD parity/Mark/Space?
According to the link you attached, the parity bit adds only one more bit.  If the number of bits is set to 8, then the parity is the 9th bit, and you can only use Mark or Space to force that 9th bit to either 1 or 0 respectively.  If you try to use odd or even parity, the protocol will determine the parity and change the bit accordingly, and it may not be the one you intended to send.  The start and stop bits are fixed by the protocol and cannot be used for extra data bits.
Actually, until I read that article about using Mark and Space, I had no idea at all that sending 9 bits at a time was possible.
- tbob
Inventor of the WORM Global

Similar Messages

  • How to send binary data in the message body

    How can we send binary data in the message body that is base64 encoded? below are the requirements
    Mime Header.
    Mime-version: 1.0
    Content-Type: application/octet_stream; name=test
    Content-Transfer-Encoding: Base64
    Submission must be named "test.sub" (lowercase)
    Submission must be base64 mime-encoded
    Submission must be sent in the body of the message (not as an attachment)
    Only one submission per mail message
    No other comments should be put in the body of the mail message (other than the submission)
    I highly appreciate your help. If you can provide few examples, that will be very helpfull.
    Thanks,
    Madan

    Use Message.setContent to set the content, or use Message.setDataHandler with
    a DataHandler constructed with a ByteArrayDataSource. If the content is not
    "naturally" encoded in base64, you can enforce it by setting the Content-Transfer-Encoding
    header to "base64". Any reasonable mail reader won't care what encoding you use, as
    long as the decoded data is correct.

  • Sending Binary data using ASCII

    Hello All,
    I'm trying to control serial-interface instrument using NI-VISA with a set of ASCII codes, but the instrument reads/sends binary data only. What should I do so that the ASCII codes I send are converted into binary commands for the instrument to read, and that the data I receive is converted back into ASCII?
    Thanks in advance
    M

    Hi M,
    first you should define the words "binary commands/data". Then you should know: ASCII is binary too...
    You may work with an U8 array. You can easily convert strings to U8 arrays and vice-versa!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Sending Binary Data using HTP package

    Has anyone been successful in using the HTP package and its PUTRAW procedure to send binary data to a browser?
    Example code shows basic idea:
    create or replace
    procedure test_raw as
    output VARCHAR2(20);
    begin
    OWA_UTIL.MIME_HEADER('application/x-gzip', TRUE);
    output := 'Hello World!';
    HTP.PUTRAW(UTL_RAW.CAST_TO_RAW(output));
    HTP.FLUSH;
    end test_raw;
    I receive an empty file when called from the browser.
    What gives?

    I found my answer. I should be using wpg_docload.download_file(BLOB) to "download" a the contents of a BLOB.

  • Sending binary data from JSP (1.1)

    Hi all:
    I am using Tomcat 3.2.1 and Apache under Linux Mandrake OS.
    I have a JSP (1.1) sending binary data (GIF, PDF, DOC ..) using response.getOutputStream().write(data)
    method.
    The problem is the precompiler automatically creates the JspWriter and puts some out.write("\r\n") lines
    before I use getOutputStream method. The JVM throws an IllegalStateException because I am using both
    methods (this is from Servlet 2.2 specification).
    Must I change my code to forwarding to a servlet that make this work or is there a simple solution to
    avoid this?
    Thanks in advance.
    J.
    null

    Hi Shreeharsha
    Please refer to below docs for sending data from JSP page to RFC. In which you need to use sap connectors for connecting to SAP backend system.
    http://help.sap.com/saphelp_nw04/helpdata/en/b6/55e3952a902447847066a0df27b0d6/content.htm
    Hope it helps
    Regards
    Arun

  • Best way to collect periodic data over RS232?

    I'm using Labview 6i to collect data from a device over RS232.  The device manual says that it delivers data digitally by sending 10 bytes every 100ms.  I'm using VISA Write to send an initialization string, and then I step in to a loop containing VISA Read set to read data synchronously, set to read 10 bytes of data.  I have tried a number of things to get this to work:
    Adding a wait to the loop and varying the wait time
    Increasing the bytes read from 10 to 15 and filtering out the specific 10-byte set I want to read
    Taking out the wait completely and letting the loop run untimed, limited by the VISA Read node
    The problem I encounter is that often the VISA Read node returns a set of data that is "shifted".  In hex, my 10-byte set should look like this:
    FFFE 0106 04 FF FF FF 45 D4
    Where the FFFE 0106 04 acts as a header.  Often the 10 byte set I retrieve contains some bytes from one set, and some bytes from the next set; so, the header might lie in the center or at the end of the 10-byte set rather than at the beginning (in which case there is some data lost at the leading and trailing ends)
    One thing I have tried is throwing out "bad" sets, but then I am losing data and not getting the full 10 data points per second that the device is capable of.
    When reading data like this, where a set of bytes is sent periodically, how can you ensure that every set is properly read?

    When working with a device that is essentially streaming data back to the computer you have to take on the responsibility of  parsing the response and breaking it up into individual messages. One good thing in your favor is that you have a well defined header that you can search for in the datastream. The nice thing about the shift register approach is that you can parse as many or as few packest as you want. Moreover at the leasurely rate the device is passing data LV should be able to more than keep up with the flow.
    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

  • Sending binary file via RS232 connection

    Hi,
    I want to send a binary file via RS232 connection but I have troubles reading the .bin file and then converting the data to string in order to send it via RS232. Any ideas how i can deal with this?
    Thanks in advance,
    IG. 

    It is hard to help then you do not post any code. I suggest you go to the toolbar then help. Then you select Find Examples. Search for files. Also since you are new to Labview always have context help enabled. Both tools are important if you want to learn Labview. Feel free to post again if you are stuck.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Sending audio data over http problem

    Hi Guys,
    We are trying to create a little servlet in Tomcat, which is capable to send audio files over http to an embedded media player. The definition of the player looks like:
    <OBJECT ID="Mp" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" TYPE="application/x-oleobject" WIDTH="0" HEIGHT="0">
    <PARAM name="uiMode" value="none">
    <PARAM NAME="ShowControls" VALUE="0">
    <PARAM NAME="AutoStart" VALUE="1">
    <PARAM NAME="ShowPositionControls" VALUE="0">
    <PARAM NAME="ShowStatusBar" VALUE="0">
    <PARAM NAME="ShowDisplay" VALUE="0">
    </OBJECT>
    <script language="javascript">document.Mp.URL = "here comes the url of the servlet with item ID";</script>
    The servlet reads the audio file and writes its content to the response with the following http header settings:
    getResponse().setContentType("audio/x-wav");
    getResponse().setHeader("Content-Transfer-Encoding", "binary");
    getResponse().setHeader("Pragma", "Public");
    getResponse().setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
    getResponse().setHeader("Content-Disposition", "inline; filename=Media.wav");
    getResponse().setHeader("Content-Length", new Integer(MediaBytes.length).toString());
    getResponse().setHeader("Accept-Ranges", "bytes");
    So, everything works fine for wav files in Internet Explorer, but we are facing problems with Firefox, where it does not work. The embedded Media Player says that "Windows Media Player cannot play the file. One or more codecs required to play the file could not be found."
    But if we set the url to directly to the file on the server, everything works fine.
    We have analyzed the HTTP traffic in both situation, but we cannot understand how Internet Explorer/Firefox and Media Player works together:
    - how does Media Player know that the audio file is playable?
    - if the url points directly to the file, the HTTP headers does not contain any kind of information about the file type, only the extension is available; Media Player checks the file extenion in the url?
    - if the url points to the servlet, why Media Player in Firefox cannot determine the file type and throws error?
    Any help is greately appreciated!
    Thanks!
    Gabor

    If you haven't already, I would try breaking down the problem. First confirm you're getting serial data then confirm that netcat can send some data. Like this:
    xxd < /dev/tty.usbmodemfa121 | less
    nc -u 10.0.1.3 7000 <<< 'hello over there'

  • Java proxy to send binary data

    Hi guys,
    I needed a small clarification.
    I'm using java proxy sender and file receiver in a scenario. I want to pick up binary files (i.e. the file could be of any format text,zip,pdf, image etc) using jakarta commons api to connect to ftp and then call the proxy to send this file data via proxy.
    I'm not clear on how this requirement can be achieved or it can be achieved or not.

    Hi Stefan,
    I'm referring to the comments given by Michal in the below blog.
    [How to send any data (even binary) through XI, without using the Integration Repository|How to send any data (even binary) through XI, without using the Integration Repository]

  • How to send joystick data over TCP connection

    Hi all,
    I am a long time Labview discussion forum user for learning, but this is my first time posting a question, I hope somebody can help me!
    In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
    Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
    Again, the actual TCP communication I get, and can operate fine, just formatting all the data into a string (or whatever is required) so that I can unpack on the other side is the issue here.
    Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense...
    One final question.....I already have a solution to this but using labview for the entirety of this project would be nice. I use skype to stream 1080p video from a webcam to my computer so I can view live feed. Can labview do this? This would be awesome if so, I am just not sure if the communication protocols in use could support real time (or as close as possible to streaming) for 1080p video.
    Thanks all in advance for your help,
    Physicsnole
    Attachments:
    cameraserver.vi ‏24 KB
    cameraclient.vi ‏18 KB

    Physicsnole wrote:
    In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
    Well, you cast the axis info cluster to a string, but then you cast it back to an array of DBL. Thatr's not compatible. You should probably cast it back to an "axis info" cluster of exactly the same type. Go the the other VI and right-click the cluster wire to create a constant. Now move that diagram cluster constant to the other VI and use it as type.
    Your default ports don't seem to match. You seem to have client and server roles confused. In the sever you create a listener, but then you start sending packets, even though no connection is established. The connection needs to be initiated by the client.
    Your client stops the loop the first time a timeout is encountered. Shouldn't that be more permanent? Also, please retain code clarity and avoid unecessary complexities. For example, replace the "not or" with a plain "or" and change the loop to "stop if true"
    Physicsnole wrote:
    Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
    You can send as much as you want. The casting to/from string is the same as described above.
    Physicsnole wrote:
    Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense..
    The primary function of a "server" is to wait for a connection and then communicate with the client once a conenction is established. An established TCP/IP connection is fully two-way and both sides can send and receive.
    LabVIEW Champion . Do more with less code and in less time .

  • I'm using a 1D Arrary with 27 different elements and would like to send those data over UDP Write and UDP Read functions.

    I'm using a 1D array with 27 different elements. I would like to transfer that data over a UDP connection, and read it back by using UDP connections.
    But I would like to read 3 elements at a time (On read side) and send those to 9 different ports.
    Note: the data will go to only one PC with one Network Address)
    * 1st elements (0,1,2) and send to port #XXX to see those 1st 3 elements.
    * continue until the elements reaches up to 27
    This is what I have done but I'm finding myself in pitfalls...
    Send side:
    I'm using a UDP Open connection on send side to send my data. So with selected a Source Port, I have created a UDP Op
    en connection. I�m using only one source port to send all the data across the channel. I would like to read 1st 3 elements and send those data across with an assigned Destination port. I would like to do that for 9 times b/c there are 27 elements in the array. So I�m using a For Loop and setting N count to 9. So I�m not getting any errors when I execute and no answer on the other side at all.
    Read side:
    I�m using a UDP Open connection to read in the data with port #. I�m using while loop to with Boolean inside by making a true all the time. Inside that While loop, I�m using For Loop to read the 3 elements data a time and send to a right port address. (As start out I was just trying to see if it works for only one port).
    Attachments:
    UDP_SEND_1.vi ‏40 KB
    UDP_READ_1.vi ‏31 KB

    You are not getting any errors because UDP is a connectionless protocol. It does not care if anyone receives it. Your example will work fine with the following considerations.
    (1) Don't use the generic broadcast address (255.255.255.255).
    (2) You are listening on port 30000. So why are you sending to port 1502, nobody will receive anything there.
    The destination port of the outgoing connection must match the server port of the listener. (The source port is irrelevant, set ot to zero and the system will use a free ephemeral port).
    (3) On the receiving side, you are not indexing on the received string, thus you only retain the last received element. Then you place the indicator outside the while loop where it never gets updated. :-(
    (4) Do yourself a favor and don't micromanage how the data is sent across. Just take the entire array, flatten it to string, send it across, receive it, unflatten back to array, and get on with the task.
    (You can do the same with any kind of data).
    I have modified your VI with some reasonable default values (destination IP = 127.0.0.1 (localhost)), thus you can run both on the same PC for testing "as is". Just run the "read" first, then every time you run "send", new data will be received.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    UDP_READ_1MOD.vi ‏29 KB
    UDP_SEND_1MOD.vi ‏27 KB

  • Reg : Sending Binary data as output in GP

    Hello ,
    I developed one webdynpro Project it has interactive adobe form ,  in Guided procedures
    created CO for Webdynpro Componet(GP interface) for this form and created GP inerface also.
    But in this callable object the Requestor creates new pdf form.This PDF(means interactive form is taken as binary for pdfsource )  form has binary data.
    *How to send this binary data as output in GP. *
    Please help me out.
    Thanks
    Risha

    thanks

  • Sending binary data as attachment

    Is that possible to send binary ( which is actually fragment of a large file i.e. 100MB ) data as attachment to SOAP message ?
    The complete scenario is below.
    * I have to send a large file around 100MB, to server as a fragment as attachment of SOAP message.
    * It is received at the server and sent as such to another server ( I dont want the user to send data directly to this "another" server, call it as main server ).
    * main server will update the fragment into a stream which remains unclosed until last fragment received.
    * after receiving SOAP message ( which contains the fragment ), main server will repond 'OK' to sub server.
    * If the sub server receives OK, then it will send the next fragment until EOF.
    May be at main server I may need to check whether the file is properly received using some checksum logic.
    I hope I am making sense. I am thinking of using Axis2 ( I am totally newbie to web services). Could someone point me if I miss something ?

    thanks

  • Send audio data over UDP

    Hello again,
    Sorry for asking a lot of questions, but I'm developing an application in jmf and I don't know so much how it works...
    I'm trying to receive rtp data from the network, then uncompress to RAW format (but it has to be coded in some codec like g711, g729 or GSM) and save it into a buffer. For this I'm following the example DataSourceReader. I have attached some things like keep off the rtp header, and save the audio data into a bytebuffer (instead of using the printInfo() method I'm using saveIntoByteBuffer() method).
    Another class is sending the data (saved in byteBuffer) over the network (UDP, not RTP-UDP).
    And anotherone is receiving this data, and creating a DataSource to play the audio data received.
    To do this, I don't know exactly how to do it. I need to create a DataSource like the examples (LiveStream and DataSource from [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/LiveData.html |http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/LiveData.html] ) or can I do it like JpegImagesToMovie from [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/JpegImagesToMovie.html|http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/JpegImagesToMovie.html] ?
    Sorry if it's an easy question, but I don't understand so much why implementing the 'same' thing (custom DataSource) it's implemented different.
    Thanks

    Sorry if it's an easy question, but I don't understand so much why implementing the 'same' thing (custom DataSource) it's implemented different.They aren't the same thing, actually. DataSource is the parent class, but there are 2 different kinds of DataSources.
    A PushBufferDataSource will "push" the data out when it's available to be read. Whenever it decides it has data ready to be read, it informs whatever is reading from it that data is available.
    A PullBufferDataSource will not do that. Whenever it has data ready to be read, it doesn't do anything to inform what's reading from it.
    The next obvious question is, why does it matter?
    PullBufferDataSource's are good for situations where the data is always present. For instance, if you're playing a file from your hard drive, it's better to just let your Player object fetch data when it's needed. There's no need for a "data available" event, because, the data is always available...
    PushBufferDataSources are good for situations where data is being generated / received from an outside source. You can't read from it until the data comes in, so rather than blocking and waiting for the read, it'll tell your reader class when to come back for the data.
    Hope that helps!
    P.S. For your needs, you'll want to be using a PushBufferDataSource, so the Live example code.

  • Send & receive data over GPRS

    Hi All !!!
    I am developing a program to receive and send data over GPRS. A remote device is sending data at a particular port (6600) of my server. I am able to read that through ServerSocket. However I am not being able to send any data to that device.
    Any help?

    I am using the code:
    // Constructor
    public ServerSocketReader(Socket socket) {
    super("MultiSocketThread");
    this.clientSocket = socket;
    this.setDaemon(true);
    public void run() {
    try {
    OutputStream out = clientSocket.getOutputStream();
    InputStreamReader in = new InputStreamReader(clientSocket.getInputStream ());
    //BufferedWriter bw = new BufferedWriter(new FileWriter(_filepath, true));
    java.util.Date date = new java.util.Date();
    SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd-MMM-yy HH:mm:ss");
    GprsProtocol protocol = new GprsProtocol();
    int charCount = 0;
    char[] cBuffer = new char[1000];
    byte[] bBuffer;
    String fromClient = "", toClient = "START";
    int ii = 0;
    while ((ii = in.read()) != -1) {
    fromClient = fromClient + (char)ii;
    if (fromClient.endsWith("2Y")) { //according to protocol
    toClient = protocol.processInput(fromClient); //Protocol
    bBuffer = toClient.getBytes();
    for (int k=0; k<bBuffer.length; k++) {
    out.write ((char)bBuffer[k]);
    out.flush();
    fromClient = "";
    out.close ();
    in.close ();
    clientSocket.close ();
    //bw.close();
    } catch (IOException ioe) {
    //out.println("Error::" + e);
    System.out.println("Error in writing file : ");
    ioe.printStackTrace();
    } catch (Exception e) {
    System.out.println("Error in ServerSocketReader : ");
    e.printStackTrace();
    finally {
    //this.destroy();
    I am geeting the error at line :-
    while ((ii = in.read()) != -1) {
    the error is :-
    java.net.SocketException: A connection with a remote socket was reset by that socket.: A connection with a remote socket was rese
    by that socket.
    at java.net.SocketInputStream.socketRead(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:104)
    at java.net.SocketInputStream.read(SocketInputStream.java:82)
    at java.io.InputStreamReader.fill(InputStreamReader.java(Compiled Code))
    at java.io.InputStreamReader.read(InputStreamReader.java:256)
    at java.io.InputStreamReader.read(InputStreamReader.java:229)
    at ServerSocketReader.run(ServerSocketReader.java(Compiled Code))

Maybe you are looking for

  • Licence 10.5

    Hii, I upgrade my cluster ( 1Pub and 1Sub) from 8.6.2 to 10.5 and after I migrate the licence I have  problems with the licence type and honestly I am confuse. Before the update I had 16.360 DLU.                                        11.667 Units Us

  • How to add different bulleting shapes in thunderbird. Currently it is showing a dot.

    i need to add detail with different bulleting shapes in Thunderbird is there any addon which helps me give different shape for bulleting.

  • Safari Freezing & Quitting Soon After Opening

    Safari has not been working properly for me on my laptop ever since I started using my college's wireless connection. Everything has been working fine, but Safari doesn't work anywhere now. It may have something to do with the wireless connection, bu

  • Syntax errors?

    Here is my code: catch (Exception e) { System.err.println(e); PrintWriter out = new PrintWriter(new FileWriter("Tokens.log")); out.println(e); out.close(); Here is the error I'm getting: Tokens.java:42: unreported exception java.io.IOException; must

  • Importing Raw images into Krita

    I would like to try Krita for processing RAW images from my Nikon D60. Looked at the Krita manual (link below) and there should be an option to import Nikon NEF files but I dont see it in Krita. Do I need to install another package for this ? I alrea