VTech Alphabert s Magic Readport User Manual Page 40

  • Download
  • Add to my manuals
  • Print
  • Page
    / 80
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 39
Lab Manual of Microcontroller & Interfacing Page 40
START: MOV TMOD,#20h ;Configure Timer 1 in mode 2 auto reload mode.
MOV TH1,#0fdh ;Load TH1 with FDh to achieve baud rate 9600
MOV SCON,#50h ;8 bit, 1 stop bit, REN Enabled.
MOV A,PCON ; Transfer content of PCON to accumulator
SETB ACC.7 ; Set bit 7 of accumulator
MOV PCON,A ; Set SMOD bit to 1 to double the baud rate
SETB TR1
NEXT: MOV SBUF,#’E’ ;Transfer alphabet ‘A’ to SBUF
HERE: JNB TI,HERE ;Wait for the last bit
CLR TI ;Clear TI for next ‘A’
SJMP NEXT
END
Modified program:
;Program to transmit text “YES” using Look up table in ROM through
;serial port of the microcontroller using 8 bit UART mode with baud rate
;19,200. TI flag is checked in this program to know whether transmission
;is over or not?
ORG 00H
AJMP START
START: MOV TMOD,#20h ;Configure Timer 1 in mode 2 auto reload mode.
MOV TH1,#0fdh ;Load TH1 with FDh to achieve baud rate 9600
MOV SCON,#50h ;8 bit, 1 stop bit, REN Enabled.
MOV A,PCON ; Transfer content of PCON to accumulator
SETB ACC.7 ; Set bit 7 of accumulator
MOV PCON,A ; Set SMOD bit to 1 to double the baud rate
SETB TR1
REPT: MOV DPTR,#0400h
NEXT: CLR A
MOVC A,@A+DPTR ; Get letter from look up table
JZ REPT
MOV SBUF,A ;Transfer letter from look up table
HERE: JNB TI,HERE ;Wait for the last bit
CLR TI ;Clear TI for next character
INC DPTR
SJMP NEXT
ORG 0400h
DB 'YES',0
EXIT: END
;Modified program for Serial transmission using interrupt method:
;Program to transmit data from RAM through serial port of
;the microcontroller using 8 bit UART mode with baud rate 9600
;Serial port interrupt is used for data transmission.
ORG 00h
AJMP start
ORG 23h ;Location for serial interrupt
ajmp serial
RETI ;Return from the ISR
start:
Page view 39
1 2 ... 35 36 37 38 39 40 41 42 43 44 45 ... 79 80

Comments to this Manuals

No comments