Mein ganzer anfang sieht wie folgt aus:
Code:
LIST P=16F876A, R=DEC ; Benutze Pic16F676A
#include "P16F876A.INC" ; Fileheader includen
__config _HS_OSC & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_ON
waitloopA equ 0x20 ; warteschleife A
waitloopB equ 0x21 ; warteschleife B
waitloopC equ 0x22 ; warteschleife C
#define StatusLED1 PORTC,2 ; Status LED 1
#define StatusLED2 PORTC,1 ; Status LED 1
#define StatusLED3 PORTC,0 ; Status LED 1
#define ServoD0 PORTA,3 ; ServoData 0
#define ServoD1 PORTA,4 ; ServoData 1
#define ServoD2 PORTA,5 ; ServoData 2
#define MotorD0 PORTA,0 ; MotorData 0
#define MotorD1 PORTA,1 ; MotorData 1
#define MotorD2 PORTA,2 ; MotorData 2
init
;
; --------------------------------
; Ports Initalisieren
; --------------------------------
; 0 = Output, 1 = Input
clrf PORTA
clrf PORTB
clrf PORTC
bsf STATUS,RP0 ; RAM Bank 1
; 16F876: alle ADC-Eingänge auf digital I/O umschalten
MOVLW 0x06 ; PCFG3..0 = '0110'
MOVWF ADCON1
movlw b'00000000'
movwf TRISA
movlw b'11111111'
movwf TRISB
movlw b'11111000'
movwf TRISC
bcf STATUS, RP0 ; Bank 0
goto StartPIC
Lesezeichen