Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. * Initialisation des addresses des ports d'entrée/sortie avec le controleur LCD
  2. cmdLCD       EQU    #
  3. dataLCD      EQU    #
  4.  
  5. lib_init:
  6.      * Initialisation de l'écran LCD
  7.  
  8.       * Attendre pour 40 ms: 16M*0.04s = 640000
  9.       MOVE.L #640000,D7
  10.       BSR lib_wait
  11.  
  12.       * Envoi du signal d'initialisation n°1
  13.      MOVE.B #$30,cmdLCD
  14.      
  15.      * Attendre pendant 4.1 ms : 16M*0.0041s = 65600
  16.      MOVE.L #65600,D7
  17.      BSR lib_wait
  18.  
  19.      * Envoi du signal d'initialisation n°2
  20.       MOVE.B #$30,D7
  21.  
  22.       * Attendre pendant 100 us : 16M*0.0001s = 1600
  23.       MOVE.L #1600,D7
  24.       BSR lib_wait
  25.  
  26.       * Envoi du signal d'initialisation n°3
  27.      MOVE.B #$30,cmdLCD
  28.  
  29.       BSR lib_bf    ; Attendre que le BF soit ok
  30.      
  31.      * Effacement de l'écran
  32.       MOVE.B #$01,cmdLCD
  33.       BSR lib_bf
  34.  
  35.       * Curseur non visible, pas de clignottement, etc
  36.       MOVE #$0C,cmdLCD
  37.       BSR lib_bf
  38.      
  39.       RTS
  40.  
  41.  
  42.  
  43. lib_bf:
  44.     * Attendre jusqu'a avoir BF = 0 (LCD prêt)
  45.     BTST #7,cmdLCD
  46.     BNE lib_bf  ; Si BF = 1, on recommence
  47.     RTS         ; Sinon on retourne de la sous-routine
  48.  
  49.  
  50.  
  51. lib_wait:
  52.      * Attendre pendant D7 cycles
  53.      * Rappel: la fréquence de la clock est de 16 Mhz
  54.  
  55. lib_wait_loop:
  56.     ADDI.L #-20,D7  ; On retire 20 cycles au compteur
  57.     BGE wait_end    ; Lorsque le nb de cycles devient egal zero ou negatif on arrete
  58.     BRA wait_loop   ; Sinon on recommence
  59. lib_wait_end:
  60.     RTS     ; Retour de la sous-routine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement