VTech Alphabert s Magic Readport User Manual Page 50

  • Download
  • Add to my manuals
  • Print
  • Page
    / 80
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 49
Lab Manual of Microcontroller & Interfacing Page 50
ORG 1BH
RETI
ORG 23H
RETI
START:
MOV SP,#60H
MOV P1,#00H ;Set P1 as an output port
MOV P3,#00h ;Set P3 as an output port
MOV A,#38H ;Initialize LCD, 2 lines, 5X7 matrix
ACALL COMMAND ;Issue command to the LCD
MOV A,#0EH
ACALL COMMAND ;LCD ON, Cursor ON
MOV A,#01H
ACALL COMMAND ;Clear LCD
MOV A,#06H
ACALL COMMAND ;Shift cursor right
MOV A,#80H
ACALL COMMAND ;Force cursor at begining of the first line
MOV DPTR,#MSG ;Point to message "Freq:"
ACALL DISP_MSG ;Display message on first line
MOV TCON,#00H ;Timer 0 & Timer 1 off, flags in reset condition
MOV TMOD,#15H ;Timer 1 as a timer in mode 2 &
;Timer 0 as a counter in mode 1.
LOOP: MOV TL1,#0E0H ;Load Timer 1 with 45535(B1E0h)
MOV TH1,#0B1H ;results in 0.01 second delay)
MOV TL0,#00H ;Reset counter for counting operation
MOV TH0,#00H
MOV A,#088H ;Move cursor to line 2, position 8
ACALL COMMAND
MOV R1,#00H ;Clear R1 for overflow counting
MOV TCON,#50H ;Start timer 0 and timer 1
CHECK: JNB TF1,CHECK
CLR TF1
MOV TL1,#0E0H ;Load Timer 1 with 45536(b1e0h) results
;in 0.01 SECOND DELAY)
MOV TH1,#0B1H
SETB TR1
INC R1
CJNE R1,#64H,CHECK ;Count 100 interrupts to provide delay
;100X0.01 =1second
READ_FREQ:
CLR TR0 ;Stop timer 0
CLR TR1 ;Stop timer 1
MOV 30H,TL0 ;Transfer LSB of 16 bit count value at RAM
;location30h
MOV 31H,TH0 ;Transfer MSB of 16 bit count value at RAM
;location 31h
ACALL HEXBCD ;Convert hex number into binary numbers
Page view 49
1 2 ... 45 46 47 48 49 50 51 52 53 54 55 ... 79 80

Comments to this Manuals

No comments