亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? pckb.asm

?? 把PC鍵盤變成MIDi音符控制適配器電路單片機(jī)程序
?? ASM
?? 第 1 頁 / 共 3 頁
字號(hào):
;  ****************************************************************
;  *   PCkb.asm 
;  *
;  *     version 1.32   Oct 12, 2003   Alan Probandt   Portland Oregon USA
;  *
;  *  [ Use TimesNewRoman font in text editor to format this file correctly ]
;  *
;  *  [ when programming the AVR chip, don't forget to include the EEPROM file]
;  *
;  *    Read keypresses from PC Keyboard into Atmel AVR 90S2313
;  *        -Assemble logic changes on AVR pin 6 into PC keyboard scan codes.
;  *    	-Decode keyboard scancodes into MIDI note numbers.
;  *     	-Send MIDI messages out the MIDI out port  31250/8/N/1
;  *
;     Key Pad - pressing two digits on the keypad changes the voice number.
;   			for example,  pressing '3' then '7' selects voice number 37 (in decimal).
;
;  *   PC keyboard clock signal on AVR pin 6 (INT1)
;  *   PC keyboard data signal on AVR pin 7 (PORTD bit 4)
;  *	MIDI out (31250 baud - 8/N/1) on AVR pin 8 (PB4)
;    
;					Atmel AVR 2313
;   	RESET low	PIN 1 		| VCC  PIN 20 +5V
;   				PIN 2 PD0	| PB7  PIN 19  SCK 
;   				PIN 3 PD1 	| PB6  PIN 18  
;   	3.579MHz 	PIN 4 XTAL1	| PB5  PIN 17  
;    must use only  PIN 5 XTAL2	| PB4  PIN 16  
;  	INT0 kbd clk	PIN 6 PD2 	| PB3  PIN 15  
;   INT1 kbd data 	PIN 7 PD3 	| PB2  PIN 14  
;   	MIDI out	PIN 8 PD4  	| PB1  PIN 13  
;   	 			PIN 9 PD5  	| PB0  PIN 12 
;   				PIN 10 GND	| PD6  PIN 11 
;    
;  ************************************************************

.nolist
.include "2313def.inc"
.list


.equ	MIDItx				= 4	 ; MIDI Transmit pin 8 (PB4)
.equ	INITIAL_BITCOUNT 	= 11   ;  used by Get_Scan
.equ	PARITY_BITCOUNT 	= 3    ;  used by Get_Scan
.equ	NOTEOFFSET			= 34  ; check for adjustment -- Is 'Z' key really Middle C?
.equ	CHANGE_VOICE_OFFSET = $2e
.equ	SPACEBAR_OFFSET		= $2d
.equ	REGISTER_AVAILABLE	= $FF
.equ	POSSIBLE_NOTES 		= 8
.equ	NOTE_ON_VELOCITY  	= 0x50
.equ	NOTE_OFF_VELOCITY  	= 0
.equ	NOTE_ON_MSG 		= $90
.equ	CHANGE_VOICE_MSG 	= $c0
.equ	MIDI_CONTROLLER_MSG = $b0
.equ	ALL_NOTES_OFF_BYTE 	= 123 ; standard cmd $7b doesn't work on TQ5
.equ	ALL_NOTES_OFF_2nd 	= 0
.equ	CapsToggleValue		= 0b01000000

.equ	T_flag 		= 6
.equ	Sign_flag	= 4
.equ	KeyboardClock  = 2
.equ	KeyboardData= 3
.equ	SM_flag		= 4 ; Sleep Mode (unused) - delay loop counter bit flag { 0 = long period is timed out}
.equ PushSwitch1  	= 4

; keyflag register's bit values
.equ	Edge_flag	= 7 	; use up or down edge while inputting char from keyboard
.equ	Caps_flag	= 6   ; Caps Lock pressed on -- no NoteOff transmitted
.equ	Shift_flag	= 5	; the shift key (either right or left) is being pressed  
.equ	Break_flag	= 4	; the last scancode was an $f0 - the break code sent when a key is released
.equ	OnOff_flag	= 3	; set means turn on the note whose MIDI number was decoded from the most recent scancode
.equ	Alt_flag	= 2	;  the Alternate (Alt) key (either right or left) is being pressed  
.equ	E0_flag		= 1	; the extended scancode $E0 was sent


;*********************************************************************************************
;  Register definitions
;
;  lower registers  r0 - r15
; r0 is temporary storage of byte retrieved from LPM instruction
.def	OctaveOffset		= r1 
.def  	CurrentVoiceNumber 	= r2
.def  	txbitcnt			= r3		; used by PutMIDI
.def	TableOffset 		= r5		;  used by PCKB_main to keep track of where a keypress has been found in a table
.def	MIDIcounter			= r6		; FastMIDINumbers, SlowMIDINumbers - which MIDI number is being sent
.def	regcnt				= r6		;  used by PCKB_main to keep track of which notes are playing by having keys held down
.def	OverflowCount		= r6		;  used by T0_overflow IRQ to time a quarter-second
.def	KPtemp				= r6		; used by PCKB_main to multiply keypad digit by 10
.def	ParityCounter		= r7        ; count the number of logic hi bits transmitted by the keyboard command output routine
.def	SustainValue		= r7

;  upper registers
.def	temp				= r16	; scratch register
.def	irqtemp				= r17  	; interrupt's scratch register
.def	bitcount			= r18	; used by INT0 irq  [getscan]	
.def  	scancode			= r19	; storage of data bits received from PC keyboard 
.def	scanbits			= r20 	; shift register for holding PC keyboard data while being assembled
.def	keyflags			= r21	; status of previous scancodes. used to decode multiple scancode keypresses
.def	DecodeValue			= r22  	; PC keyboard char decoded to NoteOn value, ChangeVoice value, or AllNotesOff cmd
.def	KPvalue				= r23	; the binary value of the pressed keypad digits. Used for new voice value.
.def	Velocity			= r24	; the MIDI note-On volume value
.def  	TxData  			= r25  	; the byte being sent out the MIDI port - PutMIDI

.dseg
.org 0x60
FNtable:			.BYTE	12
SoundingNotes:		.BYTE	POSSIBLE_NOTES

.cseg
.org $0000     
; AT90S2313 interrupt table                                                    
	rjmp		reset		; Reset handler   $000

.org INT0addr
	rjmp		get_scan	; External interrupt 0 handler  $001 (pin 6)  PC keyboard clock

.org INT1addr
	reti					; External interrupt 1 handler  $002

.org ICP1addr
	reti					; Timer1 capture event handler  $003     

.org OC1addr
	reti					; Timer1 compare match     $004

.org OVF1addr
	reti					; Timer1 overflow handler  $005

.org OVF0addr
	reti					; Timer0 overflow handler  $006

.org URXCaddr
	reti					; UART Rx Complete	$007

.org UDREaddr
	reti					; UART Data Register empty $008

.org UTXCaddr
	reti					; UART Tx Complete	$009

.org ACIaddr
	reti					; Analog comparator handler $00a

reset:
		ldi		temp, RAMEND
		out		SPL ,temp			; init Stack Pointer 
        	
; set-up ports for input/output and pull-up resistors
		ser		temp
		out		portb,temp	; port B pull-up resistors are all on
		out		portd,temp	; port D pull-up resistors are all on 
		clr		temp
		out		ddrb,temp  ; port b is all inputs  
		ldi		temp,(1<<MIDItx) 
		out		ddrd,temp  ; port D4 is output for MIDI


;*******************************************************************************************
;
;    	Get keypresses from standalone PC keyboard - convert to notes and send to MIDI port
;
;    	Subroutines:	'decode_data'
;
;	Interrupt procedures:	external interrupt int0 -- 'getscan'
;
;   Most time spent in 'GetChar' which checks T flag for fully received keypress from PC keybrd
;   When T is set, 'decode_data' called to convert keypress to note or cmd.
;*******************************************************************************************
;
PCkb_Main:
		ldi		temp,(1<<ISC01) ; setup INT0 interrupt on falling edge
		out		MCUCR, temp  	
		ldi		temp, (1<<INT0)
		out		GIMSK,temp      ;  enable external INT0 - General Interrupt Mask Register
		sei		; switch on the AVR general interrupt enabler
		clr		keyflags 
		clr		KPvalue
		ldi		bitcount,INITIAL_BITCOUNT ; = 11
		clt		;   T flag used to indicate that a char from kybd is ready to transmit
		ldi		temp, NOTEOFFSET
		mov		OctaveOffset, temp
		
		clr		temp				; set up the Function key voice select table with voices 00 - 0b
		ldi		ZH, high (FNtable)
		ldi		ZL, low (FNtable)
rst2:	st		z+, temp
		inc		temp
		cpi		temp, 12			; the number of Function keys on a PC keyboard
		brlo	rst2
		
		clr		CurrentVoiceNumber		; set synth voice to 00h on AVR reset
		rcall	ChangeVoice

		
; setup completed -------- enter MAIN LOOP here
	    
GetChar:in		temp, SREG ; MAIN LOOP of program  99.9% of time spent here
	   ; if T flag (SREG bit 6) is set, then char from keyboard is ready to transmit
		sbrs	temp,T_flag   ; if T flag (SREG bit 6) is set, then char from keyboard is ready to transmit
		rjmp	GetChar

		clt			 ; clear T flag - prepare for next char
		rcall	decode_data  ; convert the scancode from the keyboard into an ASCII character
								; send scancode and keyflags - return DecodeValue
		tst		DecodeValue    ; if DecodeValue =0, then ignore scancode - it's a shift character or break scancode
		brne	Valid_key     
		rjmp	GetChar

; DecodeValue less than $3f turns on/off note, $80-$89 are keypad numbers, $40-$4b map function keys F1 to F12, $c0 is spacebar
Valid_key:
		cpi		DecodeValue, $c0	; space bar key
		breq	DoSubAllNotesOff
		
		mov		temp, DecodeValue
		andi	temp,0xc0
		cpi		temp,0x40			; is the scancode a Function key activation?
		brne	VkyKP			; no, check for keypad press
		rjmp	FnKeyChangeVoice
		
VkyKP:	mov		temp, DecodeValue	; is the scancode a keypad press?
		andi	temp,0xc0			;  isolate the two most significant bits   1100 0000
		cpi		temp,0x80			;  test if the two most sig bits are '10'
		brne	VkyMN			; no, not a keypad press. So must be a note on/off.
		rjmp	DoKeyPad		; yes, scancode is a keypad activation.
		
VkyMN:	andi	DecodeValue,0b00111111 ; DecodeValue is lower than $3f
		rjmp	DoNote  
	
DoSubAllNotesOff:
		rcall	AllNotesOff
		rjmp	GetChar
		
;*********************************************************
;  Function Key Press  -  Assign Voice number to Fn key
;*********************************************************
FnKeyChangeVoice:
		mov 	temp,DecodeValue  ; DV will be $40 to $4b
		andi	temp, 0b00001111
		; check Alt flag, if set then assign the Current Voice Number into the selected Function key.
		;  if Alt flag is clear, then change voice to the number assigned to the selected Function key.
		sbrs	keyflags, Alt_Flag
		rjmp	FKCV0			; Alt_flag is set so jump to FKCV0
		ldi		ZH, high (FNtable)   ; get the Function key's voice number
		ldi		ZL, low (FNtable)
		add		ZL, temp			; ZL plus Function key number will never be greater than $ff
		st		z, CurrentVoiceNumber
		rjmp	FKCV2
FKCV0:	ldi		ZH, high (FNtable)   	; Alt_key is not pressed - Fn key pressed by itself
		ldi		ZL, low (FNtable)	;- send to the synth the number assigned to the pressed Function key
		add		ZL, temp			; ZL plus Function key number will never be greater than $ff
FKCV1:	ld		temp, z
		mov		CurrentVoiceNumber, temp
		rcall	ChangeVoice
FKCV2:	rjmp	GetChar	
	
;***************************************************************************
;   Key Pad  - pressing two digits on the keypad changes the voice number.
;   for example,  pressing '3' then '7' selects voice number 37 (in decimal).
;****************************************************************************
DoKeyPad: 
		mov 	temp,DecodeValue  ; DV will be $80 to $8f
		andi	temp, 0b00001111
;  check if keypress is a digit.  If yes, then check if 1st, 2nd, or third digit of voice number in base10
		cpi		temp, 10
		brlo	KP_digit    ; yes it's a digit (0 to 9)
		cpi		temp, $0a ; was the NumLock key pressed
		brne	KP_isStar  ; no
		rjmp	GetChar	; yes,  do nothing for now
KP_isStar: cpi	temp, $0b  ; was the multiply on the keypad pressed?	
		brne	KP_isMinus  ; no
		rjmp	GetChar	; yes,  do nothing for now	
KP_isMinus: cpi	temp, $0c ; was the minus sign on the keypad pressed?	
		brne	KP_isPlus ; no
		rjmp	GetChar	; yes,  do nothing for now	
KP_isPlus: cpi	temp, $0d  ; was the plus sign on the keypad pressed?	
		brne	KP_isPoint ; no
		rjmp	GetChar	; yes,  do nothing for now		
KP_isPoint: cpi	temp, $0d  ; was the decimal point on the keypad pressed?	
		brne	KP_exit 	; no

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡一二三区首页| 从欧美一区二区三区| 国产婷婷一区二区| 欧美色综合网站| 在线视频观看一区| 91美女在线视频| 欧美色欧美亚洲另类二区| 97aⅴ精品视频一二三区| 日本高清视频一区二区| 欧美日韩一区二区在线观看| 精品精品欲导航| 国产成人综合在线| 一区二区三区四区激情| 日产欧产美韩系列久久99| 免费欧美在线视频| 国产乱淫av一区二区三区 | 成人黄色一级视频| 一本色道久久综合亚洲aⅴ蜜桃 | 亚洲成人www| 国产揄拍国内精品对白| 色偷偷久久一区二区三区| 欧美成人福利视频| 一区二区三区欧美在线观看| 亚洲精品第1页| 国产精品91一区二区| 91网站黄www| 中文字幕中文字幕中文字幕亚洲无线| 午夜精品福利一区二区三区av | zzijzzij亚洲日本少妇熟睡| 色婷婷亚洲一区二区三区| 国产欧美一区二区三区在线看蜜臀 | 亚洲视频香蕉人妖| 蜜桃精品视频在线观看| 欧美一级久久久久久久大片| 亚洲成av人片在www色猫咪| aaa欧美大片| 亚洲精品一二三四区| 国产成人精品免费网站| 国产精品美女久久久久久2018 | 一区二区三区在线不卡| 亚洲成人激情自拍| 丁香激情综合国产| 亚洲欧洲日韩一区二区三区| 精品一区二区三区免费观看| 欧美日韩久久一区| 中文字幕 久热精品 视频在线| 国产成人啪免费观看软件| 亚洲同性gay激情无套| 国产91精品一区二区麻豆网站 | 日韩免费高清电影| 亚洲特黄一级片| 色综合色综合色综合色综合色综合 | 亚洲国产精品二十页| 色综合天天性综合| 亚洲国产中文字幕在线视频综合| 91网站在线播放| 成人精品国产一区二区4080| 成人开心网精品视频| 日韩女优制服丝袜电影| 国产婷婷精品av在线| 97久久精品人人做人人爽 | 日韩欧美亚洲国产另类| 国产麻豆视频精品| 亚洲视频在线一区二区| 欧美电视剧在线看免费| 欧美午夜片在线观看| 懂色一区二区三区免费观看 | av在线不卡免费看| 91麻豆精品国产91久久久久久久久 | 在线观看成人小视频| 国产一区美女在线| 免费成人美女在线观看.| 午夜精品福利在线| 亚洲女子a中天字幕| 久久九九影视网| 成人毛片视频在线观看| 国产三级久久久| 国产一区欧美一区| 午夜精品免费在线观看| 中文字幕 久热精品 视频在线 | 麻豆精品久久精品色综合| 中文字幕亚洲精品在线观看| 久久久精品综合| 国产精品污www在线观看| 欧美国产精品v| 欧美日本乱大交xxxxx| 色悠悠久久综合| 91亚洲精品一区二区乱码| 99re66热这里只有精品3直播| 91视频一区二区| 欧美日韩大陆在线| 久久精品一区四区| 免费三级欧美电影| 91麻豆视频网站| 日韩免费观看高清完整版| 亚洲精品少妇30p| 日本不卡不码高清免费观看| 国产一区二区美女| 成人的网站免费观看| 91影院在线观看| 欧美视频在线一区二区三区| 欧美人妇做爰xxxⅹ性高电影| 久久久久久久国产精品影院| 亚洲一区二区三区自拍| 精品一区二区三区欧美| 欧美日韩精品一区二区三区四区 | 2017欧美狠狠色| 日韩高清不卡一区| 欧美绝品在线观看成人午夜影视| 国产精品―色哟哟| 972aa.com艺术欧美| 亚洲激情欧美激情| 91蝌蚪porny成人天涯| 亚洲激情五月婷婷| 一本到一区二区三区| 亚洲自拍偷拍综合| 欧美精品久久天天躁| 亚洲国产精品欧美一二99| 91精品国产入口| 国产suv一区二区三区88区| 一区精品在线播放| 欧美中文字幕一区二区三区| 亚洲电影一区二区三区| 欧美日韩aaaaaa| 国产麻豆一精品一av一免费| 亚洲天堂a在线| 日韩一区二区三区观看| 国产v综合v亚洲欧| 欧美一二三四区在线| 色先锋aa成人| 久久久三级国产网站| 国产在线播精品第三| 欧美变态tickling挠脚心| 久久69国产一区二区蜜臀| 国产精品超碰97尤物18| 日韩精品综合一本久道在线视频| 成人18精品视频| 国产精品一二三在| 亚洲综合一区在线| 久久综合色综合88| 欧美日本韩国一区| 色狠狠一区二区三区香蕉| 日本欧洲一区二区| 亚洲欧洲综合另类| 亚洲专区一二三| 亚洲电影视频在线| 美女一区二区视频| 久久er精品视频| 亚洲欧洲日本在线| 在线综合视频播放| 成人午夜免费电影| 舔着乳尖日韩一区| 国产精品久久久久一区二区三区 | 不卡一区二区三区四区| 精品成人私密视频| 另类成人小视频在线| 亚洲欧美日韩一区| 亚洲男人天堂一区| 国产精品久久久久久一区二区三区| 久久午夜国产精品| 国产精品免费av| 欧美成人国产一区二区| 不卡的av电影在线观看| 日韩欧美一级片| 久久精品久久综合| 美国欧美日韩国产在线播放| 一区二区三区毛片| 国产高清在线精品| 亚洲二区在线视频| 日韩电影免费在线看| 三级不卡在线观看| 最新国产精品久久精品| 亚洲国产电影在线观看| 欧美巨大另类极品videosbest| 91久久精品国产91性色tv| 久久精品国产亚洲5555| 成人影视亚洲图片在线| 91网站最新地址| 欧美成人a视频| 亚洲少妇30p| 日本sm残虐另类| 色老汉av一区二区三区| 中文字幕欧美国产| 国产成人福利片| 91精品国产一区二区| 欧美国产国产综合| 国模大尺度一区二区三区| 欧美在线|欧美| 亚洲福中文字幕伊人影院| 国产精品996| 欧美一级精品大片| 午夜婷婷国产麻豆精品| 青青草国产成人99久久| 欧美色综合网站| 日日骚欧美日韩| 国产精品系列在线播放| 欧美mv和日韩mv的网站| 另类小说图片综合网| 精品一区二区三区的国产在线播放| www.亚洲免费av|