Cara komunikasi remot MP3 Dengan Mikro MCS51


Assalamu’alaikum wrwb

Untuk Beli Produk Silahkan Kunjungi WWW.BELJAMOTOMATIS.COM

Pertama kali untuk mengkoneksi kan remot hitam biasanya dipakai pada MP3 player dengan mikrokontroler, ada 2 jenis remotnya warna hitam dan putih. yang membedakan data hex dari setiap penekanan tombol pada remot itu sendiri. Alat yang perlu disiapkan untuk mengkoneksikan remot ini adalah.

  1. Sismin mikrokontroler mcs51
  2. Maaf belum sempat gambar rangkaiaannya, hardwarenya standar sistem minimum mcs 51, koneksikan output sensor ke port 3.3 mikrokontroler, tegangan suplai 5 volt, dan kristal harus pakai 12 MHz.
  3. Sensor penerima remot

tsop17xx pinout diagram

4.remot hitam atau putih

125054_4dca2780-7f35-11e4-b0c5-92902523fab8

Berikut ini adalah kode hex remot hitam dan putih remot MP3 player di pasaran

;=====================================================================
; REMOT NEC PUTIH
; TOMBOL KODE ASCII OUTPUT
;=====================================================================
; POWER =12H a
; MODE =1AH b
; MUTE =1EH c
; PLAY/PAUSE =01H d
; PEV =02H e
; NEXT =03H f
; EQ =04H g
; VOL- =05H h
; VOL+ =06H i
; 0 =07H 0
; RPT =08H j
; USD =09H k
; 1 =0AH 1
; 2 =1BH 2
; 3 =1FH 3
; 4 =0CH 4
; 5 =0DH 5
; 6 =0EH 6
; 7 =00H 7
; 8 =0FH 8
; 9 =19H 9
;=====================================================================
;=====================================================================
; REMOT NEC HITAM
; TOMBOL KODE ASCII OUTPUT
;=====================================================================
; CH- =45H a
; MODE =46H b
; CH+ =47H c
; PEV =44H d
; NEXT =40H e
; PLAY/PAUSE =43H f
; VOL- =07H g
; VOL+ =15H h
; EQ =09H i
; 0 =16H 0
; 100+ =19H j
; REPET =0DH k
; 1 =0CH 1
; 2 =18H 2
; 3 =5EH 3
; 4 =08H 4
; 5 =1CH 5
; 6 =5AH 6
; 7 =42H 7
; 8 =52H 8
; 9 =4AH 9
;=====================================================================

Ini Listing Programnya

;=============================================================
; Program DEMO HIR04 dengan menggunakan
; Remote control NEC sebagai
; penghasil kode pulsa.
; kode asli remote delehke neng kode alamat 21h
; X-TAL = 12.000.000 Hz
; hasil di hubungkan ke port serial
; editing by anung 25/05/2015

; Output sensor remot pada port 3.3 mikrokontroler

;Vcc 5 volt
;=============================================================
head bit 20h.0
data_r bit 20h.1
finish bit 20h.2
kode Equ 21h
counter Equ 22h
; —————————————————
Org 0h
jmp MulaiO
;
Org 0Bh
Clr TR0 ; stop Timer/Counter 0
clr head
clr data_r
Reti
Org 13h
;*************************************
; routine interupt IR receiver module
;*************************************
Remote: clr TR0
clr EA
jb head,pulsa_kedua_dst
setb head
mov TH0,#0
mov TL0,#0
setb EA
Setb TR0 ; start timer/counter 1
Reti
;***************************************
; Routine untuk terjemahkan remote NEC
;***************************************
pulsa_kedua_dst:
push ACC
push PSW
jb data_r,data_remote
Mov A,TH0
cjne A,#33h,n1 ;13056us F=12.000.000/12=1.000.000HZ (T=1US)
setb data_r
mov counter,#32
sjmp terus
n1: cjne A,#34H,n2 ;13312us
setb data_r
mov counter,#32
sjmp terus
n2: cjne A,#35H,not_ok1 ;13568us
setb data_r
mov counter,#32
sjmp terus
Not_OK1:
clr head
clr data_r
Terus: mov TH0,#0
mov TL0,#0
pop PSW
pop ACC
setb EA
setb TR0 ; start timer/counter 1
Reti
;*******************************************************************************
; DATA REMOTE 8 BIT DI JUPUK MBURI DEWE SEKO 32 BIT
;*******************************************************************************
data_remote:
mov A,TH0
cjne A,#8,rem0
clr c
sjmp rem1tt
rem0: cjne A,#9,rem1
clr c
sjmp rem1tt
rem1: cjne A,#3,rem3
setb c
sjmp rem1tt
rem3: cjne A,#4,salah
setb c
rem1tt: mov A,kode
Rrc A
mov kode,A
djnz counter,terus
setb finish
salah:
clr head
clr data_r
sjmp terus
;**********************************************************************************
; START PROGRAM
;**********************************************************************************
mulaio: mov SP,#30H
mov TCON,#0
setb TR0
mov TMOD,#29h ; 2= timer 1 untuk serial mode 2 ,// 9= timer0 untuk menghitung lebar pulsa IR
mov scon,#50H ; serial mode 1
mov th1,#-26 ; xtal 12Mhz baud 1200=-26, 2400=-13, //xtal 11059200 baud 1200=-24, 2400=-12, 9600=-3
setb tr1 ; serial urip
setb PX1 ; priority
Setb IT1 ; set ext. int.1 to down
Setb EX1 ; enable ext. int.1
setb ET0 ; enable timer overflow interup 1
;***********************************************************************************
; PROGRAM UTAMA
;***********************************************************************************
Mubeng: Setb EA ; Enable all interupt
jb finish,tbl_ditekan
sjmp mubeng
tbl_ditekan:
clr finish
mov a,kode
; SWAP A DEBUG
; mov p2,a DEBUG
cjne a,#45H,banding0
mov a,#’a’

