les niveaux d'une battries pic16f877

Upload: ayoub-hammouga

Post on 17-Feb-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/23/2019 Les Niveaux d'Une Battries Pic16F877

    1/7

    Compte renduVariation des niveaux de la batterie laide de la conversion analogique numrique base

    pic16F877

    GENERATION DES CARACTERES DANS LA MEMOIRE CGRAM

    Le premier niveau 1

    movlw 0x00

    call aff_data

    movlw 0x04

    call aff_data

    movlw 0x11

    call aff_data

    movlw 0x11

    call aff_data

    movlw 0x11

    call aff_data

    movlw 0x11

    call aff_data

    movlw 0x1F

    call aff_data

    movlw 0x00

    Niveaux de la batterie Dcodage en binaire Le niveau de

    potentiomtre5V 255 100 %

    3,75V 192 75%

    2,5V 128 50%

    1.25V 64 25%

    0V 0 0%

  • 7/23/2019 Les Niveaux d'Une Battries Pic16F877

    2/7

    call aff_data

    Le deuxime niveau2

    movlw x

    call aff_data

    movlw x 4

    call aff_data

    movlw x11

    call aff_data

    movlw x11

    call aff_data

    movlw x11

    call aff_data

    movlw x1F

    call aff_data

    movlw x1F

    call aff_data

    movlw x

    call aff_data

  • 7/23/2019 Les Niveaux d'Une Battries Pic16F877

    3/7

    Le troisime niveau 3

    movlw x

    call aff_data

    movlw x 4

    call aff_data

    movlw x11

    call aff_data

    movlw x11

    call aff_data

    movlw x1F

    call aff_data

    movlw x1F

    call aff_data

    movlw x1F

    call aff_data

    movlw x

    call aff_data

  • 7/23/2019 Les Niveaux d'Une Battries Pic16F877

    4/7

    Le quatrime niveau 4

    movlw x

    call aff_data

    movlw x 4

    call aff_data

    movlw x11

    call aff_data

    movlw x1F

    call aff_data

    movlw x1F

    call aff_data

    movlw x1F

    call aff_data

    movlw x1F

    call aff_data

    movlw x

    call aff_data

  • 7/23/2019 Les Niveaux d'Une Battries Pic16F877

    5/7

    Le Logigramme

    Traduction de ce logigramme en sous-programme

    bsf STATUS,RP0

    clrf ADCON1

    movlw 0x3F

    movwf TRISA

    bcf STATUS,RP0

    loop

    movlw b'00000001'

    movwf ADCON0

    call tempo

    bsf ADCON0,GO

    lp btfsc ADCON0,GO

  • 7/23/2019 Les Niveaux d'Une Battries Pic16F877

    6/7

    goto lp

    test movlw d'64'

    subwf ADRESL,0

    btfss STATUS,C

    goto aff0

    movlw d'128'

    subwf ADRESL,0

    btfsc STATUS,C

    goto suite1

    goto aff1

    suite1 movlw d'192'

    subwf ADRESL,0

    btfsc STATUS,C

    goto aff3

    goto aff2

    aff0

    movlw 0x80 ; pointage 1re ligne 9 me colonne

    call aff_cmd

    movlw 0x01

    call aff_data

    goto loop

    aff1

    movlw 0x80 ; pointage 1re ligne 9 me colonne

    call aff_cmd

    movlw 0x02

    call aff_data

    goto loop

    aff2

  • 7/23/2019 Les Niveaux d'Une Battries Pic16F877

    7/7

    movlw 0x80 ; pointage 1re ligne 9 me colonne

    call aff_cmd

    movlw 0x03

    call aff_data

    goto loop

    aff3

    movlw 0x80 ; pointage 1re ligne 9 me colonne

    call aff_cmd

    movlw 0x04

    call aff_data

    goto loop

    tempo

    movlw .20

    movwf 0x0D

    boucle2 clrf 0x0C

    boucle1 nop

    decfsz 0x0C

    goto boucle1

    decfsz 0x0D

    goto boucle2

    return

    end