di2536l1.txt ;*************************************************************************************************** ; LISTING 1 - FOUR-CHANNEL PC-PORT WAVEFORM-SAMPLING ROUTINE ; ; "Use a PC to record four-channel waveforms," EDN, May 25, 2000, pg 114 ; ; http://www.ednmag.com/ednmag/reg/2000/052500/designideas.htm#11di3 ;*************************************************************************************************** ; ; Printer Status Register ; ; 7 6 5 4 3 2 1 0 ; ------------------------- ; | | | | | | | | | ; ------------------------- ; | | | | |------------- ERROR ; | | | |---------------- SLCT ; | | |------------------- PE ; | |---------------------- ACK ; |------------------------- BUSY ; ; ;sta_reg equ 0379h ;mask_reg equ 021h ; code segment para public 'code' assume cs:code org 100h begin: jmp main file_name db 'samsig.dat',0 msg db 'Sample Signal is saved in samsig.dat ! $' ; main proc near lea di,buffer mov dx,sta_reg pe_l: in al,dx ; PE is as Trigger Signal and al,20h jz pe_l ; When PE from 0 to 1, pe_h: in al,dx and al,20h ; Start Sampling. jz pe_h mov dx,mask_reg in al,dx or al,01h ; Mask Time Interrupt out dx,al mov dx,sta_reg mov cx,0f000h ; Sample Size sam_lp: in al,dx ; Even Sample shr al,1 shr al,1 shr al,1 shr al,1 xchg al,ah ; high nibble save in ah nop nop nop in al,dx ; Odd Sample and al,0f0h ; get low nibble or al,ah ; 2 nibble form 1 byte xor al,077h ; correct bits polarity stosb loop sam_lp mov dx,mask_reg in al,dx and al,0feh ; Allow Time Interrupt out dx,al create_file: lea dx,file_name ; memory is full, mov cx,0 ; save data to 'samsig.dat' file mov ah,3ch int 21h mov bx,ax write_data: mov cx,0f000h lea dx,buffer mov ah,40h int 21h close: mov ah,3eh int 21h lea dx,msg mov ah,9 int 21h int 20h main endp ; buffer: code ends end begin