Hallo zusammen, bin relativ neu in der PIC-Materie und habe jetzt schon mein erstes Problem, wollte mal schnell mit einer
Zeitschleife die 2 LEDs mit einem Blinklicht testen, es stimmt aber vorne
und hinten nicht.
Code:list p=12F508 ; list directive to define processor #include <p12F508.inc> ; processor specific variable definitions __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC ; '__CONFIG' directive is used to embed configuration word within .asm file. ; The lables following the directive are located in the respective .inc file. ; See respective data sheet for additional information on configuration word. ;***** VARIABLE DEFINITIONS TEMP_VAR UDATA sGPIO res 1 cn1 res 1 cn2 res 1 cn3 res 1 ;********************************************************************** RESET_VECTOR CODE 0x1FF ; processor reset vector ; Internal RC calibration value is placed at location 0x1FF by Microchip ; as a movlw k, where the k is a literal value. MAIN CODE 0x000 movwf OSCCAL ; update register with factory cal value ;Initialisierung start movlw b'00000000' ;OPTION-Register konfigurieren, damit TRIS nicht überschrieben OPTION ;wird. movlw b'11111001' ;GP1,GP2 = Ausgänge. Tris GPIO clrf sGPIO ;Main flash movf sGPIO,w xorlw b'00000110' movwf GPIO movwf sGPIO ;warten clrf cn1 clrf cn2 movlw .23 movwf cn3 w1 nop ;1 Cycle nop ;1 Cycle decfsz cn1,f ;1 Cycle goto w1 ;2 Cycle ;(256*5)=1280 nop ;1 Cycle nop ;1 Cycle decfsz cn2,f ;1 Cycle goto w1 ;2 Cycle ;1280*(*256*5)=1638400 nop ;1 Cycle decfsz cn3,f ;1 Cycle goto w1 ;2 Cycle ;1634800*(4*23)=150732800µs=150,73s=2,5min goto flash END ; directive 'end of program'
die LEDs leuchten nur 8sec statt 2,5min. Als Quarz wird das interne mit
4Mhz verwendet







Zitieren

Lesezeichen