MSP430 LCD-Positionierung in Assembler

OP #472250
Lesenswert?
• ▲
▼
Hallo,
ich habe ein kleines Problem mit einen LCD Display, ich kann zwar Daten 
hinschicken, die auch angezeigt werden, allerdings hab ich keine Ahnung 
wie ich sie positionieren soll. Das LCD Display fängt immer am Anfang 
der ersten Zeile an...ich hab aber keine Ahnung wie ich in die zweite 
komm!


#include <msp430x12x2.h>

;----------------------------------------------------------------------- 
-------
; initialisation
;----------------------------------------------------------------------- 
-------

RESET           ORG  0E000h                            ; Flash

                mov     #WDTPW + WDTHOLD, &WDTCTL               ; stop

             call    #LCD_INIT
                eint






;----------------------------------------------------------------------- 
-------

main
                mov       #1, R10
              mov       #000h, R11
              call      #SEND       ; first nibble of display clear
              mov       #1, R10
              mov       #001h, R11
              call      #SEND


; send 'U' to display (ASCII 4Dh)
              bis.b     #BIT1, &P3OUT                   ; RS = 1 means 
data
              mov       #1, R10
              mov       #005h, R11                      ; high-nibble 
first
              call      #SEND
              mov       #1, R10
              mov       #005h, R11                      ; low-nibble
              call      #SEND
              bic.b     #BIT1, &P3OUT
;

;----------------------------------------------------------------------- 
-------
; LCD initialisation sub routine
;----------------------------------------------------------------------- 
-------

LCD_INIT      mov.b     #000h, &P1OUT   ; set data lines DB4-DB7
              mov.b           #00fh, &P1DIR
              mov.b           #000h, &P3OUT   ; set EN and RS line
              mov.b           #003h, &P3DIR
              mov       #16, R10         ; counter (16 * 1ms)
              call      #DELAY            ; wait R10 * 1ms
              mov       #003h, R11       ; standard init routine
              mov       #5, R10
              call      #SEND           ; send init code first time
              mov       #1, R10
              call      #SEND          ; send init code second time
              mov       #1, R10
              call      #SEND          ; send init code third time
              mov       #1, R10
              mov       #002h, R11
              call      #SEND         ; define 4-Bit communication

              mov       #1, R10
              mov       #002h, R11
              call      #SEND       ; first nibble of function set
              mov       #1, R10
              mov       #008h, R11
              call      #SEND       ; second nibble of function set
                                            ; 2 lines, 5x7 dots
              mov       #1, R10
              mov       #000h, R11
              call      #SEND     ; first nibble of display control
              mov       #1, R10
              mov       #00Ch, R11
              call      #SEND    ; second nibble of display control
                                         ; display on, cursor off
              mov       #1, R10
              mov       #000h, R11
              call      #SEND     ; first nibble of display clear
              mov       #1, R10
              mov       #001h, R11
              call      #SEND     ; second nibble of display clear

              mov       #1, R10
              mov       #000h, R11
              call      #SEND     ; first nibble of entry mode set
              mov       #1, R10
              mov       #006h, R11
              call      #SEND     ; second nibble of entry mode set
                                           ; increment address counter
                ret

;-------------------------------- 
----------------------------------------------
; send Data via Port1 (P1.0-P1.3) to LCD - subroutine
;----------------------------------------------------------------------- 
-------

SEND          bis.b     #BIT0, &P3OUT      ; EN = 1
              mov.b            R11, &P1OUT       ; data to DB4-DB7
              bic.b     #BIT0, &P3OUT      ; EN = 0
              call      #DELAY
              ret

;----------------------------------------------------------------------- 
-------
; Delay - sub routine
;----------------------------------------------------------------------- 
-------
DELAY          mov           #03E8h,R12       ; value for counting back
LOOP           dec           R12
              jnz           LOOP
              dec           R10                ; multipier for LOOP
              jnz           DELAY
              ret


;
; Interrupt Vectors Used MSP430x1232
;----------------------------------------------------------------------- 
-------
           ORG         0FFFEh    ; MSP430 RESET Vector
                DW          RESET
                END

Antwort schreiben

Hinweis: der ursprüngliche Beitrag ist mehr als 6 Monate alt. Bitte hier nur auf die ursprüngliche Frage antworten, für neue Fragen einen neuen Beitrag erstellen.

Formatierung
  • [c]C-Code[/c]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.