Fichier Init:
Code : Tout sélectionner
;************************************************************************************************
; F6FCO
; Hello World
; 24 oct 2023
;
;
Errorlevel-302 ; Supprime le message "Ensure that bank bits are correct"
list p=18f2525 ; processeur utilisé
#include <p18f2525.inc> ; Définitions des constantes PIC
CONFIG OSC = INTIO67 ; Oscillateur interne 8MHz
CONFIG IESO = OFF ; Délai au démarrage (ON/OFF)
CONFIG BOREN = OFF ; Reset si chute de tension (ON/OFF)
CONFIG PWRT = ON ; Délai au démarrage (ON/OFF)
CONFIG BORV = 0 ; Tension de reset en 1/10ème Volts
CONFIG WDT = OFF ; Mise hors service du watchdog (ON/OFF)
CONFIG PBADEN = OFF ; PORTB<4:0> les broches sont configurées comme E/S numériques lors de la réinitialisation
CONFIG LPT1OSC = OFF ; Timer1 configuré pour un fonctionnement plus puissant
CONFIG MCLRE = ON ; Mclr configuré comme entrée
CONFIG STVREN = ON ; Reset sur débordement de pile (ON/OFF)
CONFIG LVP = OFF ; Programmation basse tension autorisée (ON/OFF)
CONFIG XINST = OFF ; L'extension du jeu d'instructions et le mode d'adressage indexé sont désactivés(mode hérité)
CONFIG DEBUG = OFF ; Debugger hors service
CONFIG CP0 = OFF ; Code protection sur block 0 (ON/OFF)
CONFIG CP1 = OFF ; Code protection sur block 1 (ON/OFF)
CONFIG CP2 = OFF ; Code protection sur block 2 (ON/OFF)
CONFIG CPB = OFF ; Code protection sur bootblock (ON/OFF)
CONFIG CPD = OFF ; Code protection sur eeprom (ON/OFF)
CONFIG WRT0 = OFF ; Protection écriture block 0 (ON/OFF)
CONFIG WRT1 = OFF ; Protection écriture block 1 (ON/OFF)
CONFIG WRT2 = OFF ; Protection écriture block 2 (ON/OFF)
CONFIG WRTB = OFF ; Protection écriture bootblock (ON/OFF)
CONFIG WRTC = OFF ; Protection écriture configurations (ON/OFF)
CONFIG WRTD = OFF ; Protection écriture zone eeprom (ON/OFF)
CONFIG EBTR0 = OFF ; Protection lecture de table block 0 (ON/OFF)
CONFIG EBTR1 = OFF ; Protection lecture de table block 1 (ON/OFF)
CONFIG EBTR2 = OFF ; Protection lecture de table block 2 (ON/OFF)
CONFIG EBTRB = OFF ; Protection lecture de table bootblock (ON/OFF)
;#define bip PORTA,1
CBLOCK H'0'
;--------------- variables
Reg_1 :1 ; tempo
Reg_2 :1 ; tempo
Reg_3 :1 ; tempo
conchita :2 ; variable bonne à tout faire
LcdLigne :1 ; LCD
LcdColonne :1 ; LCD
ENDC
ORG H'0'
init
movlw b'01110011'
movwf OSCCON ; oscillateur interne à 8 Mhz
;
movlw 0Fh
movwf ADCON1 ; mode digital
;
movlw b'00000000'
movwf TRISA
clrf PORTA
;
movlw b'00000000'
movwf TRISB
clrf PORTB
;
movlw b'00000000'
movwf TRISC
clrf PORTC
Fichier Main:
Code : Tout sélectionner
#include <Init Hello World 2525.asm>
main
bcf PORTB,4
nop
call tempo300ms
bsf PORTB,4
nop
call tempo300ms
bra main
tempo300ms
; Délai 600 000 Cycles de la machine
; Durée du délai 300 millisecond
; Fréquence de l'oscillateur 8 MHZ
movlw .51
movwf Reg_1,1
movlw .12
movwf Reg_2
movlw .4
movwf Reg_3
decfsz Reg_1,F,1
bra $-2
decfsz Reg_2
bra $-6
decfsz Reg_3
bra $-.10
nop
nop
return
END
