how to receive data from visual basic 6 to pic microcontroller using serial port

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roshperea
    New Member
    • Feb 2014
    • 1

    how to receive data from visual basic 6 to pic microcontroller using serial port

    ][/CODE]

    I am using visual basic 6. There was no data come to my textbox even it was connected on my device. I have a settings of com3, 9600, 8, n, 1.
  • Honduras2811
    New Member
    • Apr 2014
    • 21

    #2
    1. Do you have a Com3?
    2. How are you updating the Textbox?

    Comment

    • Honduras2811
      New Member
      • Apr 2014
      • 21

      #3
      On second thought, that doesn't sound too friendly, and that was not my intent.

      First, have you ever established communications with any device using Com3? Back before USB ports, computers usually had two com ports, but they were Com1 and Com2. The newer computers don't have any real DB-9 or DB-25 com ports at all. One of the reasons I'm confused is that most of the PICs I have seen have either a DB-9 or DB-25 connector.

      When you start talking about Com3 it makes me think of the virtual Com ports that modern OSes provide where communications are actually done with a USB cable.

      That's the reason why I ask if you have ever been successful using that port before. If you have, we still aren't completely out of the woods. Suppose that the PIC is bad, for instance?

      I've used VB to talk through Com ports a number of times, and one of the first things I learned was not to assume that the problem is in the program. Fortunately, at the time I was doing this USB ports were not yet in use, which actually made troubleshooting much easier.

      Here's a link for a make-it-yourself DB-9 loopback tester.


      This only tests half of the possible problems, though. What you really want is a breakout box with LED indicators so you can actually watch what's happening on the RX/TX lines, as well as CTS, etc.

      But that is only for real Com ports. For USB ports/cables, the decent testers seem to be a lot more expensive if you want to test anything other than output voltage. But still, if I was doing a lot of work with PICs via USB, I would want a breakout box.

      I say that now after wasting a good amount of time trying to talk to an Arduino Mini. If I had a USB breakout box then I could have saved myself about a week of time.

      One good thing about this, though, is that once you get this to work, you will never need to worry about the code again, as long as you are careful to make modular and re-usable.

      Another possible issue is the Baud rate. You are using 9600 bps and some modern UARTs aren't comfortable at that speed. They are supposed to auto-negotiate, but some don't.

      Comment

      • Honduras2811
        New Member
        • Apr 2014
        • 21

        #4
        WOT Part 2

        What I suggest you do depends on whether you have ever been able to communicate with anything using Com3 on your computer before.

        Anyway, take a break from programming for a while and do some manly hardware stuff.

        Whatever kind of cable you are using, see if you can find, or make at least a loopback tester. (On Arduinos all you have to do is jumper two pins to go into loopback mode.) Just remember that this doesn't really test anything except the computer.

        In loopback mode, anything you send out should pop right up in your textbox. If it does there are still some possible problems on the computer end. Like the 'modem' initialization string. Are you sure that the PIC is looking for 8,N,1? Changing the Baud rate is as easy as adding some option buttons to your form.

        But I have to warn you that the real problem I had with that Arduino was caused by faulty driver software that was provided with the Arduino. Are you using a driver, or can the PIC accept plain ASCII?

        I used to enjoy working on communications problems like this because there are so many things that can possibly be wrong. I think that, about the time that I turned 60, that stopped.

        Comment

        Working...