ehsanelahimirza
Full Member level 6
- Joined
- Feb 24, 2006
- Messages
- 334
- Helped
- 28
- Reputation
- 56
- Reaction score
- 7
- Trophy points
- 1,298
- Activity points
- 3,570
Open FileName for append as #1
Print #1,Time, Date
close #1
Main:
IF GPIO.0 = 0 THEN GOTO Main 'monitor pin if it go high then send data
SEROUT GPIO.1,N2400,["Q", "Relay triggered"]
GOTO Main 'loop to label Main forever
END
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
' Handle each event or error by placing
' code below each case statement
' Errors
Case comEventBreak ' A Break was received.
Case comEventFrame ' Framing Error
Case comEventOverrun ' Data Lost.
Case comEventRxOver ' Receive buffer overflow.
Case comEventRxParity ' Parity Error.
Case comEventTxFull ' Transmit buffer full.
Case comEventDCB ' Unexpected error retrieving DCB]
' Events
Case comEvCD ' Change in the CD line.
Case comEvCTS ' Change in the CTS line.
Case comEvDSR ' Change in the DSR line.
Case comEvRing ' Change in the Ring Indicator.
Case comEvReceive ' Received RThreshold # of
' chars.
Dim Chain As String
Dim ChainASCII As String
Dim Character As String
Dim CodeCharacter As Integer
Dim Dummy As String
Dim Letter As String
Dim Counter As Integer
'Form1.MSComm1.Output = "SSA" 'stuur Acn
If (Form1.MSComm1.InBufferCount > 0) Then
Chain = Form1.MSComm1.Input ' +
Text1.Text = Chain
Text1.SelStart = Len(Chain)
ChainASCII = ""
For Counter = 1 To Len(Chain)
Character = Mid(Chain, Counter, 1)
CodeCharacter = Asc(Character)
Letter = Hex(CodeCharacter)
ChainASCII = ChainASCII + Letter
Next Counter
KeyCode = Right(ChainASCII, 11)
Gate = Left(ChainASCII, 1)
If Left(KeyCode, 1) > 0 Then KeyCode = 0 & Right(KeyCode, 10)
End If
Form1.MSComm1.Output = "SSA"
If (Form1.MSComm1.InBufferCount <> 8) Then
Form1.MSComm1.InputLen = 0
Dummy = Form1.MSComm1.Input
Form1.MSComm1.InputLen = 8
End If
Case comEvSend ' There are SThreshold number of
' characters in the transmit
' buffer.
Case comEvEOF ' An EOF charater was found in
' the input stream
End Select
End Sub
That is easy!avr is enough for you!pasicr said:Hi for all,
Anybody has idea for this,
one relay is activated with some signal for electronic door,
I need hardware + software for counting (in real time) any click on rele, with report like date and time of activation,
with possibility to connect on PC and get report in any format, txt, excel...
regards
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?