PDA

View Full Version : how to send data from VB to PIC 16f84



win_832001
- 25th February 2006, 17:15
hello there..
here i need help ..
i'm trying to send serial data to the PIC16f84 through VB6..i try to send 255 to the PIC. after the PIC receive the data from the vb,PIC will send the PWM to run the servo motor..how can i program the VB6 and the PIC 16f84..

before this i've try this to activate the LED but it doesn't work :
INCLUDE "modedefs.bas"

si VAR PORTA.4
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 si,T2400,["255"],PinState

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

' Set The pin low
GoLow:
Low PORTB.4
Pause 1000

' Set the pin high
GoHigh:
High PORTB.4
Pause 1000
GoTo Main