win_832001
Newbie level 3
hello.. i need help here...i'm trying to send the data using VB 6 to the PIC 16f84 through MScomm command...I've try to 'on' the LED at output...can anyone check my PIC program and my vb6 code..
PIC code:
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
vb 6 code:
Private Sub cmdsend_Click()
Dim PinState As Byte
' Get Pin State
If optState(0).Value = True Then
PinState = 0
Else
PinState = 1
End If
' Send Out Data
MSComm1.Output = Chr$(255)
End Sub
Private Sub Form_Load()
Dim Pins As Long
' Default to optState(0) being selected
optState(0).Value = True
' 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
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub
i'm very need help here...tq
PIC code:
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
vb 6 code:
Private Sub cmdsend_Click()
Dim PinState As Byte
' Get Pin State
If optState(0).Value = True Then
PinState = 0
Else
PinState = 1
End If
' Send Out Data
MSComm1.Output = Chr$(255)
End Sub
Private Sub Form_Load()
Dim Pins As Long
' Default to optState(0) being selected
optState(0).Value = True
' 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
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub
i'm very need help here...tq