yonni’s electronics repairer

Electronics service repairer just for living

Program sequence injection moulding machine

Posted by yonni1967 on January 28, 2009

Berikut listing program bascom AVR untuk injection moulding machine yang telah saya buat.
Ternyata enak ya pakai compiler Basic ini? Memprogram jadi menyenangkan dan semakin ingin lebih mendalam dibanding bahasa ‘C’ atau Asembler yang mbulet.
silakan coba!…$$$$$

Berikut listingnya :

‘———Program aplikasi sekuensi injection moulding machine——‘
‘Dibuat oleh : Yonni Muhazir
‘Nim : 0510450391/E
‘Fakultas teknik / elektronika
‘Uwiga Malang, January 2009
‘———————————————————————‘

$regfile = “m8535.dat”
$crystal = 4000000
$baud = 9600

Dim Automatis As Bit , Y1 As Bit , Ls_close As Bit ‘Y1 adalah coil mold closing– output portb.0/ y1 ‘
Config Porta = Input
Set Porta.0
Port A.0 Alias Automatis
Port A.1 Alias Ls_close ‘automatis tombol start automatis–input porta.0’
Config Portb = Output
Set Portb.0
Portb.0 Alias Y1

Do

If Automatis = 1 Then
Y1 = 1
Else
If Ls_close = 1 Then ‘ls_close adalah stop closing–input port : input porta.1’
Y1 = 0
End If
End If

Dim Ls_clamping As Bit , Y2 As Bit ‘y2 adalah yoke clamping–portb.1’
Set Porta.2
Porta.2 Alias Ls_clamping ‘ls_clamping ;input porta.2
Set Portb.1 Alias Y2
Port A.2 Alias Ls_clamping
If Ls_clamping = 1 Then
Y2 = 1
Else
Waitms 100
Print “timer clamping” ‘timer generation clamping
End If

Dim , Y3 As Bit , Ls_iu_stop As Bit ‘y3=yoke IU maju–output portb.2’,
Set Porta.3
Porta.3 Alias Ls_iu_stop ‘Ls IU maju stop– input porta.3
Set Portb.2
Portb.2 Alias Y3
If Y2 = 0 Then
Y3 = 1
Else
If Ls_iu_stop = 1 Then
Y3 = 0
End If
End If

Dim Y4 As Bit , Ls_inj_end As Bit
Set Porta.4 ‘ls_inj_end = input porta.4,
Porta.4 Alias Ls_inj_end ‘y4=yoke injection-output portb.4’
Set Portb.4
Portb.4 Alias Injection Yoke
If Y3 = 0 Then
Y4 = 1
Else
Waitms 200 ‘timer injection berjalan 500ms’
Print “timer injection on”
If Ls_inj_end = 1 Then
Y4 = 0
End If
End If

Dim Plasticizing As Bit , Ls_plast As Bit , Decomp As Bit , Ls_decomp As Bit , Cooling As Bit
Set Portb.5
Portb.5 Alias Plasticizing ‘y5 =plasticizing – output portb.5’
Set Porta.5
Porta.5 Alias Ls_plast ‘ ls_stop plasticizing – input porta.5’
Set Portb.6
Portb.6 Alias Decomp ‘ y6-decompression : output portb.6
Set Porta.6
Porta.6 Alias Ls_decomp ‘ ls decompression stop ; input port a.6

If Y4 = 0 Then
Plasticizing = 1 ‘ saat plasticizing,
Else
If Ls_plast = 1 Then ‘ plasticizing berhenti
Plasticizing = 0
Else
If Ls_plast = 1 Then

Else
If Plasticizing = 0 Then
Decomp = 1

Else
If Ls_plast = 1 Then ‘mundurkan decompresi’
Decomp = 0

End
End If
End If
End If
End If
End If

Waitms 300 ‘ cooling time berjalan’
Print ” cooling time runing”

Dim Iu_ret As Bit , Ls_iu_ret_stop As Bit , Mold_opn As Bit , Ls_opn_stp As Bit

Set Portb.7
Portb.7 Alias Iu_ret ‘yoke injection unit mundur output portb.7’
Set Porta.7
Porta.7 Alias Ls_iu_ret_stop ‘ls IU stop mundur input porta.7’

Config Portc = Output ‘konfigurasi pin port c sebagai output’
Config Portd = Input ‘konfigurasi portd sebagai input’

Set Portc.0
Portc.0 Alias Mold_opn ‘yoke mold open–output portc.0’
Set Portd.0
Portd.0 Alias Ls_opn_stop ‘ls_open stop mold–input portd.0

If Decomp = 0 Then
Iu_ret = 1 ‘injection unit mundur
Else
If Ls_iu_ret_stop = 1 Then
Mold_opn = 1 ‘mould membuka penuh sampai ls stop tertekan’
Else
If Ls_opn_stp = 1 Then
Mold_opn = 0
End If
End If
End If

Dim Eject_maju As Bit , Eject_mundur As Bit , Ls_eject_maju As Bit , Ls_eject_mundur As Bit
Dim Multi_eject As Integer
Set Portc.1
Portc.1 Alias Eject_maju ‘portc.1 = eject maju – output portc.1’
Set Portd.1
Portd.1 Alias Ls_eject_maju ‘ls_eject maju = input portd.1
Set Portc.2
Portc.2 Alias Eject_mundur ‘ yoke eject_mundur = output_eject_mundur = output portd.2
Set Portd.2
Portd.2 Alias Ls_eject_mundur ‘ ls_stop_eject_mundur = input portd.2

For Multi_eject = 147 To 157 Step 3 ‘perintah multi eject/maju-mundur 3 step’

If Ls_opn_stp = 1 Then
Eject_maju = 1 ‘ejector maju sampai ls stop,
Else
If Ls_eject_maju = 1 Then
Eject_maju = 0
Else
If Ls_eject_maju = 1 Then
Eject_mundur = 1 ‘ejector mundur’
Else
If Ls_eject_mundur = 1 Then
Eject_mundur = 0
End If
End If
End If
End If
Next

Print “Pause_time”
Waitms 340

Loop ‘perintah kembali ke program awal—begitu seterusnya’

End ‘end program’———Program aplikasi sekuensi injection moulding machine——‘
‘Dibuat oleh : Yonni Muhazir
‘Nim : 0510450391/E
‘Fakultas teknik / elektronika
‘Uwiga January Malang 2009
‘———————————————————————‘

$regfile = “m8535.dat”
$crystal = 4000000
$baud = 9600

Dim Automatis As Bit , Y1 As Bit , Ls_close As Bit ‘Y1 adalah coil mold closing– output portb.0/ y1 ‘
Config Porta = Input
Set Porta.0
Port A.0 Alias Automatis
Port A.1 Alias Ls_close ‘automatis tombol start automatis–input porta.0’
Config Portb = Output
Set Portb.0
Portb.0 Alias Y1
If Automatis = 1 Then
Y1 = 1
Else
If Ls_close = 1 Then ‘ls_close adalah stop closing–input port : input porta.1’
Y1 = 0
End If
End If

Dim Ls_clamping As Bit , Y2 As Bit ‘y2 adalah yoke clamping–portb.1’
Set Porta.2
Porta.2 Alias Ls_clamping ‘ls_clamping ;input porta.2
Set Portb.1 Alias Y2
Port A.2 Alias Ls_clamping
If Ls_clamping = 1 Then
Y2 = 1
Else
Waitms 100
Print “timer clamping” ‘timer generation clamping
End If

