serial connection n vb interface


Closed Thread
Results 1 to 2 of 2
  1. #1
    gidah's Avatar
    gidah Guest

    Default serial connection n vb interface

    hello..i using pic16f627 for my project.i not sure how to sent a signal to my pic by using vb6 code..this is my picbasic coding..

    DEFINE OSC 4
    define HSER_BAUD 1200
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h

    MDATAR1 VAR BYTE
    MDATAR1 = 1
    hserout ["ONLINE",13]
    MAIN:
    hserin [WAIT("A"), DEC MDATAR1]
    PORTB.4 = 1
    PORTB.5 = 1
    PAUSE 1000
    PORTB.5 = 0
    PAUSE 1000
    PORTB.5 = 1

    this is my vb coding:

    Private Sub Command1_Click()
    Dim str As String

    MSComm1.CommPort = 5
    MSComm1.Settings = "1200,n,8,1"
    MSComm1.InputLen = 0
    MSComm1.PortOpen = True
    Do
    Loop Until MSComm1.InBufferCount >= 6
    str = MSComm1.Input
    Text1.Text = "receive:" + str
    Text2.Text = "sending: A2A"
    MSComm1.Output = "A2A"
    MSComm1.PortOpen = False
    End Sub
    Private Sub Form_Load()

    If MSComm1.PortOpen = True Then
    MSComm1.PortOpen = False
    End If
    End Sub


    when i run my vb programming..i can receive the word "ONLINE" on my screen means that the are a connection between pic and my vb.but i can't send signal from vb to pic to on my led..plz help me??...isn't my coding is right..i need help immediately..

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    i don't know how much it will help, but in your PIC program, you should add
    DEFINE HSER_CLROERR 1

    with the other DEFINEs. And at the end of your program, you should add a GOTO somewhere or END

    There's few weird thing on the VB side but it may work.

    I have few PDF on VB if you want them drop me you e-mail in my PM box.

    OR have a look on the Bruce website => http://rentron.com/VisualBasic.htm
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Replies: 33
    Last Post: - 19th March 2010, 03:02
  2. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 07:57
  3. Serial interface with RFID reader
    By brid0030 in forum Serial
    Replies: 8
    Last Post: - 23rd January 2007, 06:23
  4. VB Binary Serial Help for someone
    By air1kdf in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th December 2005, 16:04
  5. Serial from 16F877 to VB
    By jrudd in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th March 2005, 23:33

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