send serial data to PIC 16f84 ausing VB6


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

    Default send serial data to PIC 16f84 ausing VB6

    need help here...
    ive try to turn 'on' the LED through PIC 16f84
    can one help me:

    VB6 code :
    Private Sub Form_Load()

    ' Use COM1
    MSComm1.CommPort = 1

    ' 2400 baud, no parity, 8 data bits, 1 stop bit
    MSComm1.Settings = "2400,N,8,1"

    ' Disable DTR
    MSComm1.DTREnable = False

    ' Open the port
    MSComm1.PortOpen = True
    InputLen = 0
    RThreshold = 0

    End Sub
    MSComm1.Output = Chr$(255)
    End Sub

    from the coding the PIC should receive the "255"

    and my PIC PRO Basic coding :

    INCLUDE "modedefs.bas" ' Include serial modes
    DEFINE OSC 4

    si VAR PORTA.4
    loop VAR BYTE

    start:
    SerIn si,T2400,["255"],loop

    IF loop Then led

    led:

    High PORTB.4
    Pause 5000

    GoTo start

    End


    can anyone help me to solve the problem...i really need help..thank you
    Reply With Quote

  2. #2


    Did you find this post helpful? Yes | No

    Default

    VB6 code :
    Private Sub Form_Load()

    ' Use COM1
    MSComm1.CommPort = 1

    ' 2400 baud, no parity, 8 data bits, 1 stop bit
    MSComm1.Settings = "2400,N,8,1"

    ' Disable DTR
    MSComm1.DTREnable = False

    ' Open the port
    MSComm1.PortOpen = True
    InputLen = 0
    RThreshold = 0

    End Sub
    MSComm1.Output = Chr$(255)
    End Sub
    -----------

    Is the mscomm1.output being called by something? From this, it looks like it never gets there. Do you have a button to click to send it? Try adding a command button and:

    sub command1_click() 'turn LED on for 5 seconds
    mscomm1.output=chr$(255) & chr$(1) 'sends (255)(1)


    Try this:

    led var byte

    grabserial:
    serin porta.4,4,[255],led
    if led=1 then 'turn on the led
    high portb.4
    pause 5000 'wait 5 seconds
    low portb.4
    endif
    goto grabserial

    end

    ---------Picster---------

Similar Threads

  1. serial to PIC
    By kindows in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 14th July 2009, 13:58
  2. Replies: 5
    Last Post: - 6th September 2007, 04:59
  3. send data from VB 6 to PIC 16f84
    By win_832001 in forum Serial
    Replies: 2
    Last Post: - 9th March 2006, 14:21
  4. how to send data from VB to PIC 16f84
    By win_832001 in forum Serial
    Replies: 0
    Last Post: - 25th February 2006, 16:15
  5. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50

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