Hi guys,
For the past few weeks I have been playing with Visual Basic 6 and attempting to get it talking to my picaxe 08M chip. I have found a few tutorials online that are not exactly for this chip but I can follow and understand how they work (at least i think so). My goal that I am trying to achieve is a simple off and on LED switch via VB6. I have tried tweaking my code many times and going through various tutorials but I have had no success. Here is how i have been setting up.
I have the standard programing cable plugged in with the serial output of the cable going to pin 4 of my picaxe.
I have an LED hooked up to Pin 1 (this is the LED that I am trying to blink on and off)
After reading the manual I have come to understand that SERIN is the command to use on the picaxe end to listen for serial input.
Here is my picaxe code.
-----------------------------------------------------------------------
main:
serin 4,N2400,b1
if b1 = 0 then ahigh
if b1 = 1 then alow
goto main
ahigh:
high 1
goto main
alow:
low 1
goto main
---------------------------------------------------------------------
And this is the Visual Basic 6 code: (I have 2 buttons set up, one to send a "0" for off and the other to send "1" for on)
----------------------------------------------------------------------
Option Explicit
Private Sub Command1_Click()
MSComm1.Output = Chr$(0)
End Sub
Private Sub Command2_Click()
MSComm1.Output = Chr$(1)
End Sub
Private Sub Form_Load()
MSComm1.CommPort = 10
' 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
End Sub
----------------------------------------------------------------------
As far as this project goes for me, i have been trying for a few weeks now and I feel I am not getting anywhere. Not looking for a easy way out but more so someone to show me where I am going wrong as there must be something I am missing.
Thanks for the help guys :)