Hallo zusammen,
ich sende in einem Programm ständig Daten vom PC zum Controller und
wieder ständig zurück. Das Senden vom PC zum Controller klappt
wunderbar. Die Daten kommen auf dem Controller an und werden 1:1 zurück
zum PC geschickt. Es kommen auch Daten am PC an, allerdings nicht in der
richtigen Länge. z.B.: Ich sende den Wert "327LX" vom PC zum Controller.
Nun erhalte ich den Wert "LX327L" zurück.
Das senden vom Controller zum PC erfolgt in der do-Schleife, also
ständig. Ich kann den vom Controller gesendeten Wert nicht exakt auf dem
PC greifen.
Die Länge des zu sendenden Wertes ist variabel zwischen 1 und 8 Zeichen
lang.
Controller-Programm:
1 | $prog , 255 , &B11011100 , '&B11011001 , 'Quarz an / Teiler aus / Jtag aus
|
2 | $regfile = "m2560def.dat"
|
3 | $hwstack = 82 '80
|
4 | $framesize = 68 ' 64
|
5 | $swstack = 68 '44
|
6 | $crystal = 16000000 'Quarzfrequenz
|
7 | Config Pind.5 = Output
|
8 | Led Alias Portd.5
|
9 | $baud = 19200
|
10 |
|
11 |
|
12 | 'Config Com1 = 19200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
|
13 | 'Config Com2 = 38400 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
|
14 | Config Com3 = 19200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
|
15 | 'Config Com4 = 38400 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
|
16 | 'Open "com1:" For Binary As #1 'RS232
|
17 | 'Open "com2:" For Binary As #2 'RS232
|
18 | Open "com3:" For Binary As #3 'RS232
|
19 | 'Open "com4:" For Binary As #4 'RS232
|
20 |
|
21 |
|
22 | 'Dim Eingabe As Byte
|
23 | Dim Eingabe As String * 10
|
24 | Dim Ausgabe As String * 10
|
25 |
|
26 |
|
27 | Config Porth = Output
|
28 | Out1 Alias Porth.0
|
29 | Out2 Alias Porth.1
|
30 | Out3 Alias Porth.2
|
31 | Out4 Alias Porth.3
|
32 | Out5 Alias Porth.4
|
33 | Out6 Alias Porth.5
|
34 | Out7 Alias Porth.6
|
35 | Out8 Alias Porth.7
|
36 |
|
37 |
|
38 | Led = 0
|
39 |
|
40 | Do
|
41 |
|
42 | Input Eingabe
|
43 |
|
44 | Print Eingabe
|
45 |
|
46 | Led = 0
|
47 | Waitms 10
|
48 | Led = 1
|
49 | Waitms 10
|
50 | Led = 0
|
51 | Waitms 10
|
52 | Led = 1
|
53 | Waitms 10
|
54 | Led = 0
|
55 | Waitms 10
|
56 | Led = 1
|
57 | Waitms 10
|
58 | Led = 0
|
59 | Waitms 10
|
60 | Led = 1
|
61 | Waitms 10
|
62 | Led = 0
|
63 | Waitms 10
|
64 | Led = 1
|
65 | Waitms 10
|
66 | Led = 0
|
67 | Waitms 10
|
68 | Led = 1
|
69 | Waitms 10
|
70 |
|
71 | Loop
|
72 |
|
73 | End
|
Hat jemand eine Idee woran das liegt?
Vielen Dank und Grüße
datatom