⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 la.asm

📁 基于AT90S1200芯片 (16MHz),源代码为汇编语言。 用户界面软件 LOLA.EXE 用途逻辑分析仪。PGEN.EXE用作脉冲发生器。均使用 delphi 编程。 提供了16位版本(L
💻 ASM
📖 第 1 页 / 共 2 页
字号:
         out PORTD,store2

         add bufcntL,aux1     ;incr. BufferCounter
         adc bufcntH,aux0     ;"
         brcc M1_GetSamples
         rjmp RAMFull


M2_Start:
;-------------------------------------------------------------------
;MODE=2 external Clock, falling Edge
;-------------------------------------------------------------------
M2_WaitForTrigger:
M2_ClockLoop1:
         sbi PORTD,sample
         cbi PORTD,sample
         nop
         sbis PINB,extpin     ;warte auf clockpin=H
         rjmp M2_ClockLoop1
M2_ClockLoop2:
         sbi PORTD,sample
         cbi PORTD,sample
         nop
         sbic PINB,extpin     ;warte auf clockpin=L
         rjmp M2_ClockLoop2
         in wreg,PINB         ;sample auf triggerung pruefen
         or wreg,mask         ;
         out PORTD,store1
         out PORTD,store2

         cpse wreg,trig       ;war sample=triggerbyte?
         rjmp M2_WaitForTrigger ;nein..
M2_GetSamples:
M2_ClockLoop3:
         sbi PORTD,sample
         cbi PORTD,sample
         nop
         sbis PINB,extpin     ;warte auf clockpin=H
         rjmp M2_ClockLoop3
M2_ClockLoop4:
         sbi PORTD,sample
         cbi PORTD,sample
         nop
         sbic PINB,extpin     ;warte auf clockpin=L
         rjmp M2_ClockLoop4
         out PORTD,store1
         out PORTD,store2

         add bufcntL,aux1     ;incr. BufferCounter
         adc bufcntH,aux0     ;"
         brcc M2_GetSamples
         rjmp RAMFull


M5_Start:
;-------------------------------------------------------------------
;MODE=5 State-Analyse
;jede Aenderung an den Eingaengen wird erfasst, ohne Zeitbezug
;-------------------------------------------------------------------
         sbi PORTD,sample     ;erstes sample nehmen
         cbi PORTD,sample     ;"
         nop                  ;### ist noetig!
         in temp,PINB         ;fuer Vergleich speichern
         out PORTD,store1
         out PORTD,store2

M5_Loop:
         sbi PORTD,sample     ;sample erfassen
         cbi PORTD,sample     ;"
         nop                  ;### ist noetig!
         in wreg,PINB         ;mit vorgaenger vergleichen
         cp wreg,temp         ;"
         breq M5_Loop         ;
         mov temp,wreg        ;neues vergleichsmuster speichern
         out PORTD,store1
         out PORTD,store2

         add bufcntL,aux1     ;incr. BufferCounter
         adc bufcntH,aux0     ;"
         brcc M5_Loop
         rjmp RAMFull

T1_Start:
;-------------------------------------------------------------------
;Test-Mode-1: Bitpattern LO-Counter
;-------------------------------------------------------------------
         sbi PORTD,sample     ;Sample-Register abkoppeln
         ldi bufcntL,LOW (0x0000-2048)  ;Gesamtes RAM fuellen
         ldi bufcntH,HIGH(0x0000-2048)  ;"
         ldi wreg,0xFF        ;PORTB auf ausgabe
         out DDRB,wreg        ;"
T1_loop:
         out PORTB,bufcntL    ;LO-Counter
         nop                  ;
         out PORTD,store1
         out PORTD,store2

         add bufcntL,aux1     ;incr. BufferCounter
         adc bufcntH,aux0     ;"
         brcc T1_loop
         ldi wreg,0x00        ;PORTB auf eingabe
         out DDRB,wreg        ;"
         ldi wreg,0b11111111  ;PORT-B
         out PORTB,wreg       ;Pull-Ups aktivieren
         rjmp RAMfull

T2_Start:
;-------------------------------------------------------------------
;Test-Mode-2: Pattern: AA 55 AA 55 ..
;-------------------------------------------------------------------
         sbi PORTD,sample     ;Sample-Register abkoppeln
         ldi bufcntL,LOW (0x0000-2048)  ;Gesamtes RAM fuellen
         ldi bufcntH,HIGH(0x0000-2048)  ;"
         ldi wreg,0xFF        ;PORTB auf ausgabe
         out DDRB,wreg        ;"
         ldi wreg,0xAA
T2_loop:
         out PORTB,wreg       ;Pattern ausgeben
         com wreg             ;invertieren
         out PORTD,store1
         out PORTD,store2

         add bufcntL,aux1     ;incr. BufferCounter
         adc bufcntH,aux0     ;"
         brcc T2_loop
         ldi wreg,0x00        ;PORTB auf eingabe
         out DDRB,wreg        ;"
         ldi wreg,0b11111111  ;PORT-B
         out PORTB,wreg       ;Pull-Ups aktivieren
         rjmp RAMfull

T3_Start:
;-------------------------------------------------------------------
;Test-Mode-3: Walking Zero  FF FE FD FB F7 EF DF BF 7F
;-------------------------------------------------------------------
         sbi PORTD,sample     ;Sample-Register abkoppeln
         ldi bufcntL,LOW (0x0000-2048)  ;Gesamtes RAM fuellen
         ldi bufcntH,HIGH(0x0000-2048)  ;"
         ldi wreg,0xFF        ;PORTB auf ausgabe
         out DDRB,wreg        ;"
         clc                  ;Null einschieben
         in temp,SREG         ;Carry retten
T3_loop:
         out SREG,temp        ;Carry zurueckholen
         out PORTB,wreg       ;Bitmuster ausgeben
         nop                  ;
         out PORTD,store1
         out PORTD,store2

         rol wreg             ;naechstes Muster
         in temp,SREG         ;Carry retten
         add bufcntL,aux1     ;incr. BufferCounter
         adc bufcntH,aux0     ;"
         brcc T3_loop
         ldi wreg,0x00        ;PORTB auf eingabe
         out DDRB,wreg        ;"
         ldi wreg,0b11111111  ;PORT-B
         out PORTB,wreg       ;Pull-Ups aktivieren
;        rjmp RAMfull

;-------------------------------------------------------------------
;Datenausgabe fuer LogicAnalyzer
;-------------------------------------------------------------------
RAMfull:
         cli                  ;Interrupts sperren
         in  wreg,UDR         ;Clear RXC Interrupt flag

         out PORTD,store2     ;PORTD Ruhezustand
         ldi TXByte, 'D'      ;sende "D" fuer "DATEN folgen" ...
         rcall PutChar
                              ;LogicAn-Modes:0..9, PulseGen-Modes:10..13
         cpi mode,10          ;Fuer LogicAnalyzer
         brcs RAMful1         ;erfolgt Datenausgabe.
         rjmp start           ;Fuer PulseGen ist Schluss..

RAMful1:
         cbi PORTD,ram_oe     ;RAM auf BUS legen

         ldi bufcntL,LOW (0x0000-2048) ;gesamten Speicher auslesen
         ldi bufcntH,HIGH(0x0000-2048) ;"

readRAM:
         in TXbyte,PINB       ;RAM lesen
         sbi PORTD,cntclk     ;counter-clock erzeugen
         cbi PORTD,cntclk     ;"
         rcall PutChar
         add bufcntL,aux1     ;incr. BufferCounter
         adc bufcntH,aux0     ;"
         brcc readRAM
         rjmp start



;-------------------------------------------------------------------
;Pulse-Generator, Range-1, Ti_min=1us, Tp_min=1us, Resolution=250ns
;Minimal: Ti=Tp=1us, Per=2us -> 500kHz
;Maximal: Ti=Tp=1us+(65535*250ns)=1us+16383.75us, Per=32769.5us
;-------------------------------------------------------------------
PG_Start0:
PG00:
         cbi PORTD,sample    ;Trigger-Pulse
         nop                 ;"
         sbi PORTD,sample    ;"
         mov TpCntL,TpL      ;load TpCounter
         mov TpCntH,TpH
PG01:
         add TpCntL,aux1     ;incr. TpCounter
         adc TpCntH,aux0     ;"
         brcc PG01
         brcs PG02
PG02:
         sbi PORTD,PGout
         mov TiCntL,TiL      ;load TiCounter
         mov TiCntH,TiH
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
         nop
PG03:
         add TiCntL,aux1     ;incr. TiCounter
         adc TiCntH,aux0     ;"
         brcc PG03
         cbi PORTD,PGout
         brcs PG00


;-------------------------------------------------------------------
;Pulse-Generator, Range-1, BurstMode
;-------------------------------------------------------------------
PG_Start1:
         cbi PORTD,sample    ;Trigger-Pulse
         nop                 ;"
         sbi PORTD,sample    ;"
         mov TnCntL,TnL      ;load Burst-Counter
         mov TnCntH,TnH
PG10:
         mov TpCntL,TpL      ;load TpCounter
         mov TpCntH,TpH
         nop
         nop
         nop
         nop
         nop
PG11:
         add TpCntL,aux1     ;incr. TpCounter
         adc TpCntH,aux0     ;"
         brcc PG11
         brcs PG12
PG12:
         sbi PORTD,PGout
         mov TiCntL,TiL      ;load TiCounter
         mov TiCntH,TiH
         nop
         nop
         nop
         nop
         nop
         nop
         nop
PG13:
         add TiCntL,aux1     ;incr. TiCounter
         adc TiCntH,aux0     ;"
         brcc PG13
         cbi PORTD,PGout
         add TnCntL,aux1     ;incr. BurstCounter
         adc TnCntH,aux0     ;"
         brcc PG10

         rjmp RAMfull

;-------------------------------------------------------------------
;Pulse-Generator, Range-2, Ti_min=125us, Tp_min=125us,
;Resolution=125us, Ti_max=Tp_max=65535*125us=8191.875ms (ca. 8.2s)
;-------------------------------------------------------------------
PG_Start2:

PG20:
         cbi PORTD,sample    ;Trigger-Pulse
         nop                 ;"
         sbi PORTD,sample    ;"
         mov TpCntL,TpL      ;load TpCounter
         mov TpCntH,TpH
         ldi temp,8
PG21:
         nop
         nop
         nop
         nop
PG21a:
         add temp,aux1
         nop
         brcc PG21
         ldi temp,6
         adc TpCntL,aux0     ;incr. TpCounter
         adc TpCntH,aux0     ;"
         brcc PG21a
         brcs PG22
PG22:
         sbi PORTD,PGout
         mov TiCntL,TiL      ;load TiCounter
         mov TiCntH,TiH
         ldi temp,8
         nop
         nop
         nop
         nop
         nop
         nop
         nop
PG23:
         nop
         nop
         nop
         nop
PG23a:
         add temp,aux1
         nop
         brcc PG23
         ldi temp,6
         adc TiCntL,aux0     ;incr. TiCounter
         adc TiCntH,aux0     ;"
         brcc PG23a
         cbi PORTD,PGout
         brcs PG20

;-------------------------------------------------------------------
;Pulse-Generator, Range-2, Burst-Mode
;-------------------------------------------------------------------
PG_Start3:
         cbi PORTD,sample    ;Trigger-Pulse
         nop                 ;"
         sbi PORTD,sample    ;"
         mov TnCntL,TnL      ;load Burst-Counter
         mov TnCntH,TnH
PG30:
         mov TpCntL,TpL      ;load TpCounter
         mov TpCntH,TpH
         ldi temp,8
         nop
         nop
         nop
PG31:
         nop
         nop
         nop
         nop
PG31a:
         add temp,aux1
         nop
         brcc PG31
         ldi temp,6
         adc TpCntL,aux0     ;incr. TpCounter
         adc TpCntH,aux0     ;"
         brcc PG31a
         brcs PG32
PG32:
         sbi PORTD,PGout
         mov TiCntL,TiL      ;load TiCounter
         mov TiCntH,TiH
         ldi temp,8
         nop
         nop
         nop
         nop
         nop
         nop
         nop
PG33:
         nop
         nop
         nop
         nop
PG33a:
         add temp,aux1
         nop
         brcc PG33
         ldi temp,6
         adc TiCntL,aux0     ;incr. TiCounter
         adc TiCntH,aux0     ;"
         brcc PG33a
         cbi PORTD,PGout

         add TnCntL,aux1     ;incr. BurstCounter
         adc TnCntH,aux0     ;"
         brcc PG30

         rjmp RAMfull

;***************************************************************************
;*
;* "putchar"
;* 发送一字节数据
;***************************************************************************

putchar:        out     UDR,Txbyte      ;Inverte everything
putchar0:       sbis    USR,TXC
                rjmp    putchar0
                sbi     USR,TXC
                ret                     ;   return

;***************************************************************************
;*
;* "getchar"
;*
;* 接收一字节数据
;***************************************************************************
getchar:        sbis USR,RXC
                rjmp getchar
                ret
 
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -