• 検索結果がありません。

PIC18 Istructios PIC16, PIC x Microchip Techology Icorporated. All Rights Reserved. PICmicro PIC18 52

N/A
N/A
Protected

Academic year: 2021

シェア "PIC18 Istructios PIC16, PIC x Microchip Techology Icorporated. All Rights Reserved. PICmicro PIC18 52"

Copied!
16
0
0

読み込み中.... (全文を見る)

全文

(1)

PIC18

命令

PIC18

PIC18

命令

命令

(2)

PIC18 Instructions

命令の特徴

PIC18 Instructions

PIC18 Instructions

命令の特徴

命令の特徴

O

PIC16, PIC17と上位互換

O

命令長は16ビット

O

16ビット幅で命令フェッチ

O

同時にフェッチと実行

O

シングルサイクル8x8乗算器

O

コンパクトなコードを生成

O

PIC16, PIC17と上位互換

O

命令長は16ビット

O

16ビット幅で命令フェッチ

O

同時にフェッチと実行

O

シングルサイクル8x8乗算器

O

コンパクトなコードを生成

(3)

PIC18 Instructions

命令の特徴 (続き)

PIC18 Instructions

PIC18 Instructions

命令の特徴

命令の特徴

(

(

続き

続き

)

)

O

ほとんどの命令はシングルワード

O

71命令がシングルワード; 4命令がダブルワード

O

ほとんどの命令はシングルサイクル

O

17命令はダブルサイクル

O

18命令の条件分岐やスキップは1,2(または3)サイ

クル

O

MOVFFでレジスタからレジスタにデータ転送

O

パワフルなビット処理

O

全データメモリ領域で使える

O

ほとんどの命令はシングルワード

O

71命令がシングルワード; 4命令がダブルワード

O

ほとんどの命令はシングルサイクル

O

17命令はダブルサイクル

O

18命令の条件分岐やスキップは1,2(または3)サイ

クル

O

MOVFFでレジスタからレジスタにデータ転送

O

パワフルなビット処理

O

全データメモリ領域で使える

(4)

16-16-

bit

bit

Instruction for Byte Oriented Operations

Instruction for Byte Oriented Operations

OP CODE

OP CODE

d

d

d = Destination Bit

‘W' for WREG (0)

‘F’ for f (1 - Default)

f = 8-bit Register Address

Example:

Example:

ADDWF

ADDWF

f [,d [,a]]

f [,d [,a]]

MOVFF fs

MOVFF

fs,

, fd

fd

ADDWF

ADDWF

Count

Count

MOVFF Source, Dest

MOVFF Source,

Dest

ADDWF

f [,d [,a]]

ADDWFC

f [,d [,a]]

ANDWF

f [,d [,a]]

CLRF

f [,a]

COMF

f [,d [,a]]

CPFSEQ

f [,a]

CPFSGT

f [,a]

CPFSLT

f [,a]

DECF

f [,d [,a]]

DECFSZ

f [,d [,a]]

DCFSNZ

f [,d [,a]]

INCF

f [,d [,a]]

INCFSZ

f [,d [,a]]

INFSNZ

f [,d [,a]]

IORWF

f [,d [,a]]

MOVF

f [,d [,a]]

MOVFF

fs, fd

MOVWF

f [,a]

Byte-Oriented

Operations

a

a

f

f

f

f

f

f

f

f

f

f

f

f

f

f

f

f

a = Access Bit

‘ACCESS’ (0)

‘BANKED’ (1 - Default)

PIC18 Instruction

バイト指向オペレーション

PIC18 Instruction

PIC18 Instruction

バイト指向オペレーション

バイト指向オペレーション

(5)

16-16-

bit Instruction for Byte Oriented Operations

bit Instruction for Byte Oriented Operations

OP CODE

OP CODE

d

d

d = Destination Bit

‘W’ for WREG (0)

‘F’ for f (1 - Default)

f = 8-bit Register Address

Example:

Example:

SUBWF

SUBWF

f [,d [,a]]

f [,d [,a]]

SUBWF

SUBWF

Value, W

Value, W

Byte-Oriented

Operations

a

a

f

f

f

f

f

f

f

f

f

f

f

f

f

f

f

f

a = Access Bit

‘ACCESS’ (0)

‘BANKED’ (1 - Default)

MULWF

MULWF

f [,a]

f [,a]

NEGF

NEGF

f [,a]

f [,a]

RLCF

RLCF

f [,d [,a]]

f [,d [,a]]

RLNCF

RLNCF

f [,d [,a]]

f [,d [,a]]

RRCF

RRCF

f [,d [,a]]

f [,d [,a]]

RRNCF

RRNCF

f [,d [,a]]

f [,d [,a]]

SETF

SETF

f [,a]

f [,a]

SUBFWB

SUBFWB

f [,d [,a]]

f [,d [,a]]

SUBWF

SUBWF

f [,d [,a]]

f [,d [,a]]

SUBWFB

SUBWFB

f [,d [,a]]

f [,d [,a]]

SWAPF

SWAPF

f [,d [,a]]

f [,d [,a]]

TSTFSZ

TSTFSZ

f [,a]

f [,a]

XORWF

XORWF

f [,d [,a]]

f [,d [,a]]

PIC18 Instructions

バイト指向オペレーション(続き)

PIC18 Instructions

PIC18 Instructions

バイト指向オペレーション

バイト指向オペレーション

(

(

続き

続き

)

)

(6)

PIC18 Instructions

バイト指向オペレーション例

PIC18 Instructions

PIC18 Instructions

バイト指向オペレーション例

バイト指向オペレーション例

O

複数バイト(4バイト)のインクリメント:

“Count32++”

O

複数バイト(4バイト)のインクリメント:

“Count32++”

...

...

movlw

movlw

01h

01h

addwf

addwf

Count32, F

Count32, F

; Inc LSB by

; Inc LSB by

1

1

clrf

clrf

WREG

WREG

; Pass the carry

; Pass the carry

addwfc

addwfc

Count32+1, F

Count32+1, F

; to LOW MSB

; to LOW MSB

addwfc

addwfc

Count32+2, F

Count32+2, F

; to HIGH LSB

; to HIGH LSB

addwfc

addwfc

Count32+3, F

Count32+3, F

; to HIGH MSB

; to HIGH MSB

...

(7)

16-16-

bit Instruction for Bit Oriented Operations

bit Instruction for Bit Oriented Operations

OP CODE

OP CODE

b

b

b = 3-Bit Address

(Bit Number)

f = 8-bit Register Address

b

b

b

b

Example:

Example:

BTFSC

BTFSC

f, b [,a]

f, b [,a]

BTFSC

BTFSC

STATUS, C

STATUS, C

BCF

BCF

f, b [,a]

f, b [,a]

BSF

BSF

f, b [,a]

f, b [,a]

BTG

BTG

f, b [,a]

f, b [,a]

BTFSC

BTFSC

f, b [,a]

f, b [,a]

BTFSS

BTFSS

f, b [,a]

f, b [,a]

Bit-Oriented

Operations

a = Access Bit

‘ACCESS’ (0)

‘BANKED’ (1 - Default)

a

a

f

f

f

f

f

f

f

f

f

f

f

f

f

f

f

f

PIC18 Instructions

ビット指向オペレーション

PIC18 Instructions

PIC18 Instructions

ビット指向オペレーション

ビット指向オペレーション

(8)

BC

BC

n

n

BN

BN

n

n

BNC

BNC

n

n

BNN

BNN

n

n

BNOV

BNOV

n

n

BNZ

BNZ

n

n

BOV

BOV

n

n

BRA

BRA

n

n

BZ

BZ

n

n

CALL

CALL

n [,s]

n [,s]

GOTO

GOTO

n

n

RCALL

RCALL

n

n

RETFIE

RETFIE

[s]

[s]

RETURN

RETURN

[s]

[s]

Control

Operations

16-16-

bit Instruction for

bit Instruction for

RCALL

RCALL

and

and

BRA

BRA

OP CODE

OP CODE

k = 11-bit Immediate Value

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

OP CODE

OP CODE

s

s

n

n

16-16-

bit Instruction for

bit Instruction for

CALL

CALL

and

and

