Witam.
Tak patrzę na ten kit AVT-896 to może on się jednak nada...
Tylko zamiast tego ULN2803 dać jakieś tranzystory mocy, żeby zwiększyć możliwą obciążalność. Ew. w mojej maszynie mógłbym zmienić śrubę M8 na M5.Tylko największy problem...w tym układzie karkasem obraca krokowiec, a w mojej maszynie by to nie przeszło ze względu na to, że zamierzam nawijać trafka do urządzeń lampowych i czasami jest tam gruby drut.Chciałbym zastosować na napęd silnik od wycieraczek malucha.Jest bardzo silny i kręci się 50-60 rpm(ze względu na przekładnię ślimakową)
Daje program da nawijarki AVT i może koledzy podpowiedzą co trzeba by zmienić.
źródło kodu:
http://www.elektroda.pl/rtvforum/topic1192665.html
(ten drugi poprawny)
$crystal = 11059200
'$large
Config Sda = P3.1
Config Scl = P3.0
Config Lcd = 16 * 1a
Cursor Off
I2csend 112 , 0
Dim R As Byte
Dim Directionflag As Bit
Dim Layers As Byte
Dim Layer As Word
Dim Diameter As Byte
Dim Motor1 As Byte
Dim Turns As Long
Dim Turning As Long
Dim Motor2 As Byte
Dim Layercount As Word
Declare Sub 1 Turn
Declare Sub Programowanie
Declare Sub Work
Declare Sub Wybor
Declare Sub Motor2_right
Declare Sub Motor2_left
S1 Alias P3.7
S2 Alias P3.5
S3 Alias P3.4
S4 Alias P3.3
Cls
Locate 1 , 4
Lcd "AVT-896"
Wait 3
Cls
Lcd "Programowanie"
Wait 2
Cls
Turns = 100
Diameter = 10
Layer = 10
Sub Programowanie
Cls
Lcd "Zwoje:" ;
Do
Locate 1 , 11
Lcd " "
Locate 1 , 11
Lcd Turns
Waitms 250
Set S1
If S1 = 0 Then
Incr Turns
End If
Set S2
If S2 = 0 Then
Decr Turns
If Turns = 5 Then
Turns = 6
End If
End If
Set S4
If S4 = 0 Then
Exit Do
End If
Loop
Cls
Lcd "Warstwa:" ;
Do
Locate 1 , 11
Lcd " "
Locate 1 , 11
Lcd Layer
Waitms 250
Set S1
If S1 = 0 Then
Incr Layer
End If
Set S2
If S2 = 0 Then
Decr Layer
If Layer = 5 Then
Layer = 6
End If
End If
Set S4
If S4 = 0 Then
Exit Do
End If
Loop
Cls
Lcd "Srednica: 0," ;
Waitms 250
Do
Locate 1 , 13
Lcd " "
Locate 1 , 13
Lcd Diameter ; "mm"
Waitms 250
Set S1
If S1 = 0 Then
Incr Diameter
If Diameter = 101 Then
Diameter = 100
End If
End If
Set S2
If S2 = 0 Then
Decr Diameter
If Diameter = 0 Then
Diameter = 1
End If
End If
Set S4
If S4 = 0 Then
Exit Do
End If
Loop
Call Wybor
End Sub
Sub Work
Cls
Directionflag = 0
Layercount = 0
Motor2 = 8
Lcd "Working..";
For Turning = 1 To Turns
Locate 1 , 12
Lcd Turning
Call 1turn
Incr Layercount
If Layercount = Layer Then
Directionflag = Not Directionflag
Layercount = 0
End If
Set S4
If S4 = 0 Then
Call Wybor
End If
Next R
I2csend 112 , 0
Call Wybor
End Sub
Sub Wybor
Cls
Lcd "GO- S4, Prg.- S3"
Waitms 250
Do
Set S4 : Set S3
If S3 = 0 Then
Call Programowanie
End If
If S4 = 0 Then
Call Work
End If
Loop
End Sub
Sub 1turn
Motor1 = 128
For R = 1 To 100
I2csend 112 , Motor1
Waitms 7
Shift Motor1 , Right , 1
If Motor1 = 8 Then
Motor1 = 128
End If
Next R
If Directionflag = 0 Then
Call Motor2_right
Else
Call Motor2_left
End If
End Sub
Sub Motor2_left
For R = 1 To Diameter
I2csend 112 , Motor2
Waitms 7
Shift Motor2 , Right , 1
If Motor2 = 0 Then
Motor2 = 8
End If
Next R
End Sub
Sub Motor2_right
For R = 1 To Diameter
I2csend 112 , Motor2
Waitms 7
Shift Motor2 , Left , 1
If Motor2 = 16 Then
Motor2 = 1
End If
Next R
End Sub