Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/21/03 01:25
Read: times


 
#52984 - RE: VB User Interface
Responding to: ???'s previous message
Dear raghu & Andy,

Thanks

The program which I am using to send the data to MCU is :
Option Explicit

Private Sub cmdSend_Click()
Dim PinNumber As Long
Dim PinState As Long
Dim PortNumber As Long
' Get Pin Number
PinNumber = cboPinNumber.ListIndex
' Get Port Number
PortNumber =cboPortNumber.List Index
' Get Pin State
If optState(0).Value = True Then
PinState = 0
Else
PinState = 1
End If

' Send Out Data
MSComm1.Output = Chr$(255) & Chr$(PinNumber) & Chr$(PinState)& Chr$(PortNumber)

End Sub

Private Sub Form_Load()
Dim Pins As Long

' Add the pin numbers 0 to 40 to cboPinNumber
For Pins = 0 To 40
cboPinNumber.AddItem CStr(Pins)
Next Pins

' Default to Pin 0 being selected
cboPinNumber.ListIndex = 0

' Default to optState(0) being selected
optState(0).Value = True

' Use COM1
MSComm1.CommPort = 1

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

' Open the port
MSComm1.PortOpen = True

End Sub


Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub


-Please check the code.At present, I ve programmed the MCU as P1 input port and P2 outport.I m doing it for learning purpose, I ve no plans to for parallel inputting data.Can I switch on the LED directly by sending the command to particular port pin
for instance Port 2 pin No. 0


Regards

Harnam

List of 13 messages in thread
TopicAuthorDate
VB User Interface            01/01/70 00:00      
   RE: VB User Interface            01/01/70 00:00      
   RE: VB User Interface            01/01/70 00:00      
      RE: VB User Interface            01/01/70 00:00      
         RE: VB User Interface            01/01/70 00:00      
   RE: VB User Interface            01/01/70 00:00      
      RE: VB User Interface            01/01/70 00:00      
         RE: VB User Interface            01/01/70 00:00      
         RE: VB User Interface            01/01/70 00:00      
            RE: VB User Interface            01/01/70 00:00      
               RE: VB User Interface            01/01/70 00:00      
                  RE: VB User Interface            01/01/70 00:00      
               RE: VB User Interface            01/01/70 00:00      

Back to Subject List