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

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

?? 用pic12c509 控制led.txt

?? mcu眾多的開發實例
?? 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一区二区三区免费野_久草精品视频
久久不见久久见免费视频7| 国产亚洲欧美色| 亚洲成人av一区| 9191成人精品久久| 日韩精品电影在线观看| 日韩一区二区三区三四区视频在线观看| 日日夜夜精品免费视频| 91精品国产91久久综合桃花| 久久精品国产99国产| 国产日韩av一区二区| 99久久免费国产| 亚洲国产视频网站| 欧美不卡在线视频| 成人久久18免费网站麻豆 | 欧美肥妇毛茸茸| 免费在线欧美视频| 亚洲国产电影在线观看| 色综合色综合色综合色综合色综合| 亚洲国产综合在线| 精品国产乱码久久久久久久久| 国产精品一区在线观看你懂的| 国产精品卡一卡二卡三| 欧美剧情片在线观看| 国产在线精品一区二区夜色| 亚洲欧美另类在线| 日韩欧美一区二区视频| 91在线高清观看| 日韩vs国产vs欧美| 中文字幕一区二区三区在线不卡 | 中文字幕日韩一区二区| 欧美午夜寂寞影院| 国产99久久久精品| 天天免费综合色| 久久综合狠狠综合久久激情| 91在线看国产| 精品亚洲国产成人av制服丝袜| 国产精品成人在线观看| 日韩欧美成人一区二区| 91蝌蚪porny| 国产尤物一区二区在线| 一级日本不卡的影视| 午夜日韩在线电影| 日本一区二区三区四区在线视频 | 日韩一区在线看| 精品少妇一区二区三区日产乱码| 99re在线精品| 国产另类ts人妖一区二区| 亚洲成人免费视频| 综合久久久久久| 中文字幕二三区不卡| 日韩一区二区电影在线| 色88888久久久久久影院按摩| 国产成人在线网站| 免费观看成人鲁鲁鲁鲁鲁视频| 一区二区三区免费看视频| 中文av字幕一区| 26uuu精品一区二区在线观看| 欧美日韩亚洲不卡| 欧美性欧美巨大黑白大战| 播五月开心婷婷综合| 国产伦精品一区二区三区视频青涩| 亚洲成a人片综合在线| 日韩理论片中文av| 国产精品灌醉下药二区| 国产偷v国产偷v亚洲高清| 日韩一区二区在线观看视频播放| 在线观看国产精品网站| 91免费精品国自产拍在线不卡| 国产成人免费av在线| 国产一区二区三区不卡在线观看| 另类综合日韩欧美亚洲| 免费成人av资源网| 久久99国产精品麻豆| 久久成人免费网站| 经典三级在线一区| 国产一区二区在线影院| 国产乱人伦偷精品视频免下载| 日本成人中文字幕| 极品销魂美女一区二区三区| 老司机午夜精品99久久| 麻豆精品一区二区av白丝在线| 日韩国产欧美在线观看| 免费在线观看视频一区| 久久精品国产成人一区二区三区| 麻豆国产精品一区二区三区| 久久成人综合网| 国产一区二区美女诱惑| 国产·精品毛片| 99久久婷婷国产综合精品| 色欧美88888久久久久久影院| 欧美体内she精高潮| 欧美猛男男办公室激情| 欧美大片一区二区三区| 久久亚洲影视婷婷| 国产精品免费aⅴ片在线观看| 国产精品福利一区二区| 亚洲精品日日夜夜| 日韩成人一区二区| 国产经典欧美精品| 色噜噜狠狠成人中文综合| 欧美日韩一区二区电影| 日韩欧美色综合| 国产婷婷色一区二区三区四区| 国产精品欧美久久久久一区二区 | 91精品国产综合久久福利| 日韩精品专区在线影院重磅| 蜜臀av在线播放一区二区三区| 久久99久久久久| caoporm超碰国产精品| 欧美日韩精品久久久| 精品捆绑美女sm三区| 国产精品不卡在线观看| 午夜精品久久久久久久久| 国产一区二区h| 色8久久人人97超碰香蕉987| 日韩免费一区二区三区在线播放| 国产精品久久久久9999吃药| 亚洲高清免费视频| 国产精品888| 欧美男女性生活在线直播观看| 亚洲精品在线一区二区| 亚洲乱码中文字幕综合| 麻豆传媒一区二区三区| 99久久免费视频.com| 欧美大片一区二区| 亚洲国产精品久久人人爱| 激情欧美一区二区| 欧美日韩一区在线观看| 国产精品久久777777| 久久精品国产久精国产| 日本大香伊一区二区三区| 久久网站最新地址| 五月激情综合婷婷| www.一区二区| 欧美精品一区二区在线观看| 亚洲国产精品精华液网站| 国产福利视频一区二区三区| 欧美精品vⅰdeose4hd| 中文字幕一区二区日韩精品绯色| 欧美日韩一本到| 中文字幕精品在线不卡| 毛片av一区二区| 欧美日韩国产成人在线免费| 成人免费一区二区三区视频| 久久国产精品99久久久久久老狼| 欧美在线综合视频| 亚洲视频狠狠干| 丰满亚洲少妇av| 久久久精品免费免费| 男男视频亚洲欧美| 91精品国产综合久久精品图片| 亚洲手机成人高清视频| 成人av在线一区二区三区| 久久综合九色欧美综合狠狠| 久久精品国产精品青草| 91精品麻豆日日躁夜夜躁| 亚洲国产中文字幕在线视频综合| 99国产欧美另类久久久精品| 国产欧美一区二区三区在线老狼| 国产在线播放一区三区四| 日韩欧美国产一二三区| 美女一区二区视频| 日韩女优av电影| 久久精品国产999大香线蕉| 欧美一区二区三区性视频| 日本不卡123| 日韩欧美高清在线| 国产在线精品一区二区| 日韩精品影音先锋| 激情丁香综合五月| 亚洲精品一区二区三区99| 国产九九视频一区二区三区| 久久久综合精品| 国产成人亚洲综合a∨婷婷| 国产视频亚洲色图| 成人福利视频在线看| 国产精品久久久一区麻豆最新章节| 国产成人免费视频网站| 国产精品亲子乱子伦xxxx裸| 99久久久久免费精品国产 | 国产丝袜美腿一区二区三区| 国产高清亚洲一区| 亚洲欧美日韩系列| 欧美日韩成人综合在线一区二区| 日本美女一区二区三区视频| 欧美刺激脚交jootjob| 精品一区二区在线看| 久久久精品中文字幕麻豆发布| 成人黄色a**站在线观看| 亚洲日本在线看| 欧美色窝79yyyycom| 丝袜诱惑亚洲看片| 久久综合九色综合久久久精品综合 | 成人sese在线| 一区二区在线看| 91精品国产一区二区三区| 韩国一区二区三区| 亚洲日本丝袜连裤袜办公室| 欧美男人的天堂一二区| 国产 欧美在线|