datatom
20.10.2011, 13:41
Hallo zusammen,
ich habe das Problem, dass die vom PC gesendeten Daten erst einige Sekunden verzögert vom Controller wieder zurück kommen.
Ich kann mir das nicht erklären.
Kann mir bitte jemand sagen, was in meinem Bascom-Programm falsch ist?
$prog , 255 , &B11011100 , '&B11011001 , 'Quarz an / Teiler aus / Jtag aus
$regfile = "m2560def.dat"
$hwstack = 82 '80
$framesize = 68 ' 64
$swstack = 68 '44
$crystal = 16000000 'Quarzfrequenz
Config Pind.5 = Output
Led Alias Portd.5
$baud = 19200
Config Com1 = 19200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
Config Com3 = 19200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
Open "com1:" For Binary As #1 'RS232
Open "com3:" For Binary As #3 'RS232
Dim Eingabe As String * 25
Dim Ausgabe As String * 25
Dim String1 As String * 3
Dim String2 As String * 2
Dim I1 As Integer
Dim I2 As Integer
Dim Servo_x1_position As Integer
Dim Servo_y1_position As Integer
Dim Servo_z1_position As Integer
Dim Servonummer As Byte
Dim Servodevice As Byte
Dim Servocommand As Byte
Dim Servogeschwindigkeit As Byte
Config Porth = Output
Out1 Alias Porth.0
Out2 Alias Porth.1
Out3 Alias Porth.2
Out4 Alias Porth.3
Out5 Alias Porth.4
Out6 Alias Porth.5
Out7 Alias Porth.6
Out8 Alias Porth.7
Declare Sub Daten_vom_pc_empfangen()
Declare Sub Daten_zum_pc_senden()
Do
Call Daten_vom_pc_empfangen()
Call Daten_zum_pc_senden()
Loop
End
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
Sub Daten_vom_pc_empfangen()
Input #1 , Eingabe
I1 = 1
I2 = 4
Do
String1 = Mid(eingabe , I1 , 3)
String2 = Mid(eingabe , I2 , 2)
I1 = I1 + 5
I2 = I2 + 5
If String2 = "X1" Then
Servo_x1_position = Val(string1)
End If
If String2 = "Y1" Then
Servo_y1_position = Val(string1)
End If
If String2 = "Z2" Then
Servo_z1_position = Val(string1)
End If
Ausgabe = Ausgabe + String1 + String2
Loop Until I1 >= 50
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
Sub Daten_zum_pc_senden()
Ausgabe = Ausgabe + Chr(13)
Print #1 , Ausgabe
Ausgabe = ""
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
Vielen Dank im Voraus.
Grüße
datatom
ich habe das Problem, dass die vom PC gesendeten Daten erst einige Sekunden verzögert vom Controller wieder zurück kommen.
Ich kann mir das nicht erklären.
Kann mir bitte jemand sagen, was in meinem Bascom-Programm falsch ist?
$prog , 255 , &B11011100 , '&B11011001 , 'Quarz an / Teiler aus / Jtag aus
$regfile = "m2560def.dat"
$hwstack = 82 '80
$framesize = 68 ' 64
$swstack = 68 '44
$crystal = 16000000 'Quarzfrequenz
Config Pind.5 = Output
Led Alias Portd.5
$baud = 19200
Config Com1 = 19200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
Config Com3 = 19200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
Open "com1:" For Binary As #1 'RS232
Open "com3:" For Binary As #3 'RS232
Dim Eingabe As String * 25
Dim Ausgabe As String * 25
Dim String1 As String * 3
Dim String2 As String * 2
Dim I1 As Integer
Dim I2 As Integer
Dim Servo_x1_position As Integer
Dim Servo_y1_position As Integer
Dim Servo_z1_position As Integer
Dim Servonummer As Byte
Dim Servodevice As Byte
Dim Servocommand As Byte
Dim Servogeschwindigkeit As Byte
Config Porth = Output
Out1 Alias Porth.0
Out2 Alias Porth.1
Out3 Alias Porth.2
Out4 Alias Porth.3
Out5 Alias Porth.4
Out6 Alias Porth.5
Out7 Alias Porth.6
Out8 Alias Porth.7
Declare Sub Daten_vom_pc_empfangen()
Declare Sub Daten_zum_pc_senden()
Do
Call Daten_vom_pc_empfangen()
Call Daten_zum_pc_senden()
Loop
End
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
Sub Daten_vom_pc_empfangen()
Input #1 , Eingabe
I1 = 1
I2 = 4
Do
String1 = Mid(eingabe , I1 , 3)
String2 = Mid(eingabe , I2 , 2)
I1 = I1 + 5
I2 = I2 + 5
If String2 = "X1" Then
Servo_x1_position = Val(string1)
End If
If String2 = "Y1" Then
Servo_y1_position = Val(string1)
End If
If String2 = "Z2" Then
Servo_z1_position = Val(string1)
End If
Ausgabe = Ausgabe + String1 + String2
Loop Until I1 >= 50
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
Sub Daten_zum_pc_senden()
Ausgabe = Ausgabe + Chr(13)
Print #1 , Ausgabe
Ausgabe = ""
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
Vielen Dank im Voraus.
Grüße
datatom