Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Help for serial communication.

Help for serial communication.

Scheduled Pinned Locked Moved C#
xmlhelptutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AhsanS
    wrote on last edited by
    #1

    Hello dear programmers, I am developing a project which require xml transfer from pc tp pda and vice versa over seial port. i have no idea how to do it.can any body send me sample code of serial communication between the two. i'll be very greatful to you. Regards Ahsan Ullah

    E 1 Reply Last reply
    0
    • A AhsanS

      Hello dear programmers, I am developing a project which require xml transfer from pc tp pda and vice versa over seial port. i have no idea how to do it.can any body send me sample code of serial communication between the two. i'll be very greatful to you. Regards Ahsan Ullah

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      RS232 Communication can be accomplished using System.IO.Ports.SerialPort (.NET 2).  As to the actual transferring of the file you'll need to be more specific as to the requirements / protocols involved.  If you're writing your own protocols then it is very simple, if you're using standard protocols then it is simple also (depending on the complexity of the protocol). Most important question, do you have control over the PDA side or is that already built-in?


      You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

      A 1 Reply Last reply
      0
      • E Ed Poore

        RS232 Communication can be accomplished using System.IO.Ports.SerialPort (.NET 2).  As to the actual transferring of the file you'll need to be more specific as to the requirements / protocols involved.  If you're writing your own protocols then it is very simple, if you're using standard protocols then it is simple also (depending on the complexity of the protocol). Most important question, do you have control over the PDA side or is that already built-in?


        You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

        A Offline
        A Offline
        AhsanS
        wrote on last edited by
        #3

        I know about the ports namespace you have mentioned.I have the control over thePDA side as well.Because i am writing the application for that side as well.I have no idea about which protocol to use.Can you kindly send me just a simple code so that i might be able to work on it. Thanks a lot for your reply. Ahsan Ullah

        E 2 Replies Last reply
        0
        • A AhsanS

          I know about the ports namespace you have mentioned.I have the control over thePDA side as well.Because i am writing the application for that side as well.I have no idea about which protocol to use.Can you kindly send me just a simple code so that i might be able to work on it. Thanks a lot for your reply. Ahsan Ullah

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #4

          Is the serial port being used for any other purpose in the application other than sending files?


          You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

          1 Reply Last reply
          0
          • A AhsanS

            I know about the ports namespace you have mentioned.I have the control over thePDA side as well.Because i am writing the application for that side as well.I have no idea about which protocol to use.Can you kindly send me just a simple code so that i might be able to work on it. Thanks a lot for your reply. Ahsan Ullah

            E Offline
            E Offline
            Ed Poore
            wrote on last edited by
            #5

            Ahsan-AhsanS wrote:

            I have no idea about which protocol to use.Can you kindly send me just a simple code so that i might be able to work on it.

            Regarding the protocol it doesn't really matter since you control both sides you can do what you want.  It all depends on what your requirements are, e.g. if you're just sending a file then all you could potentially do is open the port, send a query string, e.g. "OK?", if the PDA returns "OK" back then simply send the entire file with a checksum at the end.  If the checksum matches all well and good, if not then resend. That would be the simplest solution (although I suggest sending it in blocks of say 0x100 bytes and checksum each of these blocks so you don't have to resend the whole file. If the serial port is being used for other stuff as well then you'd have to make it a bit more complicatated, (e.g. replace the "OK?" with "SendFile?", if it can be sent then it responds with an Ack ("OK") and you perform the previous steps). As for the simple code, I'm sorry I don't have time, I have my first (final) A-Level module tomorrow.


            You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups