I have recently started assembler
I am trying to send the letter H, to my LCD screen using basic assembly language, but it doesn't work.
I'm using parallax 2x16 lcd
https://learn.parallax.com/KickStart/27977
and Rx is hooked up to portb7. Atmega32
can someone tell what's wrong, because i couldn't any example code
really appreciate it
; ******************************************************
; BASIC .ASM template file for AVR
; ******************************************************
.include "C:\VMLAB\include\m32def.inc"
; Define here the variables
;
.def temp =r16
.def counter1= r17
.def counter2=r18
.def counter3=r19
.def data = r20
.def data_temp= r21
.def counter4= r22
; Define here Reset and interrupt vectors, if any
;
reset:
rjmp start
reti ; Addr $01
reti ; Addr $02
reti ; Addr $03
reti ; Addr $04
reti ; Addr $05
reti ; Addr $06 Use 'rjmp myVector'
reti ; Addr $07 to define a interrupt vector
reti ; Addr $08
reti ; Addr $09
reti ; Addr $0A
reti ; Addr $0B This is just an example
reti ; Addr $0C Not all MCUs have the same
reti ; Addr $0D number of interrupt vectors
reti ; Addr $0E
reti ; Addr $0F
reti ; Addr $10
; Program starts here after Reset
;
start:
ldi temp, low(RAMEND)
out SPL,temp
ldi temp,high(RAMEND)
out SPH, temp
ldi temp, 0B10000000
out DDRB, temp
nop
nop
nop
nop
out PORTB,temp
ldi data,0b01001000 ; Letter 'H'
call LCD_out
;****************************************************
delay_500ms:
ldi counter3, 50
DO3:
call delay_10ms
dec counter3
brne DO3
ret
;********************************************************
delay_10ms:
ldi counter2,100
DO2:
call delay_100us
dec counter2
brne DO2
ret
;*************************************************************
delay_100us: ; this loop gives me 100u delay
ldi counter1, 100
DO_1:
DEC counter1
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
brne DO_1
;****************************************************************
LCD_out:
ldi temp,0b00000000
out PORTB,temp
DO_5:
call delay_500ms
ldi counter4,7
MOV data_temp,data
ldi r24, 0b000000001
and data_temp, r24
out PORTB,data_temp
lsr data_temp
dec counter4
brne DO_5
ldi temp,0xFF
out PORTB,temp
call delay_500ms
ret
;********************************************************