Wednesday, May 16, 2018

This is a screen shot of an AVR assembler program that turns PORTB's least significant bit on and off very quickly.




;
; AssemblerApplication4.asm
;
; Created: 17/05/2018 10:15:30 AM
; Author : peterb
;

; Set up stack pointer and turn PB0 on and off. No delay.
start:
 out PORTB,r16
 LDI R16, LOW(RAMEND)
 OUT SPL, R16
 LDI R16, HIGH(RAMEND)
 OUT SPH, R16
 ;better make PB0 an output. Write a 1 into PB0 of DDRB.
 clr r16
 inc r16
 out DDRB,r16
repeat:
 clr r18
 inc r18
 rcall sendtob
 clr r18
 rcall sendtob
 rjmp repeat
 ; the subroutine is below. Always ends with ret.
 sendtob:
  out PORTB, r18
  ret

   

No comments:

Post a Comment

A outline of what's in the test. The test will be in our normal classroom on Tuesday 19 June at 8:00 There will be a picture of...