18f452 için kod örneği arıyorum

Başlatan gofe, 25 Mart 2006, 19:44:25

gofe

Merhaba arkadaşlar.
18F452 için pbp kod örneği arıyorum sigortalarında yazılmış olduğu bir örneğe ihtiyacım var. Teşekkürler

memed52

LIST P=18F452         
   list  P=PIC18F452, F=INHX32, C=160, N=0, ST=OFF, MM=OFF, R=DEC, X=ON
   #include <P18F452.inc>            
;*************************************** Configuration ********************************************
;   _OSCS_ON_1H           ; Oscillator Switch enable
;   _OSCS_OFF_1H      
;   _LP_OSC_1H            ; Oscillator type
;   _XT_OSC_1H        
;   _HS_OSC_1H        
;   _RC_OSC_1H        
;   _EC_OSC_1H            ; External Clock w/OSC2 output divide by 4
;   _ECIO_OSC_1H          ; w/OSC2 as an IO pin (RA6)
;   _HSPLL_OSC_1H        ; HS PLL
;   _RCIO_OSC_1H          ; RC w/OSC2 as an IO pin (RA6)

   __CONFIG    _CONFIG1H, _OSCS_ON_1H & _EC_OSC_1H                ;1H

   __CONFIG    _CONFIG2L, _BOR_ON_2L & _BORV_20_2L & _PWRT_OFF_2L            ;2L
   __CONFIG    _CONFIG2H, _WDT_OFF_2H    ;& _WDTPS_128_2H               ;2H

   __CONFIG    _CONFIG3H, _CCP2MX_ON_3H                     ;3H

   __CONFIG    _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L         ;4L

   __CONFIG    _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L      ;5L
   __CONFIG    _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H                  ;5H

   __CONFIG    _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L   ;6L
   __CONFIG    _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H         ;6H

   __CONFIG    _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L   ;7L
   __CONFIG    _CONFIG7H, _EBTRB_OFF_7H                     ;7H
   
   __IDLOCS    _IDLOC0,0x00             ;ID Locations Register 0
   __IDLOCS    _IDLOC1,0x00             ;ID Locations Register 1
   __IDLOCS    _IDLOC2,0x00             ;ID Locations Register 2
   __IDLOCS    _IDLOC3,0x00             ;ID Locations Register 3
   __IDLOCS    _IDLOC4,0x00             ;ID Locations Register 4
   __IDLOCS    _IDLOC5,0x00             ;ID Locations Register 5
   __IDLOCS    _IDLOC6,0x00             ;ID Locations Register 6
   __IDLOCS    _IDLOC7,0x00             ;ID Locations Register 7


Kolay gelsin

gofe

Teşekkür ederim . Yeterli olmadı. galiba ben beceremedim.

memed52

PICBasicPro için sormuşsunuz geç fark ettim, ben assember için başlık verdim picbasic bilmiyorum.
İyi çalışmalar

gofe

OSCCON = 0 'SET SYSTEM CLOCK SWITCH BIT
RCON = %00011111 'CLEAR IPEN,RI,TO,PD,POR,BOR
INTCON2 = %11000000 'NO PULL-UPS,INTEDG0 RISING,INTEDG1,INTEDG2,TMR01P,RBIP
INTCON3 = %00000000 'CLEAR INT2IP,INT1IP,INT2IE,INT1IE,INT2IF,INT1IF
' PIE1 = %00100000 'CLEAR ALL INTERRUPT ENABLE BITS(EXCEPT RCIE)
PIE2 = %00000000 'CLEAR ALL INTERRUPT ENABLE BITS
IPR1 = %00000000 'SET ALL INTERRUPT PRIORITY BITS TO LOW
IPR2 = %00000000 'SET ALL INTERRUPT PRIORITY BITS TO LOW
PIR1 = %00000000 'CLEAR ALL INTERRUPT FLAGS
PIR2 = %00000000 'CLEAR ALL INTERRUPT FLAGS
ADCON0 = %10000001 'FOSC/64,AN0,A/DONE,A/D OFF
ADCON1 = %11000010 'RIGHT JUST,A/D CLOCK SELECT,RA0:RA3,RA5 ANALOG PINS, RE0:RE2 DIGITAL PINS
LVDCON = %00001111 'CLEAR IRVST,LVDEN,AND SELECT LVDIN
WDTCON = %00000000 'DISABLE WATCH DOG TIMER

TRISA = %101111 'INITIALIZE PORT DIRECTIONS
TRISB = %01101111
TRISC = %10101001
TRISD = %00000011
TRISE = %00000111

T0CON = %00000000 'PRESCALER,WRITE PRESCALER 1/2, TURN OFF TIMER 0
' T1CON = %10000100 'WRITE PRESCALER 1/1, TURN OFF TIMER 1
T2CON = %00000100 'WRITE PRESCALER 1/1, TURN ON TIMER 2
T3CON = %10000100 'WRITE PRESCALER 1/1, TURN OFF TIMER 3
TMR2 = 0 'CLEAR TMR2 MODULE REGISTER
PR2 = $FF 'SET PERIOD (1/1 PRESCALE * 256 PR2 * 1/40,000,000 * 4 = 39.06 Khz.
CCPR1L = $00 'CLEAR UPPER 8 BITS
CCPR2L = $00 'CLEAR UPPER 8 BITS
CCP1CON = $0C 'PLACE CCP1 INTO PWM MODE
CCP2CON = $0C 'PLACE CCP2 INTO PWM MODE