Habs jetzt mal so probiert
Private Sub Sleep(ByVal tau As Long)
t = Timer
Do
DoEvents
Loop Until Timer - t > tau
End Sub
Private Sub Command1_Click()
5 Rem Software Robomemm rev B
6 Rem change 18 To rbit=abit For rev A
7 Rem change 540 To abit For rev A
8 Rem change 560 To <> For rev A
10 Port = &H378
11 sport = &H379
12 cport = &H37A
13 ibit = &H4
14 sbit = &H1
15 bbit = &H80
16 abit = &H40
17 sbith = &HFE
18 rbit = bbit
19 Dim resp(64)
20 Goto 2000
50 For k = 0 To 63
100 a = Inp(cport)
110 Out cport, (a Or ibit) And sbith
120 GoSub 6000
130 For j = 1 To 8
140 GoSub 7000
160 Next
170 GoSub 6000
180 GoSub 8000
200 GoSub 7000
300 Index = &H20
310 If (k And Index) = 0 Then Goto 400
320 GoSub 8000
350 Goto 420
400 GoSub 7000
420 Index = Index \ 2
430 If Index <> 0 Then Goto 310
450 response = 0
500 For Index = 0 To 15
510 GoSub 7000
530 response = response * 2
540 Status = (Inp(sport) And rbit)
560 If Status = 0 Then Goto 600
570 response = response + 1
600 Next
604 resp(k) = response
610 Next
620 For k = 0 To 63
625 Print Chr$(resp(k) - ((resp(k) \ 256) * 256));
630 Print Chr$(resp(k) \ 256);
660 Next
670 Print
700 Return
1000 a = Inp(cport)
1010 Out cport, (a Or ibit) And sbith
1020 GoSub 6000
1030 GoSub 7000
1050 GoSub 7000
1070 GoSub 8000
1090 GoSub 8000
1110 For j = 1 To 15
1120 GoSub 7000
1140 Next
1200 For k = 0 To 63
1210 GoSub 6000
1220 GoSub 7000
1240 GoSub 8000
1260 Index = &H20
1270 If (k And Index) = 0 Then Goto 1310
1280 GoSub 8000
1300 Goto 1330
1310 GoSub 7000
1330 Index = Index \ 2
1340 If Index <> 0 Then Goto 1270
1350 Index = 32768
1360 If (resp(k) And Index) = 0 Then Goto 1400
1370 GoSub 8000
1390 Goto 1430
1400 GoSub 7000
1430 Index = Index \ 2
1440 If Index <> 0 Then Goto 1360
1450 Out Port, &HFF
1460 Sleep 1
1470 Next
1500 Return
2000 Print "Bust a memmory options"
2010 Print "read = 0"
2020 Print "write = 1"
2025 Print "stop = 2"
2030 a = Val(InputBox("", "", ""))
2040 If a = 0 Then Goto 2100
2050 If a = 1 Then Goto 2200
2060 If a = 2 Then Goto 2300
2070 Goto 2000
2100 GoSub 50
2110 Goto 2000
2200 GoSub 1000
2210 Goto 2000
2300 Stop
6000 Out Port, &HFF
'clock high data high select off
6010 Out Port, &HFC
'clock low data low select off
6020 Out Port, &H5C
'select on
6030 Out Port, &H5D
'clock high data low
6040 Out Port, &H5E
'clock low data high
6050 Out Port, &H5F
'clock high data high
6060 Return
7000 Out Port, &H5C
'clock low data low
7010 Out Port, &H5D
'clock high data low
7020 Return
8000 Out Port, &H5E
'clock low data high
8010 Out Port, &H5F
'clock high data high
8020 Return
End SubHabe aber ein richtiges Problem. Bei eurer Lösung bekomme ich andere Werte als mit meiner Version. Ich weis aber nicht , was die richtigen Werte sind |