Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] writing a message for a multi character LCD

2005-02-16 by Eric

Hi All

Just to rap this up, were did I go wrong? is all the help from Richard described in a text book or a AVR
tutorial on the AVR Studio?

The help I got from Richard uses ".DB" I notice it is listed in "Assembler directives" along with
.CSEG
.DEF
.ENDMICRO
.ESEG
.EQU
.INCLUDE
.MACRO
.ORG

in chapter "Annex" pages 41 to 52 from Avr-tutorial from the web site of www.avr-asm-tutorial.net


I must go and buy that book someone recommended (when I get enough money together)


From Eric




----- Original Message -----
From: "Eric" <erichards@clear.net.nz>
To: <AVR-Chat@yahoogroups.com>
Sent: Wednesday, February 16, 2005 7:06 AM
Subject: Re: [AVR-Chat] writing a message for a multi character LCD



Thank you Richard
The program works great only had to change "wrt_db" to "putc" .

I  thought there must be some "tidy" way of doing it,

From Eric





----- Original Message -----
From: "Richard Reeves" <r_reeves@blueyonder.co.uk>
To: <AVR-Chat@yahoogroups.com>
Sent: Wednesday, February 16, 2005 4:20 AM
Subject: Re: [AVR-Chat] writing a message for a multi character LCD



> How can you write a assembly function to put messages on a LCD without
> doing multiple
>
>
>    ldi    r16,0x61           ; 'a' to lcd
>    call   putc                 ; send character to LCD
>    ldi    r16,0x62           ; 'b' to lcd
>    call   putc                 ; send character to LCD
>    ldi    r16,0x63           ; 'c' to LCD
>    call   putc                 ; send character to LCD
The way I do it is to write the string like this at the end of the code:

message: .db "This is a message",$ff

Then do this:
mess:ldi zl,low(message*2) ;load base address of string
     ldi zh,high(message*2);load base address of string
loop:lpm r16,z+            ;Load character from address in z to r16, inc z
     cpi r16,$ff           ;Check for string terminator character
     breq exit             ;If equal quit
     rcall c           ;If not equal, display character and loop
     rjmp loop
exit:ret


Richard
--
Na vratima raja, ja savijam krila...
http://www.van-gogh.co.yu




Yahoo! Groups Links










Yahoo! Groups Links

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.