Pemrograman Assembly - MOTOR DC berputar CW dan CCW bergantian
Jumat, 05 Agustus 2016
; ================================================
; Judul: Program Output Motor DC
; Port : Port0 => CONTROL MOTOR DC
; Port1 => -
; Port2 => -
; Port3 => P3.0,P3.1
; Ket : MOTOR DC berputar CW dan CCW bergantian
; ------------------------------------------------
; By : ARC Robotika Club
; ================================================
$MOD51
ORG 0000H
AJMP START
ORG 0100H
MOV P0,#0H
DELAY: MOV R5, #08H
DEL1: MOV R6, #0FFH
DEL2: MOV R7, #0FFH
DJNZ R7, $
DJNZ R6, DEL2
DJNZ R5, DEL1
RET
START:
LOOP:
MOV P0,#0
CALL CW
CALL CCW
SJMP LOOP
END
CW:
CLR P3.0 ; read switch1
CALL DELAY
SETB P0.0
CALL DELAY
CLR P0.0
CALL DELAY
RET
CCW:
CLR P3.1 ; read switch2
CALL DELAY
SETB P0.1
CALL DELAY
CLR P0.1
CALL DELAY
RET
0 komentar
Author
Hestech Indonesia
Innovasi di bidang Teknologi, Listrik, Teknik Komputer dan gaya Hidup. Info lainnya tentang praktik konservasi berbasis Sains, inovasi, dan kearifan lokal