1 ,LED, - Hara Laboratory Home Page ?? セラロック発振子は3ピンのうち中央のピンを0Vに接続し, 外側の2ピンをPICのOSC1とOSC2 に接続する(この2 ピンは対称なので, どちらをどちらに接続してもよい). 2. LED をRB1 に接続する. 抵抗の接続を忘れないこと. 4 RB1 の出力が0V ...

  • Published on
    30-May-2018

  • View
    212

  • Download
    0

Transcript

  • [2012.04.02]

    2

    PIC 8 .

    .

    1. .

    1

    (4/16, 6/ 4)

    LED

    1

    ( 4/17, 6/ 5)

    2

    (4/23, 6/11)

    PIC LED

    PIC

    2

    ( 4/24, 6/12)

    3

    (5/7, 6/18)

    PIC

    V1

    3

    ( 5/8, 6/19)

    4

    (5/14, 6/25)

    V1

    V2

    V1 V2

    4

    ( 5/15, 6/26)

    5

    (5/21, 7/ 2)

    V2

    V2

    V2

    ( 5/28, 7/ 9)

    2. .

    40% 60% .

    .

    1 , LED,

    LED 7 , LED

    . , .

    1 LED , LED .

    .

    1

  • ,.

    , (). 5 10 mA.

    .

    F G H I JA B C D E123456

    123456

    7 7

    5V

    0V

    5

    ()

    2 1, LED.

    .

    3 LED,.

    LED, 7 LED,. .

    , 7 LED. () 0V LED. VCC 5V.

    7 LED.

    a

    g

    d

    f b

    e c

    dp

    VCC

    f

    g

    e

    d

    a

    b

    c

    dp

    VCC

    4 (7447) 4, 4 2, LED.

    , 4 2, LED.

    2

  • . (D,C,B,A) 4, D . ( 0).

    14

    13

    12

    11

    10

    8 GND

    f

    9

    1

    2

    3

    4

    5

    6

    7

    16

    15

    g

    a

    b

    c

    d

    e

    Vcc

    A

    D

    RBI

    RBO

    LT

    C

    B

    7447

    D C B A a b c d e f g0 0 0 0 0 0 0 0 0 0 0 10 0 0 1 1 1 0 0 1 1 1 10 0 1 0 2 0 0 1 0 0 1 00 0 1 1 3 0 0 0 0 1 1 00 1 0 0 4 1 0 0 1 1 0 00 1 0 1 5 0 1 0 0 1 0 00 1 1 0 6 1 1 0 0 0 0 00 1 1 1 7 0 0 0 1 1 1 11 0 0 0 8 0 0 0 0 0 0 01 0 0 1 9 0 0 0 1 1 0 0

    LT, RBI, RBO. , 5V.

    , 0, 1. , ( AD). 1, 0

    Vcc

    A

    GND

    Vcc

    GND

    A

    5 4, 2, LED 1. 2 NAND.

    74LS00 (2 NAND 4 IC). .

    ,,.

    (, 0 LED).

    74LS00 , 0 8 mA , 1 0.4mA, LED.

    0, 1NOT. .

    10 0 9. 10 10 dont care,.

    3

  • 14

    13

    12

    11

    10

    8GND

    Vcc

    9

    1

    2

    3

    4

    5

    6

    7

    74LS00

    1 1 5,.

    2 PIC LED

    8 PIC, LED. , 2 PIC.

    PIC Peripheal Interface Controller,. ,. , 35. EEPROM,.

    6PIC LED.

    1. PIC (PIC16F84).

    .

    GND 0V, Vcc 5V.

    MCLR 5V. 0V PIC.

    3 0V, 2 PIC OSC1 OSC2 ( 2,).

    2. LED RB1.

    .

    4

  • RB1 0V.

    3. .

    PIC, ().

    4. 1 LED timer.asm.

    C:Y=picY=timer.asm..

    MPLAB IDE.

    MPLAB IDE ()

    [Project] [Project Wizard][]

    Step One: Device: PIC16F84[]

    Step Two: Active Toolsuite: Microchip MPASM Toolsuite[]

    Step Three: Project Name: (kadai6)Project Directory: C:Y=pic []() Project Name () (50)

    Step Four: C:Y=picY=timer.asm[Add >>] (timer.asm)[]

    []

    [Project] [Make] (F10)

    OutputBUILD SUCCEEDED

    timer.hex.

    6

    (kadai6)[Project] [open] (c:Y=picY=kadai6.mcp)[]

    timer.asm (kadai6.mcw) kadai6.mcp Source Files timer.asm

    Output BUILD FAILEDOutputERROR

    5. timer.hex PIC PIC

    PICpro

    PICpro

    Chip Selector PIC16F84

    5

  • Window PIC PIC, [Load]c:Y=picY=timer.hextimer.hex [Program] PIC[yes]

    () (WDT) on/off

    HS off

    6. PIC,.

    7. ,,.

    7 LED.

    2 PAtoPB.asm,,,.

    RA RB,.

    PIC,,

    TIM10 MOVLW 0F9H

    ,

    [TAB] []

    . [TAB]. [TAB],.

    PICRA ON/OFF

    8PIC RA03 4RB03LED 2 LEDPICPAtoPB.asm

    9PIC

    1. RB47 LED LED

    2. 3 dispnum.asm PIC01RA023

    3. RA1, RA2, RA345, 67, 89

    () .

    , (). ,.

    6

  • ,, t.

    2 6 9,.

    3 V1

    1,.

    10 2 10,.

    1. 4 (countup.asm).

    2. ,.

    INCF,, 16. 10.

    11,.

    2 10. 9.

    , 6.

    (MCLR),.

    1 (RA0) 1. 1 0, 1, 2,3,,. 9 0, 10.

    10 (RA1) 10. 2 0, 1,2, 3,,. 9 0, 1, 2,.

    (RA2)

    (RA3)

    (RA4)

    2 (1 + 2 + 3 =). ,.

    .

    2 3

    1 : 4 2 1

    7

  • 2 : 1 2 2

    3 : 2 1 2

    39

    10 1 10100 10 1 10100

    1100 1100 1001 1001

    10 0 10000 10 0 10000 01 0 10000 01 0 10000

    3 9

    3 9

    39

    1

    2

    3

    ,.

    3 10 11,.

    4 V1 V2

    1,. , 2.

    12 V1.

    ,. ,,.

    13 V1, V2.

    ,.

    .

    3.

    . .

    ,/. ,,.

    40,.

    4 12 13,,.

    8

  • 5 Ver 2

    14 V2.

    40,.

    V2, , , , .

    .

    1. V2.

    2. .

    3. (,//). ().

    4. .

    . (,)

    []

    .

    .

    , 12 + 34 = - 235 + =,.

    []

    ,.

    []

    .

    ,.

    ,,.

    .

    . .

    ,.

    .

    ,.

    .

    9

  • 1 LED (timer.asm); *************************************************; 0.50.5 PORTB ON/OFF; 10MHz 0.5; *************************************************LIST P=PIC16F84 ;;

    INCLUDE "P16F84.INC" ;;

    CNT1 EQU 0CH ;; CNT1 0C CNT2 EQU 0DH ;; 000B CNT3 EQU 0EH

    ORG 0 ;;

    MAIN ;; ()BSF STATUS,RP0CLRF TRISB ;; PORTB BCF STATUS,RP0

    MAINLP ;; CLRF PORTB ;; PORTB 0 (LED )CALL SECTIM ;; (0.5)MOVLW 0FFH ;;MOVWF PORTB ;; PORTB 1 (LED )CALL SECTIM ;; (0.5)GOTO MAINLP

    ;; TIM10 MOVLW 0F9H

    MOVWF CNT1TIMLP1 NOP

    DECFSZ CNT1,FGOTO TIMLP1RETURN

    TIM100 MOVLW 0F9HMOVWF CNT2

    TIMLP2 CALL TIM10DECFSZ CNT2,FGOTO TIMLP2RETURN

    SECTIM MOVLW 5MOVWF CNT3

    TIMLP3 CALL TIM100DECFSZ CNT3,FGOTO TIMLP3RETURN

    END

    2 LED (PAtoPB.asm);***************************************; RA0 -- RA3 -> RB0 -- RB3;***************************************

    LIST P=PIC16F84INCLUDE "P16F84.INC"

    ORG 0MAIN

    BSF STATUS,RP0MOVLW 0FHMOVWF TRISACLRF TRISBBCF STATUS,RP0

    MAINLP ;; A B MOVFW PORTAMOVWF PORTBGOTO MAINLP

    END

    10

  • 3 (dispnum.asm); ***********************************; RA0 OFF -> "01"; RA0 ON -> "23"; ***********************************

    LIST P=PIC16F84INCLUDE "P16F84.INC"

    CNT1 EQU 0CHCNT2 EQU 0DHCNT3 EQU 0EHCOUNT EQU 0FH

    ORG 0

    MAINBSF STATUS,RP0MOVLW 01FHMOVWF TRISA ;; PORTA CLRF TRISB ;; PORTB BCF STATUS,RP0

    MAINLP MOVLW 01HBTFSC PORTA, 0CALL WAITCALL DISPGOTO MAINLP

    WAIT CALL SECTIMBTFSC PORTA, 0MOVLW 23HRETURN

    DISP MOVWF PORTBRETURN

    TIM10 MOVLW 0F9HMOVWF CNT1

    TIMLP1 NOPDECFSZ CNT1,FGOTO TIMLP1RETURN

    TIM100 MOVLW 0F9HMOVWF CNT2

    TIMLP2 CALL TIM10DECFSZ CNT2,FGOTO TIMLP2RETURN

    SECTIM MOVLW 5MOVWF CNT3

    TIMLP3 CALL TIM100DECFSZ CNT3,FGOTO TIMLP3RETURN

    END

    11

  • 4 (countup.asm); ***********************************; (0.5 ); ***********************************LIST P=PIC16F84INCLUDE "P16F84.INC"

    CNT1 EQU 0CHCNT2 EQU 0DHCNT3 EQU 0EHCOUNT EQU 0FH

    ORG 0

    MAINBSF STATUS,RP0MOVLW 01FHMOVWF TRISA ;; PORTA CLRF TRISB ;; PORTB BCF STATUS,RP0CLRF PORTBCLRF COUNT ;; COUNT=0MOVLW 0AH

    MAINLPCALL SECTIMINCF COUNT,F ;; COUNT++CALL CHECKMOVF COUNT,WMOVWF PORTB ;; COUNT PORTB GOTO MAINLP

    CHECKMOVLW 0FHANDWF COUNT, 0 ;; 4bit 0SUBLW 0AHSKPZ ;; 4bit 0AH RETURNRETURNMOVFW COUNTADDLW 6 ;; 4bit 0aH+6MOVWF COUNT

    MOVLW 0F0HANDWF COUNT, 0 ;; 4bit 0SUBLW 0A0HSKPZRETURN ;; 4bit 0AH RETURNCLRF COUNT ;; 4bit 0AH COUNT=0RETURN

    TIM10 MOVLW 0F9HMOVWF CNT1

    TIMLP1 NOPDECFSZ CNT1,FGOTO TIMLP1RETURN

    TIM100 MOVLW 0F9HMOVWF CNT2

    TIMLP2 CALL TIM10DECFSZ CNT2,FGOTO TIMLP2RETURN

    SECTIM MOVLW 5MOVWF CNT3

    TIMLP3 CALL TIM100DECFSZ CNT3,FGOTO TIMLP3RETURN

    END

    12

Recommended

View more >