send data from pc(Visual Basic) to pic16f877a through serial port(DB9)


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2008
    Posts
    45

    Default send data from pc(Visual Basic) to pic16f877a through serial port(DB9)

    hi.i want to send data from pc(Visual Basic) to pic16f877a through serial port(DB9).all the hardware have been setup(i'm using max232).can someone help me for the coding part(both code for VB and pic).just a simple code(LED blinking) for testing my pic circuit.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    Have a look here

  3. #3
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    thanx man...

  4. #4
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    here's the code for micro controller:

    PinNumber var byte
    PinState var byte

    Main:

    ' Use the programming port to receive
    ' data at 2400 baud
    ' Wait for the synch byte (255) and then
    ' get the PinNumber and PinState
    Serin 16,16780,[WAIT(255),PinNumber,PinState]

    ' If PinState=0 Then go to GoLow
    ' otherwise go to GoHigh
    Branch PinState,[GoLow,GoHigh]
    Goto Main


    ' Set The pin low
    GoLow:
    LOW PinNumber
    Goto Main


    ' Set the pin high
    GoHigh:
    HIGH PinNumber
    Goto Main
    END

    i have problem when compile it....the 'Serin 16,16780,[WAIT(255),PinNumber,PinState]' appear as bad expression...why is it???

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    Hi,
    i have problem when compile it....the 'Serin 16,16780,[WAIT(255),PinNumber,PinState]' appear as bad expression...why is it???
    That's probably because WAIT isn't supported by the SERIN command, you'd need to change that to SERIN2 i think.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Or might be because PIN 16 is not a valid pin , funny I have never used PINs always used PortA, PortB etc . . less confusing I guess . . . anyway only 0-15 are valid: SEC. 4.11. PINS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    so what is your suggestion joe s.????

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    HenrikOlsson and Joe are saying change your code from
    Code:
    Serin 16,16780,[WAIT(255),PinNumber,PinState]
    to
    Code:
    SERIN2 PORT?.?,16780,[WAIT(255),PinNumber,PinState]
    Seems to work much better using for example:
    PORTC.3
    instead of
    PIN?
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Default

    texas5 -
    Please note the information on Bruce's website prior to the code for this example:
    Quote Originally Posted by http://www.rentron.com/sending_data.htm
    The Microcontroller Part
    For simplicity I am going to use a Basic Stamp II to receive the data and act accordingly to the data. You will need to hook up the Basic Stamp II just like you are going to program it and use the programming port (pin 16) for communications. Program the Basic Stamp II with the following code...
    That's probably where there is some confusion.
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

  10. #10
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    emmmmm....thanx for the information....

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Replies: 2
    Last Post: - 24th August 2008, 20:03
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts