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-15 by Richard Reeves

> 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 wrt_d           ;If not equal, display character and loop
     rjmp loop
exit:ret


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

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.