Ich weiß ja nicht genau was du benutzt, aber in MPLAB kann man auf jeden fall die Config-Werte in die *.asm datei schreiben.
z.B.
Ich gebe dir jetzt abner keine garantie das die entsprechenden Config-Werte für deine Versuche die richtigen sind....Code:#include P16f88.INC ; Configuration festlegen __CONFIG _CP_OFF & _DEBUG_OFF & _WDT_OFF & _PWRTE_ON & _EXTRC_IO ;*****Set up the Constants**** STATUS equ 03h ;Address of the STATUS register TRISA equ 85h ;Address of the tristate register for port A PORTA equ 05h ;Address of Port A TRISB equ 86h PORTB equ 06h OSCCON equ 8Fh COUNT1 equ 20h ;First counter for our delay loops COUNT2 equ 21h ;Second counter for our delay loops ;****Set up the port**** call Delay bsf STATUS,RP0 ;Switch to Bank 1 movlw 10h ;Set the Port A pins movwf TRISA movlw 01h ;Set the Port B pins movwf TRISB movlw 2Eh movwf OSCCON clrf ANSEL bcf STATUS,RP0 ;Switch back to Bank 0 movlw 00h ; movwf PORTA movlw 00h movwf PORTB ;****Turn the 1st LED on**** Start movlw 04h ;Turn the Port A LEDs on by first putting it movwf PORTA ;into the w register and then on the port call Delay btfsc PORTA,4 ;if RA4 is on, the next instruction is skipped call Delay ;2nd LED movlw 08h ;Turn the Port A LEDs on by first putting it movwf PORTA ;into the w register and then on the port call Delay btfsc PORTA,4 call Delay ;3rd LED**** movlw 00h ;Turn the LEDs off by first putting it movwf PORTA ;into the w register and then on the port movlw 02h ;Turn LED on RB1 on movwf PORTB call Delay btfsc PORTA,4 call Delay ;4th LED movlw 04h movwf PORTB call Delay btfsc PORTA,4 call Delay ;5th LED movlw 10h movwf PORTB call Delay btfsc PORTA,4 call Delay ;6th LED movlw 20h movwf PORTB call Delay btfsc PORTA,4 call Delay ;turn all off movlw 00h movwf PORTB call Delay btfsc PORTA,4 call Delay ;****Now go back to the start of the program goto Start ;go back to Start and turn LEDs on again ;****Here is our Subroutine Delay movlw 30 movwf COUNT1 ;Load count1 with init value movlw 10 movwf COUNT2 ;Load count2 with init value Loop1 decfsz COUNT1,f ;This second loop keeps the LEDs goto Loop1 ;turned off long enough for us to decfsz COUNT2,f ;see it turned off goto Loop1 ; return ;****End of the program**** end ;Needed by some compilers, and also ;just in case we miss the goto instruction. end ;Needed by some compilers, and also ;just in case we miss the goto instruction.
Alle Config-Befehle kannst du am Ende der p16f88.INC Nachlesen, wofür die stehen und was die bewirken steht im Datenblatt!
Wenn du ein Brennprogramm von Sprut benutzt kannst du die Config-Werte auch direkt im Brennprogramm einstellen, auf der seite www.sprut.de ist das mit der Configuration auch noch mal erklärt.
Ein 100µF Elko schadet natürlich nicht.







Zitieren

Lesezeichen