AVR Projekte

8 Kanal Vorsatz für Analog Oszilloskop

you can test it at STK200 or STK500 or AVRStudio3.54

;****************************************************************
; 8 Channel digital to analog Oszilloskop - AT90S1200
; at 10MHz - chopperfreq. ca.125 Khz
; Version 1.0 / c. B.Felgentreff
; Berlin / 08/2000
;****************************************************************
.include "1200def.inc"
.def	temp	=r16			;general scratch space
.def	bitcnt	=R17			;bit counter
.def	Txbyte	=R18			;
.def	Tzahl	=R19
.def	xx	=R20
.def	yy	=R21			;
.def	aa	=R22

; reg 31,30 =Z, 29,28 =Y , 27,26 =X     ;
.equ	pd	=0x40	;0b01000000

;****Source code***************************************************
.cseg					;CODE segment
.org 0
		rjmp reset		;Reset handler
		nop			;unused ext. interrupt
		nop			;unused timer counter overflow 
		nop			;unused analogue interrupt
;*** Reset handler **************************************************
;*** to provide initial port, timer and interrupt setting up
reset:		
		clr temp		;  
		out DDRB,temp		;initialize port B as all Inputs
		ser temp
		out DDRD,temp		;initialize port D as all outputs 
		out PORTB,temp		;PortB R's on
		ldi	xx,7		; bitcount auf 8
main:
		mov bitcnt,xx
		clc
Start:
		in temp,PINB		; 8 bit einlesen
loop:
		ROL temp		; bit 7 ins carry
		mov Tzahl,bitcnt
		
		brcc	putchar1	;If carry set
		ori 	Tzahl,0b01000000
		out	PORTD,Tzahl
					;send a '1'
		rjmp	putchar2	;else	
putchar1:				;send a '0'
		ori 	Tzahl,0b00000000
		out	PORTD,Tzahl
			
putchar2:	
		dec	bitcnt		;If not all bit sent
		brne	loop		;   send next
					;else
		ROL temp		; last bit ins carry
		mov Tzahl,bitcnt
		brcc	putchar1a	;If carry set
		ori 	Tzahl,0b01000000
		out	PORTD,Tzahl
					;send a '1'
		rjmp	putchar2a	;else	
putchar1a:				;send a '0'
		ori 	Tzahl,0b00000000
		out	PORTD,Tzahl
				
putchar2a:
		rjmp main			;   return

 

avrprojekte ]