no big solution... it's working here using
on the PICSideCode:Private Sub Form_Load() Option1(0).Value = True MSComm1.CommPort = 1 MSComm1.Settings = "2400,n,8,1" MSComm1.DTREnable = False MSComm1.RThreshold = 1 MSComm1.InputLen = 1 MSComm1.PortOpen = True End Sub Private Sub Command1_Click() Dim pinstate As Byte If Option1(0).Value = True Then pinstate = 1 Else pinstate = 0 End If MSComm1.Output = Chr(255) & Chr(pinstate) End Sub Private Sub form_unload(Cancel As Integer) MSComm1.PortOpen = False End Sub
sorry, try a lower resistor value and be sure you share the same ground, be sure you place 0.1 uF cap close to your PIC and be sure of your crystal speed and capacitor value.Code:INCLUDE "modedefs.bas" Si VAR PORTA.4 RELAY VAR PORTB.2 pinstate VAR BYTE main: SerIn Si,n2400,[255],pinstate IF pinstate=1 Then GoSub Relayon Else GoSub Relayoff EndIF goto main Relayon: High RELAY Return Relayoff: Low RELAY Return
Schu4647 have also point an interesting fact... be sure it's not the relay who create the bug.




Bookmarks