找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3166|回復(fù): 1
打印 上一主題 下一主題
收起左側(cè)

用8051單片機與1601LCD設(shè)計的計算器 匯編語言

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:155292 發(fā)表于 2016-12-16 16:54 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
用8051與1601LCD設(shè)計的計算器
protues仿真原理圖如下:



所有資料下載:
40 用8051與1601LCD設(shè)計的計算器.rar (35.26 KB, 下載次數(shù): 25)

單片機匯編源碼(部分內(nèi)容預(yù)覽):

  1. /******************************************************************************
  2. ************                LABCENTER ELECTRONICS                   ************                              
  3. ************                 Proteus VSM Sample Design Code             ************                        
  4. ************                Integer Calculator ( 2K Code Limit)         ************
  5. ********************************************************************************/

  6. NAME    LCD

  7. ;Set up Code Segment and exports:

  8. LCD              SEGMENT CODE
  9. RSEG             LCD

  10.                  PUBLIC  _output
  11.                  PUBLIC  initialise
  12.                  PUBLIC  clearscreen

  13. ;LCD Register Addresses.
  14. LCD_CMD_WR        equ         00h
  15. LCD_DATA_WR        equ        01h
  16. LCD_BUSY_RD        equ        02h
  17. LCD_DATA_RD        equ        03h
  18. LCD_PAGE        equ        80h

  19. ;LCD Commands
  20. LCD_CLS                equ        1
  21. LCD_HOME        equ        2
  22. LCD_SETMODE        equ        4
  23. LCD_SETVISIBLE        equ        8
  24. LCD_SHIFT        equ        16
  25. LCD_SETFUNCTION        equ        32
  26. LCD_SETCGADDR        equ        64
  27. LCD_SETDDADDR        equ        128

  28. ; Initialisation Routine for the LCD display.
  29. initialise:
  30.         mov A,#030h                        ;1 line, 8 bits
  31.                 call wrcmd
  32.                 mov A,#LCD_SETVISIBLE + 4
  33.                 call wrcmd
  34.                 mov A,#LCD_SETDDADDR+15                ; Start at right hand side of the display
  35.                 call wrcmd
  36.                 mov A,#LCD_SETMODE + 3                ; Automatic Increment - Display shift left.  
  37.                 call wrcmd
  38.         ret

  39. ; We move the parameter (held in R7) into the Accumulator prior to writing it.
  40. _output:mov A,R7       
  41.                 call wrdata
  42.                 ret


  43. ;Clears the LCD display and sets the initialisation conditions.
  44. clearscreen:
  45.         mov A,#LCD_CLS
  46.                 call wrcmd
  47.                 mov A,#LCD_SETDDADDR + 15
  48.                 call wrcmd
  49.                 ret       
  50.                
  51. ;*****************************
  52. ;******** SUBROUTINES ********
  53. ;*****************************

  54. ;Sub routine to write command:
  55. wrcmd:        mov P2,#LCD_PAGE
  56.                 mov R0,#LCD_CMD_WR
  57.                 movx @R0,A
  58.                 jmp wtbusy

  59. ; Subroutine to Write a Character to the LCD Display.
  60. wrdata:        MOV P2,#LCD_PAGE                               
  61.                 MOV R0,#LCD_DATA_WR
  62.                 MOV A,R7
  63.                 MOVX @R0,A

  64. ; Subroutine to wait for a busy clear.       
  65. wtbusy:        MOV R1,#LCD_BUSY_RD
  66.                 MOVX A,@R1
  67.                 JB ACC.7,wtbusy
  68.         ret

  69.         END
復(fù)制代碼


評分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

沙發(fā)
ID:1 發(fā)表于 2017-1-3 23:26 | 只看該作者
51黑有你更精彩。!
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表