[ ivannet @ 29.06.2005. 09:29 ] @
| Treba da napravim obican program u VisualBasic-u,tj samo 1 taster na principu START/PAUSE i da ga preko RS232 povezem sa pic16f84 tako da na prvi pritisak tastera pic krene sa svojim programom (program se vec nalazi u memoriji) a na drugi da ga pauzira i tako u krug.
Problem je kako u VB da nateram program da posalje signal na RS232 tj na Tx.
Hvala unapred. |
[ vladobk @ 29.06.2005. 16:29 ] @
Ovo ti j e kod iz Vb helpa i ja pomocu njega i AVR mikrokontrolera komuniciranm doduse uz neke modifikacije
MSComm Control Example
The following simple example shows basic serial communications using a modem:
Private Sub Form_Load ()
' Buffer to hold input string
Dim Instring As String
' Use COM1.
MSComm1.CommPort = 1
' 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"
' Tell the control to read entire buffer when Input
' is used.
MSComm1.InputLen = 0
' Open the port.
MSComm1.PortOpen = True
' Send the attention command to the modem.
MSComm1.Output = "ATV1Q0" & Chr$(13) ' Ensure that
' the modem responds with "OK".
' Wait for data to come back to the serial port.
Do
DoEvents
Buffer$ = Buffer$ & MSComm1.Input
Loop Until InStr(Buffer$, "OK" & vbCRLF)
' Read the "OK" response data in the serial port.
' Close the serial port.
MSComm1.PortOpen = False
End Sub
Note The MSComm control can use polling or an event-driven method to retrieve data from the port. This simple example uses the polling method. For an example of the event-driven method, see help for the OnComm event.
[ ivannet @ 14.07.2005. 01:32 ] @
O najzad da se dokopam neta!
Hvala na odgovoru,izvinjavam se sto nisam ranije odovorio ali sam imao MALIH problema sa kompom.
Probacu nesto od ovoga pa cu javiti sta je bilo.
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.