Pic 16F84A chenillard

Résolu
zizou5roni Messages postés 25 Statut Membre -  
 robervalll -
Bonjour,
je cherche le code source de la realisation d'un chenillard a l'aide du PIC 16F84A
merci de m'aider
Configuration: Windows XP
Internet Explorer 6.0

1 réponse

  1. Hitmman
     
    ;---------------------------example d'application avec un pic: ---------------------
    ;
    ;titre:Chenillard
    ;date:19/12/2008
    ;auteur:HITMMAN
    ;pic utilisé:16f84A
    ;
    ;
    ;------------------------directive d'assemblage pour MPLAB------------------------------------
    processor 16f84a
    #include <p16f84a.inc>
    __config 3ff9h

    ;-------------------------definition des constantes-----------------------------------------
    #define bouton 4
    ;-------------------------definition des registres----------------------------------------

    retard1 EQU 0x22
    retard2 EQU 0x24
    memo EQU 0x26
    ;-------------------------remise a zero----------------------------------------------------
    org 0x00
    goto start

    ;------------------------initialisation des ports-----------------------------------------
    start
    bsf STATUS,5
    movlw 0x00
    movwf TRISB
    movlw 0x1f
    movwf TRISA
    bcf STATUS,5

    ;-------------------------initialisation des LEDs----------------------------------------

    clrf PORTB
    movlw 0x01
    movwf memo

    ;-------------------------programme principal--------------------------------------------
    debut
    btfss PORTA,bouton
    goto debut
    bsf STATUS,C
    debut1

    movf memo,w
    movwf PORTB
    call tempo
    RLF memo,f
    goto debut1
    ;-----------------------sousprogramme de temporisation------------------------------------
    tempo

    movlw 0xaa
    movwf retard1
    movwf retard2

    attente
    decfsz retard1,f
    goto attente

    movlw 0xff
    movwf retard1
    decfsz retard2,f
    goto attente
    return

    ;-------------------------sous programme de table affiche---------------------------------

    ;-----------------------------------------------------------------------------------------
    END
    4
    1. robervalll
       
      ok mon frère voici la reponse a ta question ce programme permet d'effectuer le chenillard a la suit d'une interruption sur rb0
      ;**l'en tete du programme ***
      PROCESSOR 16F84A
      INCLUDE <P16F84A.INC>
      __CONFIG H'3FF9'
      CBLOCK 0X0C
      VAR1; variable de travail
      COMPTEUR
      ENDC
      ORG 00
      GOTO DEBUT
      DEBUT BSF STATUS,RP0
      MOVLW H'1F' ;*****configuration du porta en entrée
      MOVWF TRISA
      MOVLW H'00'
      MOVWF TRISB;*****configuration du portb en sortie
      BCF STAUS,RP0
      BSF OPTION_REG,INTEDG;***** Interruption en front montant
      BSF INTCON,INTE;******autorisation d'interruption sur RB0
      BSF INTCON,GIE ;******* validation generale des interruptions
      NOP
      END
      0