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

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

?? 用pic12c509 控制led.txt

?? 包括很多單片機開發用的元代碼
?? TXT
字號:

  PIC12C509 - Getting Around the Stack Limitation 
The 12C5 series PIC has only a two level stack which limits the number of nested subroutine calls to two. This may be a very serious limitation. 

(The 16C84 has an eight level stack which permits nested subroutines to eight deep. I can't imagine a program where this will not be sufficient). 

In the following programs an alternative user stack is presented which provides the programmer with alternative "call" and "return" capability. 

Note that a user stack is implemented using the highest data address. The idea is that the user stack grows down from 1FH, while user variables are assigned from 07H and up. Thus, the degree of nesting permitted using this approach is the full variable space (25) less the number of bytes which are used as variables in the program. 

There are two other limitations to this approach; 

1. Only the low byte of the program counter is saved on the user stack. Thus, this limits the calling of all functions and the implementation of the functions to the same page. 

However, this does not preclude one from splitting a program over several pages and implementing each called function on each page. Of course, the same implementation of functions on different pages must have different names. That is, one must be careful and think. But with the price of the 12C5XX declining to a mere $1.00 it pays to think! 

This approach of splitting a program is shown in another discussion dealing with the I2C bus. 

2. The FSR is used as the user defined stack pointer. Thus, if the FSR register is used elsewhere, one must be careful to save the user stack pointer in a temporary variable when using the FSR for other applications and of course, restoring it to the FSR when calls and returns are made using this approach. 

Please refer to program STACK_1.ASM which continually flashes an LED on and off. Note that the main calls routines SUB1, DELAY, SUB2 and DELAY and then loops back to repeat the process. 

The FSR register is intialized to the highest data location, 01FH. 

Each "call" consists of the following instructions. 


MOVF PCL, W ; fetch PCL to W
ADDWF OFFSET, W ; add 4 
MOVWF INDF ; save to location pointed to by FSR
DECF FSR, F ; for next subroutine
GOTO SUB1 ; turn LED on

RET_POINT1:
;... continuation of program

In the above, note that the current content of the low byte of the program counter is fetched. The address to return to (RET_POINT1) is calculated by adding 4 and this is saved to the location pointed to by the user stack pointer. The stack pointer is then decremented to accommodate the next return address. Finally, a jump to the function is executed. 

In the subroutine, the task is first performed. The "return" is then implemented using the following code. 


; task performed
INCF FSR, F ; return
MOVF INDF, W
MOVWF PCL

In the above, the user stack pointer is incremented so as to point to the location containing the value of the program counter which was stored in the calling routine. This is fetched and placed in the low byte of the program counter. Thus, execution continues at the return point in the calling routine. 


; STACK_1.ASM (12C509)
; 
; Illustrates how to use user stack to implement "calls" and "returns". 
; This is particularly important on the 12C509 as to stack is limited to
; two levels.
;
; Flashes LED on GPIO0, 250 ms on and 250 ms off.


LIST p=12c509
#include <p12c509.inc> 
__CONFIG 1AH

LOOP1 EQU 07H ; for timing loops
LOOP2 EQU 08H
OFFSET EQU 09H

ORG 000H

MOVLW 1FH ; intitialize FSR to point to top of "stack"
MOVWF FSR

MOVLW .4
MOVWF OFFSET ; offset initialized to 4

MOVLW 1EH ; least sign bit is an output
TRIS GPIO

TOP:
; save return address on stack
MOVF PCL, W ; fetch PCL, add 4 and save at location 
ADDWF OFFSET, W ; pointed to by FSR 
MOVWF INDF
DECF FSR, F ; dec stack pointer for next subroutine
GOTO SUB1 ; turn LED on

MOVF PCL, W
ADDWF OFFSET, W
MOVWF INDF
DECF FSR, F
GOTO DELAY ; 250 ms delay

MOVF PCL, W
ADDWF OFFSET, W
MOVWF INDF
DECF FSR, F
GOTO SUB2 ; turn LED off

MOVF PCL, W
ADDWF OFFSET, W
MOVWF INDF
DECF FSR, F
GOTO DELAY ; 250 ms delay

GOTO TOP

SUB1:
BCF GPIO, 0 ; logic zero turns LED on

; these three lines are the equiv of a return
INCF FSR, F ; increment FSR
MOVF INDF, W ; get return address
MOVWF PCL ; and put in program counter

SUB2:
BSF GPIO, 0 ; logic one turns LED off

INCF FSR, F ; return
MOVF INDF, W
MOVWF PCL

DELAY: ; when running set LOOP1 to .250 and LOOP2 to .110.
; this will result in 250 ms delay.
MOVLW .250
MOVWF LOOP1
OUTTER:
MOVLW .110 ; close to 1.0 msec delay when set to .110
MOVWF LOOP2
INNER:
NOP
NOP
DECFSZ LOOP2, F ; decrement and leave result in LOOP2 
; skip next statement if zero
GOTO INNER
DECFSZ LOOP1, F
GOTO OUTTER

INCF FSR, F ; return
MOVF INDF, W
MOVWF PCL

END 

In program STACK_2.ASM, the "calls" and "returns" are implemented using macros which have been labelled as GOSUB and RET. Note that macros make the program considerably more understandable. 


; STACK_2.ASM. 
;
; Same as STACK_1.ASM except implemented using macros.
;
; coyright, Peter H. Anderson, MSU, June 1, '97

LIST p=12c509
#include <p12c509.inc>
__CONFIG 1AH

; Macros defined
GOSUB MACRO arg1 ; uses user defined stack to save return address
MOVF PCL, W ; and jumps to specified routine.
ADDWF OFFSET, W
MOVWF INDF
DECF FSR, F
GOTO arg1

ENDM

RET MACRO ; fetches return address from stack
INCF FSR, F 
MOVF INDF, W
MOVWF PCL

ENDM

LOOP1 EQU 0CH ; for timing loops
LOOP2 EQU 0DH
OFFSET EQU 0EH

ORG 000H

MOVLW 1FH ; intitialize FSR to point to top of "stack"
MOVWF FSR

MOVLW .4
MOVWF OFFSET ; intialize OFFSET to 4

MOVLW 1EH
TRIS GPIO ; least sign bit is defined as output

TOP:
GOSUB SUB1
GOSUB DELAY
GOSUB SUB2
GOSUB DELAY

GOTO TOP

SUB1:
BCF GPIO, 0
RET
SUB2:
BSF GPIO, 0
RET

DELAY: ; when running set LOOP1 to .250 and LOOP2 to .110.
; this will result in 250 ms delay.
MOVLW .250
MOVWF LOOP1
OUTTER:
MOVLW .110 ; close to 1.0 msec delay when set to .110
MOVWF LOOP2
INNER:
NOP
NOP
DECFSZ LOOP2, F ; decrement and leave result in LOOP2 
; skip next statement if zero
GOTO INNER
DECFSZ LOOP1, F
GOTO OUTTER

RET 

END 
 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品综合网| 亚洲电影在线播放| 亚洲免费观看高清完整| 蜜臀久久99精品久久久画质超高清| 国产传媒一区在线| 欧美日韩国产首页在线观看| 国产清纯在线一区二区www| 午夜欧美2019年伦理| 成人高清免费观看| 欧美电影精品一区二区| 亚洲国产日韩a在线播放| 国产福利一区二区| 欧美一级电影网站| 一区二区日韩电影| 成人激情文学综合网| 精品日韩av一区二区| 日韩国产欧美三级| 在线日韩av片| 亚洲精品国产无套在线观| 国产成人99久久亚洲综合精品| 欧美一区二区三区思思人| 亚洲综合av网| 在线看国产一区| 中文字幕在线观看一区二区| 国产不卡视频在线播放| xfplay精品久久| 激情综合网最新| 欧美刺激午夜性久久久久久久| 视频一区二区三区在线| 欧美日韩国产影片| 亚洲bt欧美bt精品| 91麻豆精品国产综合久久久久久| 亚洲午夜免费视频| 欧美亚洲一区二区三区四区| 一区二区三区免费| 日本福利一区二区| 亚洲一区二区五区| 欧美日韩情趣电影| 日韩激情中文字幕| 日韩一级免费观看| 精久久久久久久久久久| 2021中文字幕一区亚洲| 国产剧情一区二区| 国产精品丝袜在线| 91国产免费观看| 日韩精品视频网| 欧美成人一区二区三区片免费 | 欧美亚洲高清一区| 一二三区精品福利视频| 欧美色图一区二区三区| 日日夜夜精品视频免费| 欧美一级二级三级乱码| 国产精品亚洲人在线观看| 国产精品久久久久aaaa| 在线精品视频免费观看| 久久综合综合久久综合| 国产欧美综合在线观看第十页| www.色精品| 亚洲国产精品欧美一二99| 日韩一区二区精品在线观看| 国产精品一区二区在线观看网站| 中文av一区特黄| 欧美丝袜丝交足nylons| 久久er精品视频| 国产精品白丝在线| 欧美日韩一区二区三区不卡| 精品一区二区三区在线观看| 国产精品久久毛片a| 欧美猛男超大videosgay| 精品一区二区成人精品| 综合色中文字幕| 欧美成人福利视频| 91麻豆免费看| 国产综合久久久久久久久久久久 | 久99久精品视频免费观看| 久久久久久久久免费| 91成人看片片| 国产成人午夜高潮毛片| 午夜影院久久久| 国产精品久久777777| 欧美一区二区三区在线观看视频| 成人午夜私人影院| 首页欧美精品中文字幕| 中文字幕日韩精品一区| 欧美不卡一二三| 欧美亚洲自拍偷拍| 国产成人午夜视频| 奇米综合一区二区三区精品视频| 亚洲欧洲综合另类在线| 久久午夜电影网| 91精品国产色综合久久不卡电影| 一本大道av伊人久久综合| 国产一区在线观看麻豆| 日本中文字幕不卡| 亚洲一区在线免费观看| 综合久久给合久久狠狠狠97色| 久久久久久99久久久精品网站| 欧美喷潮久久久xxxxx| 色94色欧美sute亚洲线路一久| 国产成人aaaa| 国产一区二区看久久| 蜜臀av性久久久久蜜臀aⅴ四虎 | 国产大陆a不卡| 久久99在线观看| 日本va欧美va精品| 亚洲bdsm女犯bdsm网站| 亚洲综合av网| 亚洲一二三四在线| 亚洲精选视频在线| 亚洲精品免费在线观看| 中文字幕一区二区在线观看| 国产欧美日韩久久| 国产欧美一区二区精品性| 久久亚洲欧美国产精品乐播 | 久久97超碰国产精品超碰| 日韩主播视频在线| 无吗不卡中文字幕| 午夜国产精品一区| 亚洲成人av一区| 日本系列欧美系列| 免费看精品久久片| 麻豆精品国产91久久久久久| 日本不卡免费在线视频| 青青草国产成人av片免费| 另类小说综合欧美亚洲| 蜜桃久久久久久| 精品一区二区三区在线播放| 麻豆国产精品视频| 国产尤物一区二区在线| 国产福利91精品一区二区三区| 国产一区二区不卡老阿姨| 国产成人综合视频| 97精品国产露脸对白| 日本道色综合久久| 91精品国产综合久久小美女| 欧美大尺度电影在线| 久久精品视频一区二区三区| 国产精品免费网站在线观看| ●精品国产综合乱码久久久久 | 天堂在线一区二区| 蜜桃视频在线观看一区| 国产精品12区| 91久久久免费一区二区| 欧美一区午夜精品| 国产精品午夜久久| 亚洲一区在线看| 精品在线视频一区| 91在线精品秘密一区二区| 欧美日韩一二三| 2023国产精品| 亚洲午夜三级在线| 国产一区二区免费看| 91免费观看视频| 日韩久久久精品| 中文字幕日韩av资源站| 亚洲18影院在线观看| 国产麻豆精品视频| 欧美在线一区二区三区| 精品国产一区二区三区久久影院 | 久久久久久久久久久久久夜| 亚洲人成精品久久久久久| 免费的国产精品| 日韩一区二区三区免费看 | 精品国产一区二区亚洲人成毛片| 国产日产欧美精品一区二区三区| 亚洲一区二区视频在线观看| 国产最新精品免费| 欧美在线看片a免费观看| 久久青草欧美一区二区三区| 亚洲一区二区三区免费视频| 国产精品一区免费视频| 欧美日韩在线播放一区| 国产精品国产三级国产aⅴ入口| 美日韩一级片在线观看| 欧美午夜片在线看| 亚洲欧美综合在线精品| 久久er精品视频| 在线综合+亚洲+欧美中文字幕| 亚洲人成在线播放网站岛国 | 日韩成人午夜精品| 色综合天天天天做夜夜夜夜做| 精品少妇一区二区三区免费观看 | 天天综合日日夜夜精品| 99国产精品久久久| 国产日韩欧美精品在线| 精品亚洲成a人在线观看 | 视频一区视频二区中文| 色婷婷精品久久二区二区蜜臀av | 欧美日韩国产色站一区二区三区| 中文久久乱码一区二区| 国产一区二区在线电影| 日韩欧美国产三级电影视频| 石原莉奈一区二区三区在线观看| 91福利在线看| 亚洲日本在线天堂| 日本伦理一区二区| 亚洲一线二线三线视频| 色综合天天天天做夜夜夜夜做| 亚洲欧美综合色| 96av麻豆蜜桃一区二区|