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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? serialb.asm

?? USB大全電子版全部資料3~包含源碼、協議等
?? ASM
?? 第 1 頁 / 共 2 頁
字號:
;======================================================================

;		copyright 1997 Cypress Corporation

;======================================================================

; Designer:		J. Brown

; Date:		9/27/97

;======================================================================

; Part Number:	CY7C63000

; File:		Serial3.asm

; Rev:		1.0

;======================================================================

; Comments:

;

;	This code will send generic commands to

;	the RS-232 port of a serial device and reads back

;	the response character string.

;

;	This version of code provides a UART function

;	with the following characteristics:

;

;	1. 2400 baud

;	2. 1 start bit

;	3. 8 data bits

;	4. No parity bit

;	5. 1 stop bit

;

;	5. No framing error support.

;	6. No NACK support.

;	7. No retry support.

;

;======================================================================

; History:

;

; 12/30/97 :

; Clean-up of code for incoportaion to reference designs.

;

;	9/27/97 :

;	Initial code for generic Serial Interface.

;

;======================================================================

; Background:

;

;	The micro-controller transmits 4 character command codes.

;	Upon receipt of a command code, the target device responds with

;	a character string containing the requested information.

;	This character string is terminated with a carriage return/

;	line feed pair. The micro-controller then stores the character

;	string in a local RAM buffer while stripping the line feed

;	character. The carriage return character is retained as the

;	buffer's delimiter.

;

;	If the device receives an unrecognized command it will respond

;	with a NACK character (15h), indicating that the command is

;	unsupported on this model of the product.

;

;	If the miro-controller receives an invalid start bit, it will

;	return to the main routine and await a new start bit.

;

;	If the miro-controller does not detect that the current

;	character is a line feed character, it will retun to the main

;	routine and await the next character.

;

;	No time out retry features are implemented in this version of

;	code.

;

;	Note that all delay loops and time between receive and transmit

;	are dependent on the response timing of the RS-232 peripheral.

;	These relanionships must be adjusted in each design to provide

;	stable communications. This behaviour is due to the lack of

;	hardware handshaking with the peripheral.

;

;	Limited software handshaking is provided by detection of the

;	carriage_return/line_feed pair string terminator.

;

;**********************************************************************

;************************ assembler directives ************************ 

;

;label:          XPAGEON

;

; I/O ports

Port0_Data:		    equ 00h ; GPIO data port 0

Port1_Data:		    equ 01h ; GPIO data port 1

Port0_Interrupt:	equ 04h ; Interrupt enable for port 0

Port1_Interrupt:	equ 05h ; Interrupt enable for port 1

Port0_Pullup:	    equ 08h ; Pullup resistor control for port 0

Port1_Pullup:	    equ 09h ; Pullup resistor control for port 1

;

; GPIO current sink register

Port0_Isink0:	    equ 30h ; 

;

; Variable memory allocations

innerDelayOneCount: equ 3Ah ; Delay One: Inner delay count 

outerDelayOneCount: equ 3Bh ; Delay One: Outer delay count 

innerDelayCount:	  equ 3Ch ; Delay: Inner delay count 

outerDelayCount:	  equ 3Dh ; Delay: Outer delay count 

rxEnable:		        equ 40h ; Receiver Enabled Flag

rxBitCount:		      equ 42h ; Recieve Bits Count

rxFrameCount:	      equ 44h ; Recieve Frame Count

rxData:		          equ 46h ; Receive Data Holding Register

rxBufPtr:		        equ 48h ; Receive Buffer Pointer

rxFrameFlag:	      equ 4Ah ; Framing Error Flag (0=No,1=Yes)

rxPassCount:	      equ 4Bh ; Transmit Buffer Pointer

rxBuf:		          equ 50h ; Recieve Buffer Start

rxBufEnd:		        equ 5Fh ; Recieve Buffer End

txEnable:		        equ 41h ; Transmiter Enabled Flag

txBitCount:		      equ 43h ; Transmit Bits Count

txFrameCount:	      equ 45h ; Transmit Frame Count

txData:		          equ 47h ; Transmit Data Holding Register

txBufPtr:		        equ 49h ; Transmit Buffer Pointer

txBuf:		          equ 4Ch ; Transmit Buffer Start (4 Bytes)

;

; Constant declarations

; Transmit counter values

txStart:	  equ 00h ; Start bit begin

txBit0:	    equ 03h ; Start bit end

txBit1:	    equ 07h ; Data bit 0 end

txBit2:	    equ 0Ah ; Data bit 1 end

txBit3:	    equ 0Dh ; Data bit 2 end

txBit4:	    equ 10h ; Data bit 3 end

txBit5:	    equ 14h ; Data bit 4 end

txBit6:	    equ 17h ; Data bit 5 end

txBit7:	    equ 1Ah ; Data bit 6 end

txStop:	    equ 1Dh ; Data bit 7 end

txComp:	    equ 20h ; Stop bit end

;

txDataMask: equ FEh ; Mask to preserve inputs.

;

; Receive counter values

rxStart:    equ 01h ; Start bit center

rxBit0:	    equ 05h ; Data bit 0 center

rxBit1:	    equ 09h ; Data bit 1 center

rxBit2:	    equ 0Ch ; Data bit 2 center

rxBit3:	    equ 0Fh ; Data bit 3 center

rxBit4:	    equ 12h ; Data bit 4 center

rxBit5:	    equ 16h ; Data bit 5 center

rxBit6:	    equ 19h ; Data bit 6 center

rxBit7:	    equ 1Ch ; Data bit 7 center

rxStop:	    equ 1Fh ; Data bit 7 center

rxComp:	    equ 22h ; Stop bit center

lastrxBit:  equ 07h ; Last receive data bit count

;

; Interrupt masks

GPIO_intMask:	  equ 40h ; Mask for Port 0 GPIO interrupts.

128us_intMask:	equ 02h ; Mask to enable 128us only.

;

; ASCII Characters for commands

;Car_Ret:	  equ 0Dh ; Carriage Return Terminator

;Ln_Fd:	    equ 0Ah ; Line Feed Terminator

;Asc_Space:	equ 20h ; ASCII Space Character

;

;************************************************************************

; If we are recieving a byte of data from the serial channel we need to

; go to the receive subroutine.

Serial_ISR:

	push	A                     ;

	push X                      ;

	mov	A, [rxEnable]           ; Load the receive enable flag.

	cmp	A, 0 			              ; Check for receive in progress.

	jnz	Increment_rxFrameCount  ; Yes, go receive.

;************************************************************************

; If we are sending a byte of data to the serial channel we need to

; go to the transmit subroutine.

;

	mov	A, [txEnable]           ; Check for transmit in progress.

	cmp	A, 0                    ;

	jnz	Increment_txFrameCount  ; Yes, go transmit.

	jmp	done_Serial             ; Default

;

; We are transmitting.

Increment_txFrameCount:

	inc	[txFrameCount]          ; Adjust frame count.

	mov	A, [txFrameCount]       ; Put it in the accumulator

	mov	[txBitCount], A         ; Save it as the new bit count

	jmp	done_Serial             ; Finished

;

; We are receiving.

Increment_rxFrameCount:

	inc	[rxFrameCount]          ; Adjust frame count.

	call	rxRoutine             ; Go get a character

	pop X                       ;

	mov	A, 00h                  ; Disable interrupts and return.

	ipret	Global_Interrupt      ;

;

; Finish the interrupt handling

done_Serial:

	pop X

	mov	A, 128us_intMask        ; Load 128us ISR Enable value

	ipret	Global_Interrupt      ; Return and enable 128us ISR

;

;************************************************************************

; The GPIO interrupt will occur at the start of a receive data byte.

; The low going start bit will trigger the GPIO_ISR.

;

GPIO_ISR:

	push	A	; save the accumulator to stack

	push	X	; save X on stack



; Three steps for detecting the start bit:

; 1.) Check that the receiver generated the interrupt.

;	iord	[Port0_Data]	;

;	and	A, 80h          ;

;	jz	GPIO_ISR_Done   ;

;	jnz	GPIO_ISR_Done	  ;

;

; 2.) Set the receive enable bit.

	mov	A, 01h		          ; Load the accumulator.

	mov	[rxEnable], A	      ; write to the receive enable flag.

;

; 3.) Clear the receive data register.

	mov	A, 00h		          ; Clear the accumulator.

	mov	[rxData], A		      ; Clear the receive data register.

;

GPIO_ISR_Done:

	pop	x			              ; Restore the index register.

	mov	A, 128us_intMask	  ; Load the 128us interrupt mask.

	ipret	Global_Interrupt	; Return to caller.

					                ; 128us interrupt enabled.

;

;************************************************************************

; During serial transfers data bit 0 is transmitted first.

; We will use Port 0 Bit 7 for receive and Bit 0 for transmit.

; Data will always be right shifted for either transmit or receive.

; Port 0 Bit 7 will be a falling edge sensitive GPIO_ISR input.

; Port 0 bits 6-0 and Port 1 bits 3-0 will be outputs.

;

SerialInitialize:

	push	A			        ; Save the accumulator.

	push	X			        ; Save the index.

	mov	A, FFh		      ; load accumulator with ones

	iowr	Port0_Data		; output ones to port 0

	iowr	Port1_Data		; output ones to port 1

;

	mov	A, 00h		; load accumulator with zeros

	iowr	Port0_Pullup	; enable port 0 pullups

	iowr	Port1_Pullup	; enable port 1 pullups

;

	iowr	Port0_Interrupt	; disable port 0 interrupts

	iowr	Port1_Interrupt	; disable port 1 interrupts

;

	mov	A, 08h		      ; load accumulator with med sink

	iowr	Port0_Isink0	; minimum sink current Port0 bit 0

;

;	iowr	Watchdog		  ; clear watchdog timer

;

; Clear the serial channel counters.

	mov	A, 00h

	mov	[rxEnable], A	    ; Clear rxEnable Flag

	mov	[rxBitCount], A	  ; Clear rx bit count.

	mov	[rxFrameCount], A	; Clear rx frame counter.

	mov	[rxBufPtr], A	    ; Clear rx buffer Pointer.

	mov	[txEnable], A	    ; Clear txEnable Flag.

	mov	[txBitCount], A	  ; Clear tx bit count.

	mov	[txFrameCount], A	; Clear tx frame counter.

	mov	[txBufPtr], A	    ; Clear tx buffer Pointer.

;

	mov	A, 81h		        ; Enable port0 bit7 as input.

	iowr	Port0_Data		  ; All other bits are outputs.

	mov	A, 7Eh		        ; Select falling edge interrupt

	iowr	Port0_Pullup	  ; on port0 bit7.

	mov	A, 00h		        ;

	iowr	Port0_Interrupt	; Disable port 0 bit 7 interrupt.

;

	mov	[txBufPtr], A	      ; Reset tx buffer pointer.

	mov	[interrupt_mask], A ; Default all interrupts to disabled.

	pop	X			              ; Restore the index.

	pop	A			              ; Restore the accumulator.

	ret				              ; Return to caller.

;************************************************************************

; TX_Data processing:

; This routine will write a byte of data.

; 1.) Send the active low Start bit.

; 2.) Send eight variable data bits.

; 3.) Send the active high Start bit.

; 4.) Stay in transmit until complete.

;************************************************************************

;

txRoutine:

;  Prepare for the transmit.

	push	A			          ; save accumulator.

	mov	A, 01h		        ; Load txEnable Flag.

	mov	[txEnable], A	    ; Store txEnable Flag.

	mov	A, [txFrameCount]	; Get frame count.

	mov	[txBitCount], A	  ; Save bit count.

