新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > NEC單片機 UPD78F9234 16位定時器使用例程(匯編)

NEC單片機 UPD78F9234 16位定時器使用例程(匯編)

作者: 時間:2012-11-29 來源:網(wǎng)絡(luò) 收藏

16位例程()
;*************************************************
; Lable def
;*************************************************
LED8_MODE EQU PM2.1
LED7_MODE EQU PM2.0
LED6_MODE EQU PM12.0
LED5_MODE EQU PM0.3
LED4_MODE EQU PM0.2
LED3_MODE EQU PM0.1
LED2_MODE EQU PM0.0
LED1_MODE EQU PM12.3
LED8 EQU P2.1
LED7 EQU P2.0
LED6 EQU P12.0
LED5 EQU P0.3
LED4 EQU P0.2
LED3 EQU P0.1
LED2 EQU P0.0
LED1 EQU P12.3


;=========================(debugresource)======================================={
;*************************************************
; VAR DEF
;*************************************************

DATA_SEGMENT1DSEGSADDR ;(AT 0FE20H)

VAR_1: DS1

ORG 018H
DB 0FFH,0FFH;
ORG 07EH
DB 0FFH,0FFH;

ORG 81H
DB 0FFH;


ORG 01ED0H
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F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FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
;=================================================================================



;*************************************************
;INTERRUPT VECT
;*************************************************

ORG 0000H
DW START_PROGRAM

ORG 000EH
DW INTTM000_VECT

;*************************************************
;CODE
;*************************************************
CSEG ;(ATXXXXH)

START_PROGRAM:

DI
MOVW AX,#0FE20H;
MOVW SP,AX;

MOV PCC,#00H;
MOV PPCC,#00H;

CALL!DELAY_1MS;
CALL!DELAY_1MS;
CALL!DELAY_1MS;
CALL!DELAY_1MS;
CALL!DELAY_1MS;



MOV PMC2,#00H
MOV PM2,#0FFH


; SET TM00
MOV TMC00,#00H

MOV PRM00,#02H ;31.25KHz 32us

MOVW AX,#31250;9800 ;313.6ms 15625
MOVW CR000,AX

CLR1 TMIF000 ;clear sign
CLR1 TMMK000 ;allow interrupt

MOV TMC00,#0CH ;clear the CR000 when TM00=CR000

EI

CLR1LED1_MODE
CLR1LED2_MODE
CLR1LED3_MODE
CLR1LED4_MODE
CLR1LED5_MODE
CLR1LED6_MODE
CLR1LED7_MODE
CLR1LED8_MODE

SET1 LED1
SET1 LED2
SET1 LED3
SET1 LED4
SET1 LED5
SET1 LED6
SET1 LED7
SET1 LED8

CLR1LED1

MAIN:

MOV WDTE,#0ACH;

BR !MAIN

;*************************************************
; SUB PROGRAM
;*************************************************
CSEG
DELAY_1MS:

MOVB,#0FFH
BBBB:
DBNZ B,$BBBB;
RET

;*************************************************
;INTERRUPT FUNCTION
;*************************************************
CSEG
INTTM000_VECT:

BT LED1,$LED22 ;jump if LED1=1
SET1 LED1
CLR1 LED2
BR !backtrack

LED22:
BT LED2,$LED33
SET1 LED2
CLR1 LED3
BR !backtrack

LED33:
BT LED3,$LED44
SET1 LED3
CLR1 LED4
BR !backtrack

LED44:
BT LED4,$LED55
SET1 LED4
CLR1 LED5
BR !backtrack

LED55:
BT LED5,$LED66
SET1 LED5
CLR1 LED6
BR !backtrack

LED66:
BT LED6,$LED77
SET1 LED6
CLR1 LED7
BR !backtrack

LED77:
BT LED7,$LED88
SET1 LED7
CLR1 LED8
BR !backtrack

LED88:
BT LED8,$INTTM000_VECT
SET1 LED8
CLR1 LED1
BR !backtrack

backtrack:

RETI

END
產(chǎn)品參數(shù):
MCU 8BIT 8KB FLASH 30PIN
核心處理器:78K0S
芯體尺寸:8-位
速度:10MHz
連通性:LIN,UART/USART
外圍設(shè)備:LVD, POR, PWM, WDT
輸入/輸出數(shù):24
程序存儲器容量:8KB (8K x 8)
程序存儲器類型:FLASH
EEPROM 大?。?
RAM 容量:256 x 8
電壓 - 電源 (Vcc/Vdd):2 V ~ 5.5 V
數(shù)據(jù)轉(zhuǎn)換器:A/D 4x10b
振蕩器型:內(nèi)部
工作溫度:-40°C ~ 85°C

本文引用地址:http://2s4d.com/article/170677.htm


評論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