Dim , Y3 As Bit , Ls_iu_stop As Bit ‘y3=yoke IU maju–output portb.2’,
Set Porta.3
Porta.3 Alias Ls_iu_stop ‘Ls IU maju stop– input porta.3
Set Portb.2
Portb.2 Alias Y3
If Y2 = 0 Then
Y3 = 1
Else
If Ls_iu_stop = 1 Then
Y3 = 0
End If
End If

Dim Y4 As Bit , Ls_inj_end As Bit
Set Porta.4 ‘ls_inj_end = input porta.4,
Porta.4 Alias Ls_inj_end ‘y4=yoke injection-output portb.4’
Set Portb.4
Portb.4 Alias Injection Yoke
If Y3 = 0 Then
Y4 = 1
Else
Waitms 200 ‘timer injection berjalan 500ms’
Print “timer injection on”
If Ls_inj_end = 1 Then
Y4 = 0
End If
End If

Dim Plasticizing As Bit , Ls_plast As Bit , Decomp As Bit , Ls_decomp As Bit , Cooling As Bit
Set Portb.5
Portb.5 Alias Plasticizing ‘y5 =plasticizing – output portb.5’
Set Porta.5
Porta.5 Alias Ls_plast ‘ ls_stop plasticizing – input porta.5’
Set Portb.6
Portb.6 Alias Decomp ‘ y6-decompression : output portb.6
Set Porta.6
Porta.6 Alias Ls_decomp ‘ ls decompression stop ; input port a.6

If Y4 = 0 Then
Plasticizing = 1 ‘ saat plasticizing,
Else
If Ls_plast = 1 Then ‘ plasticizing berhenti
Plasticizing = 0
Else
If Ls_plast = 1 Then

Else
If Plasticizing = 0 Then
Decomp = 1

Else
If Ls_plast = 1 Then ‘mundurkan decompresi’
Decomp = 0

End
End If
End If
End If
End If
End If

Waitms 300 ‘ cooling time berjalan’
Print ” cooling time runing”

Dim Iu_ret As Bit , Ls_iu_ret_stop As Bit , Mold_opn As Bit , Ls_opn_stp As Bit

Set Portb.7
Portb.7 Alias Iu_ret ‘yoke injection unit mundur output portb.7’
Set Porta.7
Porta.7 Alias Ls_iu_ret_stop ‘ls IU stop mundur input porta.7’

Config Portc = Output ‘konfigurasi pin port c sebagai output’
Config Portd = Input ‘konfigurasi portd sebagai input’

Set Portc.0
Portc.0 Alias Mold_opn ‘yoke mold open–output portc.0’
Set Portd.0
Portd.0 Alias Ls_opn_stop ‘ls_open stop mold–input portd.0

If Decomp = 0 Then
Iu_ret = 1 ‘injection unit mundur
Else
If Ls_iu_ret_stop = 1 Then
Mold_opn = 1 ‘mould membuka penuh sampai ls stop tertekan’
Else
If Ls_opn_stp = 1 Then
Mold_opn = 0
End If
End If
End If

Dim Eject_maju As Bit , Eject_mundur As Bit , Ls_eject_maju As Bit , Ls_eject_mundur As Bit

Set Portc.1
Portc.1 Alias Eject_maju ‘portc.1 = eject maju – output portc.1’
Set Portd.1
Portd.1 Alias Ls_eject_maju ‘ls_eject maju = input portd.1
Set Portc.2
Portc.2 Alias Eject_mundur ‘ yoke eject_mundur = output_eject_mundur = output portd.2
Set Portd.2
Portd.2 Alias Ls_eject_mundur ‘ ls_stop_eject_mundur = input portd.2

If Ls_opn_stp = 1 Then
Eject_maju = 1
Else
If Ls_eject_maju = 1 Then
Eject_maju = 0
Else
If Ls_eject_maju = 1 Then
Eject_mundur = 1
Else
If Ls_eject_mundur = 1 Then
Eject_mundur = 0
End If
End If
End If
End If

Print “Pause_time”
Waitms 340

Goto 20
End

End ‘end program

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: