Hi,
ich benutze folgenden Code:
Code:
'----------------------------------------------------------------------
' serin_out.bas
' (c) 2002-2005 MCS Electronics
' demonstration of DYNAMIC software UART
'----------------------------------------------------------------------
'tip : Also look at OPEN and CLOSE
$regfile = "m168def.dat"
$framesize = 32
$swstack = 32
$hwstack = 32
$crystal = 16000000
$baud = 9600
'some variables we will use
Dim S As String * 10
'buffer to save data
Dim B As Byte
B = 0
S = Chr(13) + Chr(13) + "Im ready" + Chr(13)
Print S
Ucsr0b = 0 ' DISABLE HW UART
Do
'first get some data via JP1
Serin B , 1 , D , 2 , 38400 , 0 , 8 , 1
'now send it
If B <> 0 Then
Serout B , 1 , D , 1 , 9600 , 0 , 8 , 1
' ^ 1 stop bit
' ^---- 8 data bits
' ^-------- even parity (0=N, 1 = E, 2=O)
' ^------------- baud rate
' ^------------------- pin number
' ^----------------------- port so PORTA.0 and PORTA.1 are used
' ^--------------------------- for strings pass 0
' ^-------------------------------- variable
End If
Waitms 1
Loop
End
'because the baud rate is passed with a variable in theis example, you could change it under user control
'for example check some DIP switches and change the variable mybaud
Aber bis auf die 10 13 am Ende jeder Zeile bekomme ich nur "Müll" angezeigt....
Die Baudraten kann ich ja nicht gleich machen, da Minicontrol und Router unterschiedliche Raten benutzen...
MfG
Scarabol
Lesezeichen