Tutorial Microcontroller MCS-51 ATMEL ISP
 

 

Super MCS51 Trainer

Standart MCS51 Trainer

Standart AVR Trainer

Programmer USBASP

Standart ARM Trainer

 

Basic Connection: Microcontroller 8051 with Printer Dot Matrix

 

( Download Circuit File : printer1.pdf )
( Download asembly file :printer1.asm )
( How to build an easy and cheap Programmer 89Sxxx, only $1 )
( More about LPT Pin Configuration )

 

;===================================================
; Printing out data  to Dot Matrix Printer
; By: Triwiyanto
; www.mytutorialcafe.com
;===================================================
busy	   bit P1.5
strobe bit P1.4
portData equ P2
;
org 0h
start:
call word_Welcome ; to print ' Welcome To '
call enter ; new line feed
call word_Lab ; to print ' Computer Laboratory '
call enter ; new line feed
;
quit: sjmp Quit ; Hang Forever until reset pressed
;
;===========================================================
;This subroutine is used to print single character
;trough Port Data
;before printing a character,a busy signal must be detected
;till a low logic received, than a strobe ( --__-- ) pulse
;must be generate to starts printing a character.
;==========================================================
Printchar:
mov portData,A
jb busy,$
setb strobe
clr strobe
acall delay
Setb strobe
acall delay
ret
;
delay: mov R7,#2
del1: mov R6,#20
DJNZ R6,$
DJNZ R7,del1
ret
;===========================================================
;This subroutine is used to print a text ' Welcome To'
;this subroutine will print character by character till '$'
;character is detected, when this character is detected then
;It's indicated that a text has finished
;===========================================================
word_welcome:
mov DPTR,#Text_welcome
lagi1: clr A
movc A,@A+DPTR
cjne A,#'$',Print1
sjmp Out1
Print1: call Printchar
inc dptr
call delay
sjmp lagi1
Out1: ret
;
;===========================================================
;This subroutine is used to print a text ' Computer Laboratorium'
;this subroutine will print character by character till '$'
;character is detected, when this character is detected then
;It's indicated that a text has finished
;==========================================================
word_Lab:
mov DPTR,#Text_lab
lagi2: clr A
movc A,@A+DPTR
cjne A,#'$',Print2
sjmp Out2
Print2: call Printchar
inc dptr
call delay
sjmp lagi2
Out2: ret
;
Enter:
mov A,#0dh
call printchar
call delay
mov A,#0ah
call printchar
ret
;
Text_welcome: DB ' Welcome To $'
Text_Lab: DB ' Computer Laboratory $'
;
end end

NEXT