Serial Comm. through a Comm Port - WinXP to PIC

This is a discussion on Serial Comm. through a Comm Port - WinXP to PIC within the Networking/Device Communication forums, part of the General Programming Boards category; Okay, this is my first thread and I have read up on what I should and shouldn't do, but I ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    Redmond, WA
    Posts
    6

    Question Serial Comm. through a Comm Port - WinXP to PIC

    Okay, this is my first thread and I have read up on what I should and shouldn't do, but I might forget and do something silly. If I do, please correct me, and I will do better next time.

    I am working on a team project for school where we have an LED Matrix from scratch that we are addressing so that we can create a game. My piece of the project is to figure out how to incorporate serial communication into the picture (most likely will be RS-232 unless persuaded from using it). It entails a coding piece for the PIC microcontroller and a PC, as well as the actual wiring setup (hardware). I need assistance with the computer end setting up the comm port. I have not the faintest idea of where to start after having gone over some preliminary research for a while (~7hrs+). I am in need of assistence sorting out where I should start programming from. I have experience with C and C++, but only the basics and am starting to learn advanced things. I/O still scares me, so this is making me worry a bit. (Scholarly programmer of about 1 year now)

    Okay, so to make things clear, here is what I could use in the way of help:
    1. Should I learn C# to make things a lot easier?

    I have found that there seems to be a lot of higher level things that I can do such that I don't have to understand a thing going on. However this looks like it uses classes and methods, which wouldn't be too much different that straight up function calls.

    2. If I stick with C/C++ which of the two would be easier? I have more knowledge of C in general than I do C++ (since I have yet to get to the more OOP pieces of C++).

    3. Are there any really solid sites that are for serial noobs like myself? Any recommendable books? I am willing to pay money to get the tools I need to reach my goal, so if there are any hardware considerations, or specific communication means I should consider?

    4. Where else could I probe for information?

    5. Are there any pitfalls to watch out for?


    That is all I am coming up with at the moment. Please make sure to point out which piece(s) you're repsonding to, just for clarity (if you would be so kind). =) Thank you.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Are you writing for the PIC or the PC? (I'd guess the PC if you think C# or C++ will be available for the PIC.)

    If it's the PIC, go to Microchip's site for as much help as you'll likely find, or Jan's site http://www.lvr.com/serport.htm for serial stuff.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Oct 2006
    Location
    Redmond, WA
    Posts
    6
    PC programming in C/C++ is what I would need help with mostly. For the actual serial part in general, I have found that site through my research, and it does look very useful. =) Thank you for mentioning it. I will be certain to keep reading through that site.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    If you havn't allready, look up the following functions in MSDN. CreateFile used to open the comm port. ReadFile/WriteFile used to read and write from the comm port as if it were a file. GetCommState/SetCommState.

    When reading and writing from a comm port or any communications device remember to never assume that what you requested was recieved and use the number of byte read value.

    The .Net framework has functions for dealing with serial ports which would probably be easier but I don't know much about them.

  5. #5
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Navigating the MSDN generally sucks. This is where I go when I start tinkering with quick-and-dirty utilities.
    http://msdn.microsoft.com/library/de...sdn_serial.asp

    As far as a language to choose, I don't have much for a recommendation. I know nothing of C#. With respect to C or C++, if you're using the Win32 API you can choose either. If you're using a different API, well, that's what will help pick a language.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  6. #6
    Registered User
    Join Date
    Oct 2006
    Location
    Redmond, WA
    Posts
    6
    Thank you both for what I believe will pan out to be a great help. =)

    I did manage to find the site you linked up before coming here, but since I noticed that it uses the Win32 API, I tried to stay away from it. Although it is only an API, and I would most likely only need to make the right function calls, the inner workings might be too hazy for me to understand at the moment. I believe two of my team members know some of what is going on in general, so I could ask them if I need clarification.

    I don't happen to know anything about .Net either, but that is okay. Just as long as it doesn't take a great deal longer I should be fine.

    I agree, I would suspect just being able to navigate the MSDN without reaching a dead end would be quite a skill. =)

    Knowing that the process is more like writing to a file should make things a bit easier. I just have to know the specific particularities.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. serial port to poll on request
    By infineonintern in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 07:52 AM
  2. Can't Read From Serial Port
    By HalNineThousand in forum Linux Programming
    Replies: 14
    Last Post: 03-20-2008, 06:56 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 06:49 PM
  4. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM
  5. Serial port read..can someone tell me..
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 06-27-2002, 09:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21