;

sendStart:

;  Write out the start bit. (active low)

	mov	A, FEh		          ; Load tx Start bit.

	iowr	Port0_Data		    ; Send tx Start bit.

	mov	A, 02h		          ; Load 128us ISR Enable value.

	iowr	Global_Interrupt	; Enable 128us ISR.

;

;  Check the bit count and send a bit if required.

check_tx_bit:

	mov	A, [txBitCount]	; Get frame count

	cmp	A, txBit0		; tx bit 0 at frame count=03h

	jz	sendtxBit		; Go send data bit

	cmp	A, txBit1		; tx bit 1 at frame count=07h

	jz	sendtxBit		; Go send data bit

	cmp	A, txBit2		; tx bit 2 at frame count=0Ah

	jz	sendtxBit		; Go send data bit

	cmp	A, txBit3		; tx bit 3 at frame count=0Dh

	jz	sendtxBit		; Go send data bit

	cmp	A, txBit4		; tx bit 4 at frame count=10h

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久亚洲私人国产精品va媚药| 亚洲午夜久久久久中文字幕久| 亚洲免费视频成人| 国内精品免费**视频| 欧美亚洲国产bt| 国产精品美女久久久久久久| 日本人妖一区二区| 97久久人人超碰| 久久久精品tv| 另类小说综合欧美亚洲| 欧美视频一区二区三区在线观看| 国产蜜臀av在线一区二区三区| 日产国产高清一区二区三区| 一本大道久久a久久综合| 欧美激情一区二区| 国产在线一区观看| 日韩视频一区二区在线观看| 国产很黄免费观看久久| 欧美日韩一二三| 洋洋av久久久久久久一区| 成人av电影在线| 中文一区二区完整视频在线观看| 精品一区二区国语对白| 日韩一级片在线观看| 亚洲国产aⅴ天堂久久| 91麻豆文化传媒在线观看| 国产欧美日韩综合精品一区二区| 美女视频黄久久| 精品国产乱码久久久久久闺蜜| 日韩一区精品视频| 欧美三区免费完整视频在线观看| 一区二区三区中文在线观看| 99精品久久久久久| 亚洲久本草在线中文字幕| 91污片在线观看| 一区二区免费在线播放| 欧美曰成人黄网| 天天操天天综合网| 欧美一区二区私人影院日本| 男女男精品网站| 精品久久久久久无| 国产精品自拍网站| 国产精品久久777777| 91年精品国产| 亚洲国产成人av网| 日韩精品中文字幕在线不卡尤物| 麻豆成人免费电影| 日本一区二区三区免费乱视频 | 麻豆国产精品777777在线| 欧美一区二区三区不卡| 美腿丝袜亚洲一区| 日韩欧美中文字幕公布| 樱花影视一区二区| 国产一区二区三区四区五区入口 | 成人h动漫精品一区二区| 欧美主播一区二区三区| 日韩一级二级三级精品视频| 亚洲综合一二三区| 精品一区二区三区免费观看| 一本到不卡精品视频在线观看| 欧美夫妻性生活| 欧美丰满一区二区免费视频| 欧美系列日韩一区| 色诱视频网站一区| 粉嫩av一区二区三区在线播放| 91一区二区三区在线观看| 成人视屏免费看| 91久久精品国产91性色tv| 美女视频黄久久| 中文字幕在线不卡一区| 天堂精品中文字幕在线| 麻豆精品视频在线观看| 日本高清不卡视频| 久久午夜国产精品| 日韩精品电影在线| 91九色最新地址| 麻豆精品国产91久久久久久| 中文字幕在线不卡一区| 99久久伊人网影院| 亚洲小说欧美激情另类| 亚洲精品一区二区三区99| 色综合一区二区| 黄一区二区三区| 亚洲国产一区二区在线播放| 国产亚洲欧美在线| 91精品国产综合久久精品麻豆| 国产91高潮流白浆在线麻豆| 午夜精品爽啪视频| 国产精品久久久久久久久快鸭 | 久久精品在线免费观看| 在线一区二区三区四区五区| 国产激情视频一区二区在线观看| 天天做天天摸天天爽国产一区| 一区二区中文视频| 日韩欧美的一区| 欧美人与z0zoxxxx视频| 91丨九色丨黑人外教| 国产一区二区三区电影在线观看 | 狠狠色综合日日| 首页欧美精品中文字幕| 亚洲综合一二区| 亚洲欧美怡红院| 中文字幕+乱码+中文字幕一区| 精品人在线二区三区| 欧美三级日韩三级国产三级| 91一区在线观看| 95精品视频在线| aaa欧美大片| 成人a级免费电影| 国产98色在线|日韩| 国产麻豆欧美日韩一区| 另类成人小视频在线| 蜜臀av性久久久久蜜臀aⅴ流畅 | 麻豆成人久久精品二区三区红| 亚洲国产精品久久久男人的天堂 | 国产欧美日韩激情| 久久久久久久久久电影| 精品99999| 久久亚洲私人国产精品va媚药| 精品欧美乱码久久久久久1区2区| 日韩欧美二区三区| 精品国产一区二区国模嫣然| 337p日本欧洲亚洲大胆色噜噜| 日韩精品最新网址| 欧美成人video| 久久一日本道色综合| 久久久久国产精品人| 中文在线资源观看网站视频免费不卡| 国产人久久人人人人爽| 国产精品无人区| 一区二区日韩电影| 午夜伊人狠狠久久| 久草这里只有精品视频| 国产乱理伦片在线观看夜一区| 在线电影院国产精品| 欧美一级免费大片| 久久久久久麻豆| ●精品国产综合乱码久久久久| 一区二区三区中文字幕| 日精品一区二区三区| 国产一区二区三区香蕉| 菠萝蜜视频在线观看一区| 色爱区综合激月婷婷| 欧美一级电影网站| 中文字幕av一区二区三区| 亚洲狠狠爱一区二区三区| 午夜国产不卡在线观看视频| 国产在线播放一区三区四| 99久久精品国产麻豆演员表| 欧美精品aⅴ在线视频| 久久久久久久久久久黄色| 亚洲欧美日韩电影| 免费在线欧美视频| 成人中文字幕电影| 欧美麻豆精品久久久久久| 久久久久综合网| 亚洲综合av网| 国产黄色成人av| 精品1区2区3区| 国产欧美一区二区在线观看| 亚洲一区二区视频在线| 国产自产高清不卡| 欧美性一区二区| 国产精品国产三级国产普通话蜜臀| 亚洲一卡二卡三卡四卡| 国产一区啦啦啦在线观看| 欧美日韩一区高清| 亚洲国产高清aⅴ视频| 日本中文在线一区| 色综合视频在线观看| 久久在线免费观看| 日韩高清一区二区| 色香色香欲天天天影视综合网| 精品少妇一区二区三区日产乱码| 亚洲精品免费在线播放| 国产激情一区二区三区四区| 欧美一区二区视频在线观看 | 欧美一级一区二区| 亚洲另类中文字| 成人国产一区二区三区精品| 日韩精品一区二区三区swag | 欧美精品vⅰdeose4hd| 国产精品国产三级国产| 国产一区二区三区免费看| 91精品久久久久久久99蜜桃 | 亚洲bt欧美bt精品777| k8久久久一区二区三区| 精品国产在天天线2019| 免费亚洲电影在线| 欧美日韩国产系列| 亚洲一级片在线观看| 日本电影欧美片| 综合中文字幕亚洲| www.日韩av| 国产精品成人免费| www.性欧美| 亚洲欧美日韩国产综合在线| 99精品黄色片免费大全| ●精品国产综合乱码久久久久| 国产91对白在线观看九色|