CPL p1.0 ; jika mau diaplikasikan menyalakan dan Matikan lampu LED pada port 1.0
call print_chr
jmp banding21
banding0:
cjne a,#46H,banding1
mov a,#’b’
call print_chr
jmp banding21
banding1:
cjne a,#47H,banding2
mov a,#’c’
call print_chr
jmp banding21
banding2:
cjne a,#44H,banding3
mov a,#’d’
call print_chr
jmp banding21
banding3:
cjne a,#40H,banding4
mov a,#’e’
call print_chr
jmp banding21
banding4:
cjne a,#43H,banding5
mov a,#’f’
call print_chr
jmp banding21
banding5:
cjne a,#07H,banding6
mov a,#’g’
call print_chr
jmp banding21
banding6:
cjne a,#15h,banding7
mov a,#’h’
call print_chr
jmp banding21
banding7:
cjne a,#09H,banding8
mov a,#’i’
call print_chr
jmp banding21
banding8:
cjne a,#16H,banding9
mov a,#’j’
call print_chr
jmp banding21
banding9:
cjne a,#19H,banding10
mov a,#’k’
call print_chr
jmp banding21
banding10:
cjne a,#0DH,banding12
mov a,#’0′
call print_chr
jmp banding21
banding12:
cjne a,#0CH,banding13
mov a,#’1′
call print_chr
jmp banding21
banding13:
cjne a,#18H,banding14
mov a,#’2′
call print_chr
jmp banding21
banding14:
cjne a,#5EH,banding15
mov a,#’3′
call print_chr
jmp banding21
banding15:
cjne a,#08H,banding16
mov a,#’4′
call print_chr
jmp banding21
banding16:
cjne a,#1CH,banding17
mov a,#’5′
call print_chr
jmp banding21
banding17:
cjne a,#5AH,banding18
mov a,#’6′
call print_chr
jmp banding21
banding18:
cjne a,#42H,banding19
mov a,#’7′
call print_chr
jmp banding21
banding19:
cjne a,#52H,banding20
mov a,#’8′
call print_chr
jmp banding21
banding20:
cjne a,#4AH,banding21
mov a,#’9′
call print_chr
banding21:
ljmp mubeng
print_chr:
mov sbuf,a
jnb ti,$
clr ti
ret
;=====================================================================
; REMOT NEC PUTIH
; TOMBOL KODE ASCII OUTPUT
;=====================================================================
; POWER =12H a
; MODE =1AH b
; MUTE =1EH c
; PLAY/PAUSE =01H d
; PEV =02H e
; NEXT =03H f
; EQ =04H g
; VOL- =05H h
; VOL+ =06H i
; 0 =07H 0
; RPT =08H j
; USD =09H k
; 1 =0AH 1
; 2 =1BH 2
; 3 =1FH 3
; 4 =0CH 4
; 5 =0DH 5
; 6 =0EH 6
; 7 =00H 7
; 8 =0FH 8
; 9 =19H 9
;=====================================================================
;=====================================================================
; REMOT NEC HITAM
; TOMBOL KODE ASCII OUTPUT
;=====================================================================
; CH- =45H a
; MODE =46H b
; CH+ =47H c
; PEV =44H d
; NEXT =40H e
; PLAY/PAUSE =43H f
; VOL- =07H g
; VOL+ =15H h
; EQ =09H i
; 0 =16H 0
; 100+ =19H j
; REPET =0DH k
; 1 =0CH 1
; 2 =18H 2
; 3 =5EH 3
; 4 =08H 4
; 5 =1CH 5
; 6 =5AH 6
; 7 =42H 7
; 8 =52H 8
; 9 =4AH 9
;=====================================================================
end