Reads51 is Rigel's Integrated Embedded Applications Development System, an IDE (Integrated Development Environment) that supports the Rigel 8051 embedded controller board family. The IDE supports several toolchains, most notably the previous READS v3.x assembler and the RChipSim v3.x simulator. This makes Reads51 an upgrade to previous software tools. In addition, Reads51 contains a SmallC-compatible C compiler for the 8051 microcontroller family.
Reads51 IDE Rigel 8051
Reads51 runs on an IBM PC or compatible host. Reads51 allows users to write, compile, design, debug, download, and run application software in the MCS-51 language. Reads51 contains a C compiler, relative assembler, linker/locator, editor, chip simulator, assembly language debugger, and user-friendly host-to-board communication.
Debugging functions include breakpoints, single-stepping, source-level debugging, inspecting & modifying memory, internal registers, and special function registers. The MCS-51 instructions include a comprehensive on-line help system.
All Reads51 functions can be activated from the menu, toolbar, or with a hot-key combination.
Software Examples
Source code is also provided for experimenting with the capabilities of Rigel's boards and Reads51. Several examples are designed to provide an overview of the features of the 8051 microcontroller family, especially digital and serial I/O, timers, counters and interrupt logic. In addition there is software such as; routines for keypads, LCDs, stepper motors, and DC motors.
Users are encouraged to modify the provided software samples, this is intended to develop more specific versions of their applications. User source code can be accessed through system calls.
Download
You can download the application on the Rigel Official Web Page.
Over view
Reads51 Home Page
Contoh Program Assembly Testing Port
In the world of electronics, one thing that should not be ignored or forgotten is checking the supporting equipment, to ensure that the tools we use can work properly according to their function, this service package is often known as calibration.
No exception when we are designing a system to be implanted/embedded into an IC (Microcontroller or Microprocessor), we usually use a port indicator as a tester, to ensure whether our program is running as it should.
This is the reason why this program was created, so that we can ensure that the indicator port we are using is working properly, and if there is damage, then we can do further troubleshooting such as; replacing the indicator light or checking the connector, etc.
Source Code:
;-- BAB3_01.ASM -----------------------------------------------------------
;
; High Flip-Flop untuk Testing Port 1
; bundet.com
;--------------------------------------------------------------------------
#include <sfr51.inc>
ORG 0H ; program ditempatkan pada lokasi 0000H
;
MULAI:
MOV P1,00001111B ; LED P1.4 s/d P1.7 nyala (heksa= #0FH)
ACALL DELAY ; lakukan penundaan sesaat (sub. DELAY)
MOV P1,11110000B ; LED P1.0 s/d P1.3 nyala (heksa= #0F0H)
ACALL DELAY1 ; lakukan penundaan sesaat (sub. DELAY)
SJMP MULAI ; ulangi lagi dari awal
;
;-subrutin DELAY-----------------------------------------------------------
;
; subrutin ini hanya sekedar melakukan penundaan sesaat dengan cara
; mengulangi proses (pengurangan isi register) hingga dicapai suatu
; kondisi tertentu
;
;--------------------------------------------------------------------------
DELAY: MOV R0,#5H ; Isi Register R0 dengan 5 (5x ulang)
DELAY1: MOV R1,#0FFH ; Isi Register R1 dengan 255 (255x ulang
DELAY2: MOV R2,#0 ; Isi register R2 dengan 0 (256x ulang)
DJNZ R2,$ ; R2=R2-1, jika R2 belum 0 ulangi lagi
DJNZ R1,DELAY2 ; R1=R1-1, jika R1 belum 0 ulangi DELAY2
DJNZ R0,DELAY1 ; R0=R0-1, jika R0 belum 0 ulangi DELAY1
RET ; Kembali ke pemanggil subrutin DELAY
END
Demo:
Hope this is useful & happy learning!
Comment 1
MIERZA 11 Feb 2016, 09:26:00 brother? sorry? can I ask for an example of an emu8086 program that XORs the same AND? please help me?...please
ANDRI MARSEL Apr 28, 2017, 11:48:00 Can you share the application, bro?
Response 1
Hi Mierza, If there is, please use it. If not, maybe I will add it another time.. thank you
Yes, please.
Example of 7 Segment Initialization Assembly Program
Initialization is the process of finding and using the values assigned to the variable data used by the system. A system is installed with standard or user-defined values by considering certain aspects so that the unit has a specific function.
A system initialization parameter can be set by default or dynamically from the console, this is usually done during the startup process.
Initialization aims to determine the initial base solution, the optimization test stage aims to check whether each transmission and component has been installed correctly (pass).
Performance at the initialization stage is determined by the complexity of the method algorithm, changing the centralized system to a distributed system.
Source code:
#include <sfr51.inc>
;----------------
; MAIN PROGRAM
; bundet.com
;----------------
mov b,#0 ; inisialisasi register b dengan 0
Mov P3,#191 ; inisialisasi 7 segment u/ mengaktifkan 7 segment Digit 1
mulai:
anl b,#0Fh ; mengalikan register b dengan data 0F ( 0000 1111 )
mov a,b ; pindahkan register ke accumulator a
Lcall tampil ; panggil sub rutin tampil yang telah disimpan ke a
mov p0,a ; pindahkan ke Port 0
Lcall DELAY500MS ; delay 500 milli second
inc b ; register b ditambah/dinaikkan
sjmp mulai ; kembali lagi ke mulai
;---------------
; delay 500 ms
;---------------
DELAY500MS:
PUSH ACC
PUSH 00H
MOV A,#032H ; 500 milli second
X10MS: LCALL DELAY10MS
DJNZ ACC,X10MS
POP 00H
MOV ACC,A
RET
;-------------
; DELAY 10 ms
;-------------
DELAY10MS:
PUSH ACC
PUSH 00H
MOV 00H,#050H
D10MS1: MOV A,#0C8H
MOV ACC,A
DJNZ R0,D10MS1
POP 00H
POP ACC
RET
;*************************************
;* Mengubah nilai 0..9 di Accumulator *
;* menjadi kombinasi ruas tampilan *
;*************************************
tampil:
INC A
MOVC A,@A+PC
RET
; -gfedcba
DB 11000000B ; 0
DB 11111001B ; 1
DB 10100100B ; 2
DB 10110000B ; 3
DB 10011001B ; 4
DB 10010010B ; 5
DB 10000010B ; 6
DB 11111000B ; 7
DB 10000000B ; 8
DB 10010000B ; 9
DB 11111111B ; Blank
BlankDisplay:
DB 11111111B ; Blank
DB 11111111B ; Blank
DB 11000000B ; 0
DB 11000000B ; 0
end
Demo:
Hope this is useful & happy learning!
Example of Sliding LED Assembly Program (Ring Counter)
Ring counter or familiarly called Walking Led, is a logic circuit consisting of a row of shift registers. The output of the shift register is then fed to the input of the first register, and so on.
The most popular ring counter is the Johnson counter model, because it is capable of independently initializing all registers to zero, without requiring an external injection of the first bit count at start-up.
Source code:
#include <sfr51.inc>
; Program penyalaan lampu jalan dengan nyala tiap dua
; lampu secara berurutan.
; bundet.com
ORG 00H
MULAI: MOV P0, #0FCH
ACALL TUNDA
MOV P0, #0F3H
ACALL TUNDA
MOV P0, #0CFH
ACALL TUNDA
MOV P0, #03FH
ACALL TUNDA
SJMP MULAI
; Sub Routine Tunda
TUNDA: MOV R0, #003H
TUNDA1: MOV R1, #0FFH
TUNDA2: MOV R2, #0FFH
TUNDA3: NOP
DJNZ R2, TUNDA3
DJNZ R1, TUNDA2
DJNZ R0, TUNDA1
RET
END
Demo:
Hope this is useful & happy learning!
Example of Odd Even Flip-Flop Assembly Program
Source Code:
;- BAB3_02.ASM -------------------------------------------------------------------
;
; Lampu flip-flop genap dan ganjil pada Port 1
; bundet.com
;---------------------------------------------------------------------------------
#include <sfr51.inc>
Org 0h
;
Mulai:
Mov P1,#01010101B ; LED P1.0, P1.2, P1.4 dan P1.6 menyala (=55h)
Acall Delay ; lakukan penundaan sesaat...
Mov P1,#10101010B ; LED P1.1, P1.3, P1.5 dan P1.7 menyala (=0AAh)
Acall Delay ; lakukan penundaan sesaat...
Sjmp Mulai ; ulangi lagi dari awal
;
;-subrutin DELAY-----------------------------------------------------------
;
; subrutin ini hanya sekedar melakukan penundaan sesaat dengan cara
; mengulangi proses (pengurangan isi register) hingga dicapai suatu
; kondisi tertentu
;
;--------------------------------------------------------------------------
DELAY: MOV R0,#5H ; Isi Register R0 dengan 5 (5x ulang)
DELAY1: MOV R1,#0FFH ; Isi Register R1 dengan 255 (255x ulang
DELAY2: MOV R2,#0 ; Isi register R2 dengan 0 (256x ulang)
DJNZ R2,$ ; R2=R2-1, jika R2 belum 0 ulangi lagi
DJNZ R1,DELAY2 ; R1=R1-1, jika R1 belum 0 ulangi DELAY2
DJNZ R0,DELAY1 ; R0=R0-1, jika R0 belum 0 ulangi DELAY1
RET ; Kembali ke pemanggil subrutin DELAY
END
Demo:
Hope this is useful & happy learning!
Comment 1
GROUP 5 11 Jan 2016, 13:33:00 boss what application do you use to try out the program we made? thx
ANDRI MARSEL Apr 30, 2017, 09:29:00 bro, why is my LED running so fast? even though I've copied the program bro.??
Response 1
Many, if the above I use the program 51 RIGEL CORP
Maybe it's because the architecture is different, bro. Just try modifying the delay part, bro, try increasing it.
Middle-Side Flip-Flop Assembly Program Example
Source code:
;- BAB3_03.ASM -------------------------------------------------------------------
; Lampu bergerak dari tengah ke pinggir kemudian kembali lagi...
; bundet.com
;---------------------------------------------------------------------------------
#include <sfr51.inc>
Org 0h
;
Mulai: Mov P1,#11100111B ; Dua lampu tengah menyala, P13 dan P1.4 (=0E7h)
Acall Delay ; lakukan penundaan sesaat...
Mov P1,#11011011B ; Dua lampu berikutnya menyala, P1.2 dan P1.5 (=0DBh)
Acall Delay ; lakukan penundaan sesaat...
Mov P1,#10111101B ; Dua lampu berikutnya menyala, P1.1 dan P1.6 (=0BDh)
Acall Delay
Mov P1,#01111110B ; Dua lampu berikutnya menyala, P1.0 dan P1.7 (=7Eh)
Acall Delay
Mov P1,#10111101B ; dua lampu berikutnya menyala, P1.1 dan P1.6 (=0BDh)
Acall Delay
Mov P1,#11011011B ; Dua lampu berikutnya menyala, P1.2 dan P1.5 (=0DBh)
Acall Delay
Sjmp Mulai ; Lompat ke alamat dg label Mulai
;
;-subrutin DELAY-----------------------------------------------------------
;
; subrutin ini hanya sekedar melakukan penundaan sesaat dengan cara
; mengulangi proses (pengurangan isi register) hingga dicapai suatu
; kondisi tertentu
;
;--------------------------------------------------------------------------
DELAY: MOV R0,#5H ; Isi Register R0 dengan 5 (5x ulang)
DELAY1: MOV R1,#0FFH ; Isi Register R1 dengan 255 (255x ulang
DELAY2: MOV R2,#0 ; Isi register R2 dengan 0 (256x ulang)
DJNZ R2,$ ; R2=R2-1, jika R2 belum 0 ulangi lagi
DJNZ R1,DELAY2 ; R1=R1-1, jika R1 belum 0 ulangi DELAY2
DJNZ R0,DELAY1 ; R0=R0-1, jika R0 belum 0 ulangi DELAY1
RET ; Kembali ke pemanggil subrutin DELAY
END
Demo:
Hope this is useful & happy learning!
Accumulator Rotation Assembly Program Example
Source code:
;- BAB3_04.ASM -------------------------------------------------------------------
; Lampu berjalan dari P1.0 s/d P1.7 kemudian kembali lagi
; bundet.com
;---------------------------------------------------------------------------------
#include <sfr51.inc>
Org 0h
;
Mov A,#11111110B ; data lampu menyala dikirim melalui akumulator
; agar P1.0 pertama kali menyala, akumulator
; diisi dengan 11111110B atau 0FEh
Mulai:
Mov P1,A ; kirimkan data di akumualtor ke port 1
Acall Delay ; lakukan penundaan sesaat
RL A ; rotasikan isi akumulator ke kiri
; +->------>----->----->+
; | |
; +<--7-6-5-4-3-2-1-0<--+
Sjmp Mulai ; ulangi lagi dari awal
;
;-subrutin DELAY------------------------------------------------------------------
;
; subrutin ini hanya sekedar melakukan penundaan sesaat dengan cara
; mengulangi proses (pengurangan isi register) hingga dicapai suatu
; kondisi tertentu
;
;---------------------------------------------------------------------------------
Delay: Mov R0,#0 ; Isi Register R0 dengan 0 (256x ulang)
Delay1: Mov R1,#0 ; Isi Register R1 dengan 0 (256x ulang)
Djnz R1,$
Djnz R0,Delay1
Ret
End
Demo:
Hope this is useful & happy learning!
Contoh Program Assembly Flip-Flop Ping-Pong
Source code:
;- BAB3_05.ASM -------------------------------------------------------------------
;
; Lampu menyala pingpong kiri ke kanan, kanan ke kiri di port 1
; bundet.com
;---------------------------------------------------------------------------------
#include <sfr51.inc>
Org 0h
;
MOV A, #0FEh ; simpan data 11111110B ke akumulator (P1.0 menyala
; duluan)
MULAI:
MOV P1,A ; kirim data ke Port 1
ACALL DELAY ; tunda sebentar
RL A ; putar isi akumulator ke kiri 1 bit
CJNE A,#7FH,MULAI ; apakah A=01111111B ? Tidak, ulangi lagi!
MULAI1: ; Ya, lanjutkan ke proses berikut...
MOV P1,A ; kirim data ke Port 1
ACALL DELAY ; tunda sebentar
RR A ; putar isi akumulator ke kanan 1 bit
CJNE A,#0FEh,MULAI1 ; apakah A=11111110B ? Tidak, ulangi lagi!
SJMP MULAI ; Ya, ulangi lagi dari paling awal...
;
;-subrutin DELAY------------------------------------------------------------------
;
; subrutin ini hanya sekedar melakukan penundaan sesaat dengan cara
; mengulangi proses (pengurangan isi register) hingga dicapai suatu
; kondisi tertentu
;
;---------------------------------------------------------------------------------
Delay: Mov R0,#0 ; Isi Register R0 dengan 0 (256x ulang)
Delay1: Mov R1,#0 ; Isi Register R1 dengan 0 (256x ulang)
Djnz R1,$
Djnz R0,Delay1
Ret
End
Demo:
Hope this is useful & happy learning!
Example of Assembly Program for 7 Segment Display 0-9
Review of old projects, deep coding of assembly programs which were then downloaded to the 8051 microcontroller to display the numbers 0 to 9 using seven segments.
Example of Assembly Program for 7 Segment Display 0 - 9
Source Code 1:
$MOD51 ; This includes 8051 definitions for the Metalink assembler
; Please insert your code here.
;- BAB3_06.ASM -------------------------------------------------------------------
;
; Menghidupkan display LED 7 segment untuk menampilkan angka 0 s/d 9
; cara 1 : data langsung dikeluarkan ke port yang bersangkutan (Port 0)
; author : bundet.com
;---------------------------------------------------------------------------------
Mulai:
Mov P0,#0C0h ; keluarkan kode angka 0 Port 0
Acall Delay ; lakukan penundaan sesaat...
Mov P0,#0F9h ; keluarkan kode angka 1 Port 0
Acall Delay ; lakukan penundaan sesaat...
Mov P0,#0A4h ; keluarkan kode angka 2 Port 0
Acall Delay
Mov P0,#0B0h ; keluarkan kode angka 3 Port 0
Acall Delay
Mov P0,#99h ; keluarkan kode angka 4 Port 0
Acall Delay
Mov P0,#92h ; keluarkan kode angka 5 Port 0
Acall Delay
Mov P0,#82h ; keluarkan kode angka 6 Port 0
Acall Delay
Mov P0,#0F8h ; keluarkan kode angka 7 Port 0
Acall Delay
Mov P0,#80h ; keluarkan kode angka 8 Port 0
Acall Delay
Mov P0,#90h ; keluarkan kode angka 9 Port 0
Acall Delay
Sjmp Mulai ; ulangi lagi dari awal
;
;-subrutin DELAY------------------------------------------------------------------
;
; subrutin ini hanya sekedar melakukan penundaan sesaat dengan cara
; mengulangi proses (pengurangan isi register) hingga dicapai suatu
; kondisi tertentu
;
;---------------------------------------------------------------------------------
Delay: Mov R0,#2h ; Isi Register R0 dengan 2 (2x ulang)
Delay1: Mov R1,#2h ; Isi Register R1 dengan FF (25x ulang)
Delay2: Mov R2,#0 ; Isi register R2 dengan 0 (26x ulang)
Djnz R2,$
Djnz R1,Delay2
Djnz R0,Delay1
Ret
END
Source Code 2:
$MOD51 ; This includes 8051 definitions for the Metalink assembler
; Please insert your code here.
;- BAB3_07.ASM -------------------------------------------------------------------
;
; Menghidupkan display LED 7 segment untuk menampilkan angka 0 s/d 9
; cara 2 : data diambil dari alamat larik (array) data, program jadi lebih pendek
; author : bundet.com
;---------------------------------------------------------------------------------
Mulai:
Mov R2,#0Ah ; jumlah angka numerik yg akan ditampilkan
Mov DPTR,#Numerik ; register DPTR menunjuk pada lokasi awal data
Nextdata:
Clr A ; persiapkan akumulator
Movc A,@A+DPTR ; salin isi lokasi yg ditunjuk A+DPTR ke A
Mov P0,A ; keluarkan data A ke port 0
Inc DPTR ; ke lokasi data berikutnya
Acall Delay ; lakukan penundaan sesaat...
Djnz R2,Nextdata ; R2=R2-1, jika R2 <> 0 ulangi lagi
Sjmp Mulai ; ulangi lagi dari awal...
;
;-subrutin DELAY------------------------------------------------------------------
;
; subrutin ini hanya sekedar melakukan penundaan sesaat dengan cara
; mengulangi proses (pengurangan isi register) hingga dicapai suatu
; kondisi tertentu
;
;---------------------------------------------------------------------------------
Delay: Mov R0,#2h ; Isi Register R0 dengan 2 (2x ulang)
Delay1: Mov R1,#1h ; Isi Register R1 dengan FF (15x ulang)
Delay2: Mov R2,#0 ; Isi register R2 dengan 0 (15x ulang)
Djnz R2,$
Djnz R1,Delay2
Djnz R0,Delay1
Ret
;
;---------------------------------------------------------------------------------
; Lokasi larik data
; berisi kode-kode untuk menghidupkan 7-segmen: angka 0 s/d 9 secara berturutan
;---------------------------------------------------------------------------------
Numerik:
DB 0C0h,0F9h,0A4h,0B0h,99h,92h,82h,0F8h,80h,90h
END
Demo:
You don't need to worry about how to make the schematic above, because I am kind enough, so I have prepared such a thing. I facilitate it with the download link below. Okay, hopefully useful, please experiment at home or in class, and happy learning! DOWNLOAD SCHEMATIC (102KB)