Send Hex code via serial

I want to send the code 0x01 (Hex) on RS232 and read back 2048*2 Bytes..
Anybody has an idea for make the program to send Hex code.
Thank you very much for anybody help.

The serial port doesn't know about U16 or U32, just bytes. So your application will need to convert the bytes to U16. There is an easy way to do this in LabVIEW using the Join Numbers vi. It takes two bytes and spits out a U16 (or two U16's and spits out a U32). Very handy.

Similar Messages

  • Send text file via serial

    hi
    i've trying to send a text file via rs-232 but no success
    The file contains a code for a device im dealing with, when i send the text file with labview to the device, it went ok with no errors, but when i connect the device on hyperterminal and check if the code was loaded it was not.
    can you please give some clues to deal with this?
    thanks a lot
    attached example text file and LV code
    Attachments:
    Serial.JPG ‏45 KB
    DefineHome.txt ‏1 KB

    Some devices are very picky with the End Of Line.  You might want to right-click on your FIle Read and deselect the "Convert EOL".
    Or if you need to write 1 line at a time, right click on the Read Text File and select "Read Lines".  Set the number of line to read to -1 (read all) and then wire the resulting array into a FOR loop where you do the VISA Write.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Sending hex code through visa

    Hi i need to send some sequence of hex code read from xml to the serial port for example i will read the hex code as f0900080 in this f0 90 00 80 is all hex code when i send it through visa it is sending as string so that my receiver is taking each as char such thet 'f'is one char and taking value as 0x66(hex equalent for 'f').i need to send as hex value only help me out

    Hey,
    There is a good KB on this here:  http://digital.ni.com/public.nsf/allkb/6C24F2F07BC23BB78625722800710865?OpenDocument
    Christian

  • Create and Send an array of hex code to a device through serial port

    My name is Tina Drew,
    I am working programming a project involving an RFID system. In order to get the project to work the way that I desire, it must send a hex code of 01 to start the device and 6A to run in continuous mode. I have part of the program by the device does not appear to be responding to the hex signal. Maybe my programming is incorrect. In addition, it will not read the information from the microreader through the serial port. It says that the time has expired before the operation can be carried out. What should I do? A sample of the program is attached.
    Please contact me as soon as possible at 410-651-7604 or [email protected]

    You forgot to attach your program. It happens to the best of us. I sure wish NI would move the darn attachment button next to or before the submit button.
    Things to check:
    Baud Rate
    Number of stop bits
    Parity bit
    DCE device talking to DTE or vice versa. If both devices are DCE or both DTE, you must use a null modem cable.
    You can use Hyperterminal to see if you can communicate with your device manually (On the hyperterminal screen, hold down the Alt key and type 001 from the numeric keypad, not the numbers from the top row above the letters, a smiley face will appear if the device echos back the character. If it don't, you can setup hyperterminal to display the character - look under file-properties-settings-ASCII Sending-Echo typed characters locally). If you receive a good response, this will tell you if you have the correct baud rate, etc... After proving that this works, make sure your vi's serial port configuration match your hyperterminal settings. You can use a breakout box to determine if you have a good DCE-DTE match. DCE will assert the RS232 signals DSR, CTS, and CD. DTE will assert DTR and RTS. By hooking up a breakout box on one end of the com link, you can see which LEDs are on and this tells you whether you have a DCE or DTE. Most computers are DCE. Modems are DTE. Your device would have to look like a modem to the computer as far as RS232 signals go.
    - tbob
    Inventor of the WORM Global

  • Join two 8 bit integers and send via Serial Port

    I am trying to join two 8 bit integers and send the result via the serial port.
    I have a constant of hex value A that I need to join with a value from hex 0 - F (this is based on incoming data)
    When I use the Join VI, and type cast to change from hex to string for Visa Write, I recieve hex 0A0F.
    I have been able to use the hex 0-F with a case structure and then wire the corresponding constant ex A0 - AF.
    This makes the program very cumbersome and labour intensive to change. I have 22 commands I have to respond to with the address of 0-F.
    Currently, I have a Case structure that is selected with Message ID, then a case that is selected with subtype and then a case for address.
    Therefore I have to create a constant inside of each address case for each message as the responses are different.
    Thanks for any help
    Robin

    Gambin,
    As I understand it, you want to take the two bytes, put them together,
    and output the result as an ASCII string on the serial port.  This
    is easy.  Simply convert each number to an ASCII string,
    concatonate the two characters together, and send the resulting string
    to the VISA write function.  That's it!  I have attached a VI
    (ver. 7.1) that takes two hex numbers as input, converts them to ASCII,
    concatonates the results, and outputs the 'command' string.  Fell
    free to modify this vi and use it as you see fit.  I have left
    extra terminals in case you want to add error input/output for data
    flow, or whatever.  Notice that the display for the concatonated
    string is in '/' Codes Display mode.  This is because 0A hex is
    the newline character in ASCII.  You should also check to make
    sure that your VISA serial settings are not setup so that the newline
    character is the termination character.  If it is, the second
    character may not be recognised.  Hope this helps.
    Roy
    Attachments:
    HextoCommand.vi ‏17 KB

  • Sending Hex text files to the Serial Port

    Hi,
    Does anyone know or have any experience in how to open a Hex file, read
    the data and send it down the serial port.
    Regards,
    Martin.

    Martin Stanley wrote:
    >
    > Hi,
    > Does anyone know or have any experience in how to open a Hex file, read
    > the data and send it down the serial port.
    >
    > Regards,
    > Martin.
    Martin,
    I have a vi that reads a hex file then sends the data out the serial port.
    It waits for each byte to be echoed back before sending the next one.
    As each hex number is read, it's converted to a decimal number. The number
    is used as a decimal ascii code, the ascii character is then sent to the
    serial port.
    I'm not sure if this is the most efficient way to do it, but it works.
    Walter

  • I want to send 10 bit ADC from PIC via serial communicaton. i send it separetly 8 bit first then the other 2 bit. how to program in labview to capture those two packet then combine it togother

    i want to send 10 bit ADC from PIC mCu via serial communicaton.
     i send it separetly 8 bit first then the other 2 bit (2 bit --> with zero at 6 bit from LSB).
    how to program in labview to capture those two packet and then combine it together
    so i have 10 bit in lab view
    thank you

    Close, but now quite. You need to specify to the VISA Read how many bytes to read, not how many bits. Thus, the input would be 2, not 16. It's also not clear why you're trying to use the "String to Byte Array". The Type Cast will give you a number based on what data type you wired. You're basically telling it how to interpret the string. In this case we're telling it to interpret the string a 16-bit value, so we'll get a 16-bit integer. I know you said you wanted a 10-bit, but you can't have that. You'll get a 16-bit with 6 bits set to zero. Note: I did not completely understand what you said so we may need to change this slightly, but we want to get the communication and reading collection working first.
    Also, since you seem to be setting this in a loop you probably want to monitor this or to collect the data. For that you need a shift register. See attached for a modified version of your attempt. You need to set the datatype to I16 or U16 based on whether the value you get from the PIC is signed or unsigned.
    Message Edited by smercurio_fc on 05-01-2007 02:28 PM
    Attachments:
    Read PIC.vi ‏21 KB
    Read PIC.png ‏7 KB

  • Java application to send an SMS via my DKU-5 serial cable.

    Hi,
    I'm not sure if this is the right forum but....
    I'm doing a project for college which involves Learning Content Managemnt System.
    I've developed a few features for this including chat, forums, etc.
    I want to develop an SMS system to use in conjunction with the chat application
    ie. If a user is not online then the chat message will be sent to their mobile in the form of an SMS.
    Looking for help in creating a Java application to send an SMS via my DKU-5 serial cable.
    Any ideas??
    Thanks
    Message was edited by:
    kiwicas

    hiii u can try.........javax.comm package.
    its best for serial communication.
    contect [email protected] if required
    jigar

  • Just updated to Photoshop Elements 12 and am unable to send photo via Adobe email.service. I am unable to get a verification code via email to be able to continue the email transmission.

    How do I get a verification code which I need to send photo via email from Photoshop Elements 12?  Instructions say that I'm to receive verification code via email but none arrived.

    Thank you very much.
    AL
    From: Bill Hunt [email protected]
    Sent: Tuesday, January 28, 2014 2:22 PM
    To: aladvantage
    Subject: Photoshop elements 12 Unable to get the
    sharing (email) to work.
    Re: Photoshop elements 12 Unable to get the sharing (email) to work.
    created by Bill Hunt <http://forums.adobe.com/people/the_wine_snob> in
    *Premiere
    Elements* - View the full
    discussion<http://forums.adobe.com/message/6061690#6061690

  • I am trying to send SMS text via iPad Air and cannot. I have gone into my iPhone and "forward message to iPad". However I am prompted to enter "code shown on iPad"... What code and where do I find that on iPad??

    I am trying to send SMS text via iPad Air and cannot. I have gone into my iPhone and "forward message to iPad". However I am prompted to enter "code shown on iPad"... What code and where do I find that on iPad??

    The home screen is the screen that shows all of your app icons. You can have one home screen or up to 11 home screens depending on how many apps you have. The home screen on an iPad is the equivalent of the desktop screen on a computer. If you are using an app, just tap the home button once to return to a home screen.
    This is is a (my) home screen.
    You you might want to double check the instructions here.
    Connect your iPhone, iPad, iPod touch, and Mac using Continuity - Apple Support
    Make make sure that you are signed into your iCloud account in Settings>iCloud and make sure that you have selected your Apple ID email address as well in Settings>Messages>Send & Receive at>You can be reached by iMessages at.

  • How Do You Send the END KEY via Serial?

    Hello All,
    I'm trying to do something that would seem simple, but is not because almost no information about the END KEY on keyboards is posted online.  Essentially, I'm trying to activate a device that comes out of sleep when someone presses the END KEY through hyperterminal or some ascii based command window.  I'm trying to send that END KEY automatically using Labview, but I'm stuck. So here are my questions.
    Does the END KEY have a specific ASCII number?  I'm getting 2 different answers in my search for this one.
    If it doesn't, how do I send that command over the serial communications line?
    If it does, then what's the best way to convert it to something that labview understands as the END KEY, and not some combo of characters?
    Thanks a bunch.
    Matt

    You would have to find out the character that is mapped to the END key and simply send that out the serial port. You may want to try sending 0x4f". At least this is what I found for the mapping of the END key.
    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

  • Files via serial port

    I need to send a jpg file via serial port. Have anyone an idea how to get it. I am using LabView 6.0.

    Hi Francesc,
    In order to solve this you will need:
    - a null modem cable (the difference is that pin 2in goes to pin 3out and pin 3in goes to pin 2out)
    - a normal serial communication VI (you can use the one in lv\examples)
    - to pass the data you have to transform your array of bytes (your file) in string at sender and reverse this operation at receiver. THE ONLY PROBLEM is with ASCII character 11 (even if the receiver has all your bytes in buffer it seems that will return to you just those before ASCII 11). Thus, you will have to avoid the transmission of this character. An idea will be to split each byte from file in other two for transmission - for example its hex code (so, 11 will be transmitted as 0B ). Of course, this method doubles the number of transmit
    ted bytes. If somebody found a better solution, please let me know.
    good luck

  • How to transfer file from PC to PC via serial port using labview

    I need to transfer files(.txt, .doc, .xls) from PC to PC via serial port using LabVIEW. Is it possible to transfer files, if so how to transfer?
    Solved!
    Go to Solution.

    Yes, it is possible to transfer files with the serial port using LabVIEW.  Files are just collections of bytes and the serial port is pretty good at shipping bytes from one PC to another.  You need to connect the serial ports together with a null modem cable.
    First, take a look at the example for serial communication.   In LabVIEW, go to the Help menu and select "Find Examples...".  From there you can search for "serial" or navigate to Hardware Input and Output >> Serial.  Select the "Basic Serial Write and Read.vi".  Experiment with that example to gain confidence on the serial communication methods.
    Next, it's time to learn about how to read and write files.  For that, the examples could be somewhat confusing since they all deal with files that are presumed to have data of a specific type in them.  I would recommend just getting familiar with the functions on the File I/O palette.  Specifically, get to know the following functions.
    Open/Create/Replace File - On your destination side, you'll need to create the copy of the file that you are trying to transfer
    Close File - When you are finished reading from or writing to a file, you should close it.  It cleans up the memory being used and finalizes any write operations that are still floating in the write buffer.
    Read From Binary File - The best way to read from a file when you do not really care what type of file it is.  In your case, you just want to get those bytes read and sent out so they can be written down at the destination.
    Write to Binary File - At the destination side, this is what will store those bytes to the file you created with number 1.
    Get File Size (under the Advanced File Functions sub-palette) - You need to know how big the file is so you know when you are finished.
    OK, so once you are able to create files, write bytes to them, and read bytes from existing files you can move on to transferring.
    The basic method I would suggest is to have the user specify a source file on the source PC and a destination folder on the destination PC.  Then, find out the size of the source file using number 5.  Divide that size number by the number of bytes you feel like transferring at once.  The serial buffers are usually around 32k (if I remember correctly) so do not exceed that.  Now begin sending data by reading some number of bytes and wiring that string output to the VISA Write function.  On the destination side, you'll want to be monitoring the serial port for bytes and reading them when they arrive.  Wire that string to the Write to Binary File function to add them to your destination file.
    That is the basic outline of how to do it.  You have to be careful not to overload the write and read buffers on the serial ports.  Initially you can use delays on the sending side to make sure the reading side has enough time to digest.  To get things moving faster, you can bring in some flow control.
    If all that sounds a bit intimidating, there are Alliance Member companies out there (such as PrimeTest Automation) who can write such code for you and even provide a turnkey solution for you.
    Happy wiring,
    Dan Press
    Certified LabVIEW Architect
    PrimeTest Automation

  • DigitalColor Meter not displaying HEX code

    In Snow Leopard I was using DigitalColor Meter 3.7.2 which had support for RGB as a Hex Value, 8-bit hex colour as  (See Image)
    I recently purchased a iMac and although I thought i was going to have Snow Leopard installed it came with Lion. So I though I would try it out for myself.
    I when to open my DigitalColor Meter 4.0 on Lion and I am not even given the option. (See Image)
    As a web developer I have used this tool every day for years! I was able to cut and paste the hex code to any colour I saw on my screen not matter where it was or what program I was using. The changes made to this tool have basically made it useless to me. 
    I really don't know why you would take away functionality on a operating system that is used by so many creative people and in a field that is just growing more in popularity.
    I really hope I can find a way to get this back or it is just hidden with some terminal command.

    You could try using the SL version in Lion. I've not tried that. BTW, if you want to report this issue to Apple's engineering, send a bug report or an enhancement request via its Bug Reporter system. To do this, register as an Apple Developer—it's free and available for all Mac users and gets you a look at some development software. Since you already have an Apple username/ID, use that. Once a member, go to Apple BugReporter and file your bug report or enhancement request. You'll get a response and a follow-up number; thus, starting a dialog with engineering.

  • Sending a dom via http Post

    Hi,
    for some reason unknown to me whenever I try to send a dom via http Post I get the following error:
    org.xml.sax.SAXParseException: The root element is required in a well-formed document.
    This is the source code:
    package com.cyberrein.payunion.transaction;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    //xml lib
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    //weblogic xml lib
    import weblogic.apache.xerces.dom.DocumentImpl;
    import weblogic.apache.xml.serialize.DOMSerializer;
    import weblogic.apache.xml.serialize.XMLSerializer;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    public class Xmltest extends HttpServlet {
    //Initialize global variables
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    //Process the HTTP Request
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // Retrieve transaction data from HttpServletRequest.
    try {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(false);
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document docIn = db.parse(request.getInputStream());
    String code = "XX";
    String tranID = "000000";
    String message = "This Card Is Invalid. Transaction Discontinued";
    //Output dom
    Document docOut = new DocumentImpl();
    Element e = (Element)docOut.createElement("TransactionResponseData");
    e.setAttribute("Code", code);
    e.setAttribute("TransactionID", tranID);
    e.setAttribute("Message", message);
    docOut.appendChild(e);
    FileOutputStream fos;
    fos = new FileOutputStream("/victory");
    DOMSerializer serX = new XMLSerializer(fos,null);
    serX.serialize(docIn);
    DOMSerializer ser = new XMLSerializer(response.getOutputStream(), null);
         ser.serialize(docOut);
         } catch (Throwable e) {e.printStackTrace();}
    //Get Servlet information
    public String getServletInfo() {
    return "com.cyberrein.payunion.transaction.Xmltest Information";
    package com.cyberrein.payunion.transaction;
    import org.w3c.dom.*;
    import org.apache.xerces.*;
    import org.apache.xerces.dom.*;
    import org.apache.xerces.parsers.*;
    import org.apache.xml.serialize.*;
    import org.xml.sax.*;
    import java.net.*;
    import java.io.*;
    public class CardClient {
    private String sURI;
    public BufferedReader in
    = new BufferedReader(new InputStreamReader(System.in));
    public CardClient(String serverURI) {
    sURI = serverURI;
    public Document test(){
    Document docIn = null;
    try
    //XML Document impl
         docIn = new DocumentImpl();
    //Create the root element
         Element t = docIn.createElement("TransactionData");
    Element k = docIn.createElement("Payunion.com");
    k.appendChild( docIn.createTextNode("North American server") );
    t.appendChild(k);
    //Set attributes
    t.setAttribute("cardnumber", "4444444444444444");
    t.setAttribute("amount", "3000.67");
    t.setAttribute("name", "tolu agbeja");
    t.setAttribute("cvv2", "001");
    t.setAttribute("pu_number", "ejs:pupk:23456");
    t.setAttribute("expirydate", "0903");
    t.setAttribute("address", "100 peachtree industrial");
    t.setAttribute("zipcode", "30329");
    docIn.appendChild(t);
    catch (Throwable te)
    te.printStackTrace();
    return docIn;
    public Document sendRequest(Document doc) {
         Document docOut = null;
         try {
         URL url = new URL("http://" + sURI);
         HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("POST");
         conn.setDoInput(true);
         conn.setDoOutput(true);
         OutputStream out = conn.getOutputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    XMLSerializer ser = new XMLSerializer( out, new OutputFormat("xml", "UTF-8", false) );
    ser.serialize(doc);
    while(!br.ready()){}
         DOMParser parser = new DOMParser();
         parser.parse(new InputSource(br));
         docOut = parser.getDocument();
    catch (Throwable et)
         et.printStackTrace();
         return docOut;
    public static void main(String []args)
    CardClient c = new CardClient("cyber1:7001/xmltest");
    try
    Document doc = c.sendRequest(c.test());
    Element responseMessage = (Element)doc.getElementsByTagName("TransactionResponseData").item(0);
    String message = responseMessage.getAttribute("Message");
    String tranID = responseMessage.getAttribute("TransactionID");
    String code = responseMessage.getAttribute("Code");
    System.out.println(message);
    System.out.println("");
    System.out.println("The Response Code Is: "+code);
    System.out.println("");
    System.out.println("The Transaction ID Is: "+tranID);
    catch(Exception ex)
    ex.printStackTrace();
    All comments will be appreciated!!

    Hi, thanks for your reply i knew the FileUplaod was the way forward.
    I read topics advising to use the FileUpload and tried the following but it did not seem to work ( i get an HTTP Internal Server error when i try that):
    try
    DiskFileUpload upload = new DiskFileUpload();
    boolean isMultipart = FileUpload.isMultipartContent(request);
    if( isMultipart )
    List items = upload.parseRequest( request );
    Iterator iter = items.iterator();
    while( iter.hasNext() )
    FileItem fileItem = ( FileItem ) iter.next();
    File uploadedFile = new File("myreceivedfile.zip");
    fileItem.write( uploadedFile );
    }catch (Exception e)
    System.out.println("RECEIVER: " + e.getMessage());
    Also DiskFileUpload,isMultipartContent and parseRequest have a line going through the middle (horizontal middle).
    Edited by: Overmars08 on Jun 23, 2009 5:35 AM
    Edited by: Overmars08 on Jun 23, 2009 5:36 AM

Maybe you are looking for

  • Why wont my MBP read my external HDD?

    I have an '09 MBP running Lion, and a USB EmBrace Bare Docking Station from ACCStation with a 2.5TB 3.5" MediaMax drive in it, and it doesn't work. On the description of the docking station it said specifically that it worked on both USB 2.0 and 3.0,

  • I was watching a tv show on my iPad 2 when the show froze up, now it won't let me watch anything. How can I get it to play?

    I pad 2 won't let me play tv shows it played half of one, now it is just a blank screen and even when I reset everything and re open it it is the same. Please help

  • Subject Area

    Hi, I ran a full load of HR Analytics Using DAC and EBS R1211 as Source System. My problem is that I dont have the payroll data in the EBS I am using, now they are giving me a different EBS in which I have payroll data but no demographic data, can I

  • Workflow not starting in production

    hi all i am having problem starting workflow in production,same workflow has been tested in development and has been transported accordingly error that is coming is that workflow cant be activated ,when i check the workflow log ,it tells that there i

  • RoboHelp in Lotus Notes Applications

    Probably a basic question - - but in my world extemely important. I'm in the process of evaluating RoboHelp 7 for possible purchase for my company. We want to use it as a help application for four of our Lotus Notes-based applications. Does RoboHelp