GOTO

GOTO

n

n

n

n

n

n

n

n

n

n

n

n

n

n

k = 20-bit Immediate Value

OP CODE

OP CODE

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

s = 1-bit fast Save/Restore

‘FAST’ (1), (Default - 0)

PIC18 Instructions

制御オペレーション

PIC18 Instructions

PIC18 Instructions

制御オペレーション

制御オペレーション

(9)

PIC18 Instructions

制御オペレーション(続き)

PIC18 Instructions

PIC18 Instructions

制御オペレーション

制御オペレーション

(

(

続き

続き

)

)

O

(無)条件分岐は-128ワードか

ら+127ワードを指定

O

CALLとGOTOは全

21ビットアド

レスを指定

O

2MBまでのリニアアドレス

O

RCALLは -1024ワードから

1023ワードを指定

O

(無)条件分岐は-128ワードか

ら+127ワードを指定

O

CALLとGOTOは全

21ビットアド

レスを指定

O

2MBまでのリニアアドレス

O

RCALLは -1024ワードから

1023ワードを指定

BC

BC

n

n

BN

BN

n

n

BNC

BNC

n

n

BNN

BNN

n

n

BNOV

BNOV

n

n

BNZ

BNZ

n

n

BOV

BOV

n

n

BRA

BRA

n

n

BZ

BZ

n

n

CALL

CALL

n [,s]

n [,s]

GOTO

GOTO

n

n

RCALL

RCALL

n

n

RETFIE

RETFIE

[s]

[s]

RETURN

RETURN

[s]

[s]

Control

Operations

(10)

CLRWDT

CLRWDT

DAW

DAW

NOP

NOP

POP

POP

PUSH

PUSH

RESET

RESET

SLEEP

SLEEP

Control

Operations

16-16-

bit Instruction for

bit Instruction for

CLRWDT

CLRWDT

OP CODE

OP CODE

16-16-

bit Instruction for

bit Instruction for

DAW

DAW

OP CODE

OP CODE

PIC18 Instructions

制御オペレーション(続き)

PIC18 Instructions

PIC18 Instructions

制御オペレーション

制御オペレーション

(

(

続き

続き

)

)

O

PUSHとPOPはハードウエアス

タックを処理

O

DAWは

WREGを処理

(11)

PIC18 Instructions

制御オペレーション例#1

PIC18 Instructions

PIC18 Instructions

制御オペレーション例

制御オペレーション例

#

#

1

1

O

“コンテキストの保存”

...

...

call

call

MyFunc

MyFunc

, FAST

, FAST

...

...

MyFunc

MyFunc

:

:

...

...

return

return

FAST

FAST

Calling Subroutine

Calling Subroutine

org

org

00008h

00008h

bra

bra

HighISR

HighISR

...

...

HighISR

HighISR

:

:

...

...

retfie

retfie

FAST

FAST

...

...

Handling Interrupt

(12)

PIC18 Instructions

制御オペレーション例#2

PIC18 Instructions

PIC18 Instructions

制御オペレーション例

制御オペレーション例

#

#

2

2

O

ポートBのRB6ピンの入力トリガを待つ

...

...

btfsc

btfsc

PORTB, RB6

PORTB, RB6

; Is RB6 low ?

; Is RB6 low ?

bra

bra

$-2

$-2

; No. Wait

; No. Wait

...

(13)

Example:

Example:

MOVLW

MOVLW

k

k

LFSR

LFSR

f, k

f, k

MOVLW

MOVLW

5Ah

5Ah

LFSR

LFSR

FSR0, 400h

FSR0, 400h

ADDLW

ADDLW

k

k

ANDLW

ANDLW

k

k

IORLW

IORLW

k

k

LFSR

LFSR

f, k

f, k

MOVLB

MOVLB

k

k

MOVLW

MOVLW

k

k

MULLW

MULLW

k

k

RETLW

RETLW

k

k

SUBLW

SUBLW

k

k

XORLW

XORLW

k

k

Literal

Operations

OP CODE

OP CODE

f

f

f

f

k

k

16-16-

bit Instruction for LFSR

bit Instruction for LFSR

k

k

k

k

k

k

