How can I read a serial port using XCode?

Hello,
I'm using an iMac 2009 with Mac OS X 10.6.7. I have a USB to Serial cable and I want to connect a hardware I made using a microprocessor Microchip PIC to my mac. I'd like to read values from the serial port and also write values to it. I'm already able to do this using the Terminal with the following command:
screen /dev/tty.usbserial 9600
I'd like to build my own application now. Does anyone could send me any sample code?
I'm using XCode 3.2.5 and I'm a beginner on XCode.

I looked at Dev Center for sample code, and I found this link:
http://developer.apple.com/library/mac/#samplecode/SerialPortSample/Introduction /Intro.html%23//apple_ref/doc/uid/DTS10000454-Intro-DontLinkElementID_2
I downloaded the sample Xcode project and, when I click on "Build and Run" button, it generates an error with the following message:
"GCC 4.2 is not compatible with the Mac OS X 10.4 SDK (file SerialPortSample.c)"
Maybe, it occurs because the code is too old (2005). I didn't find any newer sample.
Could you help me?
Thank you.

Similar Messages

  • Hp dc 7800 how can i install pci serial port driver on windows 8.1

    hp dc 7800 how can i install  pci serial port driver on windows 8.1  please help
    This question was solved.
    View Solution.

    Hi:
    Download and install the W7 AMT driver.
    http://h20565.www2.hp.com/portal/site/hpsc/templat​e.PAGE/public/psi/swdDetails/?sp4ts.oid=3459243&sp​...

  • How can i read an COM port ???

    Hi,
    somebody knows how can i read an COM port from Forms 4.5 ?
    Thanks in advance.
    Patricio

    Hi Patricio
    have U got any solutions?? Im also trying to send message to display panel from forms 5.
    If You got any please let me know itll help me a lot
    Thanx
    Suraj

  • How can i read Object serialized in delphi ?

    anyone has got any ideas how can i read serialized object created by delphi and was serialized in a file

    zeda wrote:
    Peter__Lawrey wrote:
    To my knowledge you need a Delphi program to read it.so there is no 3rd party plugin or so?Not that I know of. You could learn more about how Delphi serializes objects, and work back from there. But you're probably much better off taking a hint from Peter and serializing to XML in the first place. This sort of problem is the exact kind of thing XML is good at solving

  • How can Java read VC++ serialized achieve file

    After finally realizing Java is much more powerful than C++, I am currently transferring my VC++ codes to Java and having a problem on how to read my old VC++ serialized achieve files. In java.io, can readObject() do the same job as VC++'s Serialize(ar)?
    In VC++ codes, my data was structured as the following:
    struct TickData {
         time_t     time;
         double     price;
         int     size;
    CList<TickData, TickData &> m_tickList[TICKER_MAX];
    m_tickList[nId].Serialize(ar); // VC++ data was saved this way
    Does anyone know what java method and how I should use to read all my old VC++ serialized files?
    Help on this will be greatly appreciated! Thanks.

    Unless you find some library somwhere, I strongly suggest to write a conversion tool in VC++.
    It takes a serialized file as input and spits out a file in a language independent format: XML,
    CSV, INI, Java properties, whatever. You Java program will use this format, not serialization,
    so you will never have this kind of problems in the future.

  • How can I read the serial data from my mouse on com 1?

    I just started using LABView so please have patience with me!
    An error message says the resource is valid but VISA can not open a session with the device, in this case a Roller ball cannected to the comm port. Obviously windows is already using this device, I don't want to over ride it just monitor it.

    If you are using LV 7 the attached VI demonstates how to use the new functions that are now included with LV.
    I just stumbled across these earlier today and they worked right out of the box.
    Have fun,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    mouse_position.vi ‏90 KB

  • How can I read a pdf file using an ALC process

    I have a pdf form with a schema, I want to read the pdf form in to an xml with same schema so that i can process the data  that i get from the pdf file.
    I have tried the following
         I have created an input document variable (where i ll give my pdf form as input)
    I have created an output xml variable with the same schema as the input pdf document.
    I have created a process with set value service which assign the input pdf into the xml variable(so that i ll get the data from the pdf in to xml)
    Is the above approch is correct ..
    If any one knows, please suggest an approch to read my pdf.
    Thank You

    The fact that you have used a schema merely meand that the submission of the form data will be in the format defined by the schema. Generally when you submit the form you associate an XML variable in the user step to recieve that data (this assumes that your form is setup to submit xdp data). If you associate your schema with that XML variable you will be able to expand and see teh structure of your schema when using SetValue services etc. If you are merely interested in getting what was submitted (say to validate the data against the schema) you will have to assign the inbound data to another variable and remove the outer nodes that were added for our internal purposes (xfa.datasets.data). This is done in a setValue where you woudl use an XPath expresion of xfa/datasets/data/* (meaning that all nodes below the data norde are copied to the named variable.
    Hope that helps
    Paul

  • How can I read something from keyboard using i/o operations?

    I wrote the following code in java using *"oracle Jdeveloper 11g release 2"* platform and i think it's correct, but I have a little problem when I try to execute him, it asks me to introduce a number, and this it's correct, but I don't know how to introduce that number. If i want to write the same code in c or c++ using Visual Studio it's very easy when i want to introduce a number i must run the code and then a console window will appear and then i introduce the number.
    Could someone to give me a link at a tutorial about how to use *"oracle Jdeveloper 11g release 2"* when I have to use i/o operations or something useful.
    package instante;
    import java.io.*;
    public class Read_from_keyboard {
    public static void main(String[] args) {
    BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in), 1);
    double number_read = 0.0;
    String line = "";
    try {
    System.out.flush();
    System.out.println("Give a number: ");
    line = keyboard.readLine();
    Double tmpDouble = Double.valueOf(line);
    number_read = tmpDouble.doubleValue();
    System.out.println("The number is: " + number_read);
    } catch (IOException e) {
    System.out.println(" Input from keyboard " + e.toString());
    System.exit(1);
    Thank you!
    Edited by: Iosif on Nov 9, 2012 5:06 AM

    Its a command line application. Perhaps JDeveloper has support built in to be able to do that in the IDE, but generally you'd just want to run a command line application on the command line / shell. How to do that is described in any Java book, in the Oracle Java tutorials and in just about a couple hundred/thousand articles you can find through Google.
    Other than that, the JDeveloper forum is here:
    JDeveloper and ADF

  • How Can We Read Incoming SMS by using Application

    In My Application  i am able to Send SMS Programatically to a Perticular Mobile Number When the User Clicks Submit Button.
    then there is a responce message from that Mobile Number Now I want to Read that Message and Populate that SMS text in to my Application.
    I Searched for this and found that this is not possible in iOS.
    My Question is There any Possibility Accessing Inbox SMS With User Permissions?

    hi,
    If you want to record for two transations then you will use same method as one transation.For example if you want to execute two transations like VA01(sales order) and VL01N(delivery).Here first you can record for both transactions seperately and in the function module calling you will call BDC_INSERT two times
    First function module contains Tcode as VA01 and Bdcdata table as data for the va01 transaction and second table contains tcode as VL01N and Bdcdata table conatins data which contains the record data of the delivery recorded data.
    PERFORM open_batch_session USING p_sessa.
      LOOP AT ltcap_int
        WHERE NOT tot_inc IS initial.
        ltcap_int-adj = ltcap_int-adj * -1.
        CONCATENATE ltcap_int-fund '/' ltcap_int-cfc INTO zuonr.
        PERFORM fill_bdc_header.
        PERFORM fill_bdc_lines.
        PERFORM post_entries.
        PERFORM insert_batch_session USING 'FB01'.
        ltcap_int-adj = ltcap_int-adj * -1.
      ENDLOOP.
      PERFORM close_batch_session.
    perform start_batch_session using p_sessa.
    Budgets
      WRITE p_fy TO c_fy.
      PERFORM open_batch_session USING p_sessb.
      LOOP AT ltcap_int
        WHERE NOT tot_inc IS initial.
        PERFORM rollup_header.
        PERFORM rollup_line.
        PERFORM rollup_save.
        PERFORM insert_batch_session USING 'FR21'.
        IF NOT ltcap_int-gsef_amt IS INITIAL.
          PERFORM rollup_header_gsef.
          PERFORM rollup_line_gsef.
          PERFORM rollup_save.
          PERFORM insert_batch_session USING 'FR21'.
        ENDIF.
      ENDLOOP.
      PERFORM close_batch_session.
    perform start_batch_session using p_sessb.
    We can process more than 1 transactions in session method.
    For this we will create the internal tables equilant to transactions and
    Between BDC_open_group and BDC_close_group we will call the BDC_Insert the no.of transactions times and populate the internal tables which contains the data pertaining to diffrent transactions.

  • How can i activate the serial port on OS X 10.9.2?

    I need to connect My MacBook Pro to a switch via console but the laptop dont recognice this port. I tried to use prolific driver to install but when I go to System Preferences doesn't show serial port

    The device you bought looks like the Plugable adapter I bought, which is based on Prolific PL2303, so you just need to know what the tty for the serial device is.  The drivers on the Plugable site says 10.6 or greater, so maybe try those.
    http://plugable.com/products/pl2303-db9
    In my case, its /dev/tty.usbserial.  If you want to just connect to a switch, install the drivers and use screen like so:
    screen <serial device> <baud rate>
    ex:
    screen /dev/tty.usbserial 115200

  • 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

  • How can I split the video port of an older Mac Mini so I can use both the 922-6199 DVI to RCA, S-Video Adapter and a Cinema Display?

    How can I split the video port of an older Mac Mini so I can use both the 922-6199 DVI to RCA, S-Video Adapter and a Cinema Display?

    Which exact Mini?
    At the Apple Icon at top left>About this Mac.
    Then click on More Info>Hardware and report this upto but not including the Serial#...
    Hardware Overview:
    Model Name: iMac
    Model Identifier: iMac7,1
    Processor Name: Intel Core 2 Duo
    Processor Speed: 2.4 GHz
    Number Of Processors: 1
    Total Number Of Cores: 2
    L2 Cache: 4 MB
    Memory: 6 GB
    Bus Speed: 800 MHz
    Boot ROM Version: IM71.007A.B03
    SMC Version (system): 1.21f4

  • How can I find my lost IPod using its serial number?

    How can I find my lost iPod using its serial number?

    As I said, and Varjak said, if it is setup in iCloud, login to iCloud from your comptuier or other device, click on Find My and find the entry for the iPod, and if it is turned on and connected to the internet it will show up.

  • How can I find my serial number for Adobe Acrobat 11. I got a new iMac and I don't want to use the new version at £18.00 per month. I don't need it. Thank you

    I used to use CS5 and I want to use the Acrobat version on my new iMac.
    How can I find my serial number for Adobe Acrobat 11.  I don't want to use the new version at £18.00 per month. I don't need it. Thank you

    Hi Anthony Aduhene
    Please refer : Find your serial number quickly

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

Maybe you are looking for

  • Chnage font size in payroll varinet (ZORD )

    Dear Expert, I have done program to generate epay slips as PDF and mail to relevant users, I am using GET_PAYSLIP FM to convert pay slip to PDF And also I am using ZORD pay slip variant .my issue is when the mail comes to users its font size is too b

  • HELP! iPod won't update, etc.

    So my iPod has been broken for about three weeks now. The first week, I came here and was trying to fix it but I couldn't. I left it alone since it wasn't working and last night I tried turning it on. It worked, so I charged the iPod. Everything was

  • Business Card Scanner

    Hello, does anybody know if there is a business card scanner which supports SAP CRM ? We actually run SAP CRM 5.0 and have a workaround to create flat files to upload them to SAP with a special report. Thanks in advance, Thorsten

  • Wrt54g2 Internet speed decreased by 54 times

    hi im am currently using a wrt54g2  v 1.0 wireless router, and it runs at a range of 54-1 mbps. Usually its okay for the first few hours after a reboot, running at the sppeed 36-54 mbps, but after few more hours it drops to 5-1 mbps...... i have call

  • Swing. What do they use?

    Hi guys. I have been trying to figure out which swing component is used within microsoft outlook (just an example) to represent the list of tasks that you can do. Generally on the bottom left corner there is a list of clickable items that all display