k

k

k

k

k

k

k

k

k = 8-bit Immediate Value

f = 2-bit FSR Selector

FSR0, FSR1 or FSR2

OP CODE

OP CODE

k

k

16-16-

bit Instruction for Other Literal Operations

bit Instruction for Other Literal Operations

k

k

k

k

k

k

k

k

k

k

k

k

k

k

k = 8-bit Immediate Value

PIC18 Instructions

リテラル・オペレーション

PIC18 Instructions

PIC18 Instructions

リテラル・オペレーション

リテラル・オペレーション

(14)

PIC18 Instructions

リテラル・オペレーション例

PIC18 Instructions

PIC18 Instructions

リテラル・オペレーション例

リテラル・オペレーション例

...

...

movlw

movlw

55h

55h

movwf

movwf

PORTB

PORTB

...

...

Immediate Operation

Immediate Operation

...

...

lfsr

lfsr

FSR0, 400h

FSR0, 400h

movwf

movwf

INDF0

INDF0

; *FSR0

; *FSR0

movwf

movwf

POSTINC0

POSTINC0

; *FSR0++

; *FSR0++

movwf

movwf

POSTDEC0

POSTDEC0

; *FSR0--

;

*FSR0--movwf

movwf

PREINC0

PREINC0

;

;

*++

*++

FSR0

FSR0

movwf

movwf

PLUSW0

PLUSW0

; FSR0[WREG]

; FSR0[WREG]

Indirect Operation

(15)

16-16-

bit Instruction for TBLRD*/TBLWT*

bit Instruction for TBLRD*/TBLWT*

OP CODE

OP CODE

TBLRD*

TBLRD*

TBLRD

TBLRD

*+

*+

TBLRD*-TBLRD

TBLRD

+*

+*

TBLWT*

TBLWT*

TBLWT

TBLWT

*+

*+

TBLWT*-

TBLWT*-

TBLWT

TBLWT

+*

+*

Control

Operations

PIC18 Instructions

データ¥プログラム・オペレーション

PIC18 Instructions

PIC18 Instructions

データ

データ

¥

¥

プログラム

プログラム

オペレーション

オペレーション

Example:

Example:

TBLRD*

TBLRD*

TBLRD

TBLRD*+

*+

O

TBLRDとTBLWTは

TABLATを

リード/ライト

(16)

PIC18 Instructions

データ¥プログラム・オペレーション例

PIC18 Instructions

PIC18 Instructions

データ

データ

¥

¥

プログラム・オペレーション例

プログラム・オペレーション例

O

ルックアップテーブルのデータをリード:

movlw

movlw

upper(

upper(

LookUpTable

LookUpTable

)

)

;

;

Load look-up

Load look-up

movwf

movwf

TBLPTRU

TBLPTRU

;

;

table

table

movlw

movlw

high(

high(

LookupTable

LookupTable

)

)

;

;

address

address

movwf

movwf

TBLPTRH

TBLPTRH

movlw

movlw

low(

low(

LookupTable

LookupTable

)

)

movwf

movwf

TBLPTRL

TBLPTRL

tblrd*+

参照

関連したドキュメント

the trivial automorphism [24], I generated all the rooted maps, or rather Lehman’s code for rooted maps, with e edges and v vertices, eliminated all those whose code-word is

サービスブランド 内容 特長 顧客企業

In particular, we are able to prove that for Volterra scalar systems with a creep kernel a(t) such that a(0 + ) > 0; the finite-time and the infinite-time L 1 -admissibility

De plus la structure de E 1 -alg ebre n’est pas tr es \lisible" sur les cocha^nes singuli eres (les r esultats de V. Schechtman donnent seulement son existence, pour une

All Rights Reserved © 2016The Tokyo Electric Power Power Grid

If you disclose confidential Company information through social media or networking sites, delete your posting immediately and report the disclosure to your manager or supervisor,

サテライトコンパス 表示部.. FURUNO ELECTRIC CO., LTD. All Rights Reserved.. ECS コンソール内に AR ナビゲーション システム用の制御

Copyright(C) 2020 JETRO, Nagashima Ohno & Tsunematsu All rights reserved... a)