Elektronik ve Teknoloji Merkezi Elektrotekno.com
Elektronik ve Teknoloji Merkezi



Click here to go to the original topic

Elektrotekno.com Ana Sayfa Microchip Pic Serisi
Yazar Mesaj
has_artvinli
Tarih: 07.09.2008, 13:41 Mesaj konusu: Pic18F4550 iç osilatörü ve config bilgileri - yardım

Arkadaşlar öncelikle merhaba ben pic18f4550 nin iç osilatörünü nasıl çalıştırabileceğim hakkında biraz bilgi arıyorum örneğin bu iç osilatörü 4mhz de çalıştırmak istesem ayarları ne olacak 8mhzde ne olacak gibi konular
Bütün bunların yanında ben programı proton basic ile yaptığım için aşağıdaki gibi bir config bildirileri çıktı hepsi sağlıklı bir şekilde derlenebiliyo hatasız olarak ama ben burda bazı terimlerin anlamlarını bilmiyorum örnek vermek gerekirse FCMEM_OFF_1 gibi yada VREGEN_OFF_2,LPT1OSC_OFF_3 gibi bildiriler ne anlama geliyor yani neyi kontrol etmek için kullanılıyor bu konuda detaylı bilgiler verebilirseniz çok ama çok memnun olurum entegrenin datasheet ine baktım ama ingilizcem pek iyi olmadığı için pek de bişey çıkartamadım.

@CONFIG_REQ
@__config config1l, PLLDIV_1_1
@__CONFIG config1h, FOSC_INTOSC_XT_1 & FCMEM_OFF_1 & IESO_OFF_1
@__CONFIG config2l, PWRT_OFF_2 & BOR_OFF_2 & VREGEN_OFF_2
@__CONFIG config2h, WDT_OFF_2
@__CONFIG config3h, MCLRE_OFF_3 & LPT1OSC_OFF_3 & PBADEN_OFF_3 & CCP2MX_OFF_3
@__CONFIG config4l, STVREN_OFF_4 & LVP_OFF_4 & ICPRT_OFF_4 & XINST_OFF_4 & DEBUG_OFF_4
@__CONFIG config5l, CP0_OFF_5 & CP1_OFF_5 & CP2_OFF_5 & CP3_OFF_5
@__CONFIG config5h, CPB_OFF_5 & CPD_OFF_5
@__CONFIG config6l, WRT0_OFF_6 & WRT1_OFF_6 & WRT2_OFF_6 & WRT3_OFF_6
@__CONFIG config6h, WRTB_OFF_6 & WRTC_OFF_6 & WRTD_OFF_6
@__CONFIG config7l, EBTR0_OFF_7 & EBTR1_OFF_7 & EBTR2_OFF_7 & EBTR3_OFF_7
@__CONFIG config7h, EBTRB_OFF_7 & _DEVID1 & _DEVID2 & _IDLOC0

ilgilerinizden dolayı şimdiden teşekkür eder hayırlı çalışmalar dilerim
-----------------------------------------------------

has_artvinli
Tarih: 09.09.2008, 19:15 Mesaj konusu: Pic18F4550 config Ayarları

arkadaşlar şimdilik bulabildiğim konuları burada yazmak istedim bildirmem gereken şey ise konuyu farklı bir siteden başka bir arkadaşımızın anlatmış olmasıdır ki kendilerine burdan sonsuz teşekkürlerimi iletiyorum eline ve yüreğine sağlık...
tanımlamalardan ayrıca birde yine farklı sitelerden bulduğum farklı 18f serisi piclere ait proton basic ile yazılmış programları da burada örnek olması açısından paylaşmak istiyorum umarım ilgilenen arkadaşların projelerinde faydası olur...

***************************************************************************************************
pll prescaler selection bits:
plldıv = 1
no prescale (4 mhz oscillator input drives pll directly)
plldıv = 2
divide by 2 (8 mhz oscillator input)
plldıv = 3
divide by 3 (12 mhz oscillator input)
plldıv = 4
divide by 4 (16 mhz oscillator input)
plldıv = 5
divide by 5 (20 mhz oscillator input)
plldıv = 6
divide by 6 (24 mhz oscillator input)
plldıv = 10
divide by 10 (40 mhz oscillator input)
plldıv = 12
divide by 12 (48 mhz oscillator input)

cpu system clock postscaler:
cpudıv = osc1_pll2
[osc1/osc2 src: /1][96 mhz pll src: /2]
cpudıv = osc2_pll3
[osc1/osc2 src: /2][96 mhz pll src: /3]
cpudıv = osc3_pll4
[osc1/osc2 src: /3][96 mhz pll src: /4]
cpudıv = osc4_pll6
[osc1/osc2 src: /4][96 mhz pll src: /6]

usb clock selection bit (used in full speed usb mode only; ucfg:fsen = 1):
usbdıv = 1
usb clock source comes directly from the primary oscillator block with no postscale
usbdıv = 2
usb clock source comes from the 96 mhz pll divided by 2

oscillator selection bits:
fosc = xt_xt
xt oscillator, xt used by usb
fosc = xtpll_xt
xt oscillator, pll enabled, xt used by usb
fosc = ecıo_ec
external clock, port function on ra6, ec used by usb
fosc = ec_ec
external clock, clkout on ra6, ec used by usb
fosc = ecpllıo_ec
external clock, pll enabled, port function on ra6, ec used by usb
fosc = ecpll_ec
external clock, pll enabled, clkout on ra6, ec used by usb
fosc = ıntoscıo_ec
ınternal oscillator, port function on ra6, ec used by usb
fosc = ıntosc_ec
ınternal oscillator, clkout on ra6, ec used by usb
fosc = ıntosc_xt
ınternal oscillator, xt used by usb
fosc = ıntosc_hs
ınternal oscillator, hs used by usb
fosc = hs
hs oscillator, hs used by usb
fosc = hspll_hs
hs oscillator, pll enabled, hs used by usb

fail-safe clock monitor enable bit:
fcmen = off
fail-safe clock monitor disabled
fcmen = on
fail-safe clock monitor enabled

ınternal/external oscillator switchover bit:
ıeso = off
oscillator switchover mode disabled
ıeso = on
oscillator switchover mode enabled

power-up timer enable bit:
pwrt = on
pwrt enabled
pwrt = off
pwrt disabled

brown-out reset enable bits:
bor = off
brown-out reset disabled in hardware and software
bor = soft
brown-out reset enabled and controlled by software (sboren is enabled)
bor = on_actıve
brown-out reset enabled in hardware only and disabled in sleep mode (sboren is disabled)
bor = on
brown-out reset enabled in hardware only (sboren is disabled)

brown-out voltage bits:
borv = 0
maximum setting
borv = 1

borv = 2

borv = 3
minimum setting

usb voltage regulator enable bit:
vregen = off
usb voltage regulator disabled
vregen = on
usb voltage regulator enabled

watchdog timer enable bit:
wdt = off
hw disabled - sw controlled
wdt = on
hw enabled - sw disabled

watchdog timer postscale select bits:
wdtps = 1
1:1
wdtps = 2
1:2
wdtps = 4
1:4
wdtps = 8
1:8
wdtps = 16
1:16
wdtps = 32
1:32
wdtps = 64
1:64
wdtps = 128
1:128
wdtps = 256
1:256
wdtps = 512
1:512
wdtps = 1024
1:1024
wdtps = 2048
1:2048
wdtps = 4096
1:4096
wdtps = 8192
1:8192
wdtps = 16384
1:16384
wdtps = 32768
1:32768

mclr pin enable bit:
mclre = off
re3 input pin enabled; mclr disabled
mclre = on
mclr pin enabled; re3 input pin disabled

low-power timer 1 oscillator enable bit:
lpt1osc = off
timer1 configured for higher power operation
lpt1osc = on
timer1 configured for low-power operation

portb a/d enable bit:
pbaden = off
portb<4:0> pins are configured as digital ı/o on reset
pbaden = on
portb<4:0> pins are configured as analog input channels on reset

ccp2 mux bit:
ccp2mx = off
ccp2 input/output is multiplexed with rb3
ccp2mx = on
ccp2 input/output is multiplexed with rc1

stack full/underflow reset enable bit:
stvren = off
stack full/underflow will not cause reset
stvren = on
stack full/underflow will cause reset

single-supply ıcsp enable bit:
lvp = off
single-supply ıcsp disabled
lvp = on
single-supply ıcsp enabled

dedicated ın-circuit debug/programming port (ıcport) enable bit:
ıcprt = off
ıcport disabled
ıcprt = on
ıcport enabled

extended ınstruction set enable bit:
xınst = off
ınstruction set extension and ındexed addressing mode disabled (legacy mode)
xınst = on
ınstruction set extension and ındexed addressing mode enabled

background debugger enable bit:
debug = on
background debugger enabled, rb6 and rb7 are dedicated to ın-circuit debug
debug = off
background debugger disabled, rb6 and rb7 configured as general purpose ı/o pins

code protection bit block 0:
cp0 = on
block 0 (000800-001fffh) code-protected
cp0 = off
block 0 (000800-001fffh) not code-protected

code protection bit block 1:
cp1 = on
block 1 (002000-003fffh) code-protected
cp1 = off
block 1 (002000-003fffh) not code-protected

code protection bit block 2:
cp2 = on
block 2 (004000-005fffh) code-protected
cp2 = off
block 2 (004000-005fffh) not code-protected

code protection bit block 3:
cp3 = on
block 3 (006000-007fffh) code-protected
cp3 = off
block 3 (006000-007fffh) not code-protected

boot block code protection bit:
cpb = on
boot block (000000-0007ffh) code-protected
cpb = off
boot block (000000-0007ffh) not code-protected

data eeprom code protection bit:
cpd = on
data eeprom code-protected
cpd = off
data eeprom not code-protected

write protection bit block 0:
wrt0 = on
block 0 (000800-001fffh) write-protected
wrt0 = off
block 0 (000800-001fffh) not write-protected

write protection bit block 1:
wrt1 = on
block 1 (002000-003fffh) write-protected
wrt1 = off
block 1 (002000-003fffh) not write-protected

write protection bit block 2:
wrt2 = on
block 2 (004000-005fffh) write-protected
wrt2 = off
block 2 (004000-005fffh) not write-protected

write protection bit block 3:
wrt3 = on
block 3 (006000-007fffh) write-protected
wrt3 = off
block 3 (006000-007fffh) not write-protected

boot block write protection bit:
wrtb = on
boot block (000000-0007ffh) write-protected
wrtb = off
boot block (000000-0007ffh) not write-protected

configuration register write protection bit:
wrtc = on
configuration registers (300000-3000ffh) write-protected
wrtc = off
configuration registers (300000-3000ffh) not write-protected

data eeprom write protection bit:
wrtd = on
data eeprom write-protected
wrtd = off
data eeprom not write-protected

table read protection bit block 0:
ebtr0 = on
block 0 (000800-001fffh) protected from table reads executed in other blocks
ebtr0 = off
block 0 (000800-001fffh) not protected from table reads executed in other blocks

table read protection bit block 1:
ebtr1 = on
block 1 (002000-003fffh) protected from table reads executed in other blocks
ebtr1 = off
block 1 (002000-003fffh) not protected from table reads executed in other blocks

table read protection bit block 2:
ebtr2 = on
block 2 (004000-005fffh) protected from table reads executed in other blocks
ebtr2 = off
block 2 (004000-005fffh) not protected from table reads executed in other blocks

table read protection bit block 3:
ebtr3 = on
block 3 (006000-007fffh) protected from table reads executed in other blocks
ebtr3 = off
block 3 (006000-007fffh) not protected from table reads executed in other blocks

boot block table read protection:
ebtrb = on
boot block (000000-0007ffh) protected from table reads executed in other blocks
ebtrb = off
boot block (000000-0007ffh) not protected from table reads executed in other blocks

*************************************************************************************************

'****************************************************************
'* name : 20074 - pıc18f4455 a/d test *
'* author : jeroen boere *
'* notice : copyright (c) 2007 jeroen boere *
'* : all rights reserved *
'* date : 9/05/2007 *
'* version : 1.0 *
'* notes : xtal 20mhz *
'* : pıc18f4455 *
'****************************************************************

devıce 18f4455

@confıg_req
@__config confıg1l, plldıv_1_1 & cpudıv_1_1 & usbdıv_1_1
@__config confıg1h, fosc_hs_1 & fcmem_off_1 & ıeso_off_1
@__config confıg2l, pwrt_on_2 & bor_off_2 & vregen_on_2
@__config confıg2h, wdt_off_2 & wdtps_128_2
@__config confıg3h, mclre_on_3 & lpt1osc_off_3 & pbaden_off_3 & ccp2mx_off_3
@__config confıg4l, stvren_off_4 & lvp_off_4 & ıcprt_off_4 & xınst_off_4 & debug_off_4
@__config confıg5l, cp0_off_5 & cp1_off_5 & cp2_off_5
@__config confıg5h, cpb_off_5 & cpb_off_5
@__config confıg6l, wrt0_off_6 & wrt1_off_6 & wrt2_off_6
@__config confıg6h, wrtc_off_6 & wrtb_off_6 & wrtd_off_6
@__config confıg7l, ebtr0_off_7 & ebtr1_off_7 & ebtr2_off_7
@__config confıg7h, ebtrb_off_7

all_dıgıtal = false ' we use some analog ı/o's

xtal = 20 ' used clock frqz = 20mhz
'76543210 ' bit wise output mask
trısa = %11111111 ' set the trısa bit
porta = %00000111 ' set porta ı/o config
adcon1= %00001100

adın_res = 10 ' use the 10 bit result a/d
adın_tad = frc ' use the frc (clock source)
adın_stıme = 50 ' sample time of 50 ms


dım var_vol12 as float ' declare variable
dım var_vol9 as float ' declare variable
dım var_vol5 as float ' declare variable

declare lcd_ınterface = 4 ' 4 bit's interface lcd
declare lcd_enpın = portd.2 ' lcd enable pin
declare lcd_rspın = portd.3 ' lcd rs pin
declare lcd_dtpın = portd.4 ' lcd dt pin
declare lcd_lınes = 4 ' type lcd scherm

cls ' clear the lcd

prınt at 1,1, "* voltage monıtor *" ' write static text on display
prınt at 2,1, "+12v:" ' write static text on display
prınt at 3,1, "+9v :" ' write static text on display
prınt at 4,1, "+5v :" ' write static text on display
again: ' start of loop
prınt at 2,7, sdec2 var_vol12, " v " ' display the calculated voltage
prınt at 3,8, sdec2 var_vol9, " v " ' display the calculated voltage
prınt at 4,8, sdec2 var_vol5, " v " ' display the calculated voltage
var_vol12 = adın 0 ' read the a/d converter an0
var_vol12 = var_vol12 / 5400 ' calculate the correct value *note 1
var_vol9 = adın 1 ' read the a/d converter an1
var_vol9 = var_vol9 / 7222 ' calculate the correct value *note 2
var_vol5 = adın 2 ' read the a/d converter an2
var_vol5 = var_vol5 / 13000 ' calculate the correct value *note 3
delayms 1000 ' wait 1 second
goto again ' do it all again!

end

devıce 18f2550

@confıg_req
@__config confıg1l, plldıv_1_1 & cpudıv_1_1 & usbdıv_1_1
@__config confıg1h, fosc_hs_1 & fcmem_off_1 & ıeso_off_1
@__config confıg2l, pwrt_on_2 & bor_off_2 & vregen_on_2
@__config confıg2h, wdt_off_2 & wdtps_128_2
@__config confıg3h, mclre_on_3 & lpt1osc_off_3 & pbaden_off_3 & ccp2mx_off_3
@__config confıg4l, stvren_off_4 & lvp_off_4 & ıcprt_off_4 & xınst_off_4 & debug_off_4
@__config confıg5l, cp0_off_5 & cp1_off_5 & cp2_off_5
@__config confıg5h, cpb_off_5 & cpb_off_5
@__config confıg6l, wrt0_off_6 & wrt1_off_6 & wrt2_off_6
@__config confıg6h, wrtc_off_6 & wrtb_off_6 & wrtd_off_6
@__config confıg7l, ebtr0_off_7 & ebtr1_off_7 & ebtr2_off_7
@__config confıg7h, ebtrb_off_7

all_dıgıtal true

xtal = 20
'76543210 ' bit wise output mask

spbrg = %00001111 ' set baud rate to 19200 (=15 dec)
rcsta = %10010000 ' enable se-ri-@l continuous receive
txsta = %00100000 ' enable transmit asynchronous mode
baudcon = %00000000 ' no special features

symbol int_led = portc.1
symbol flash_led = portc.0
dım rx_byte[3] as byte
dım cmd_str as strıng * 3

start:
ıntcon.7 = 1 ' enable global ınterrupts
ıntcon.6 = 1 ' enable peripheral ınterrupts
pıe1.5 = 1 ' enable uart rx ınterrupt

on_ınterrupt goto ınt ' ıf there is uart activity: goto ınt

goto maın ' skip the ısr, goto main program

ınt: ' begin of the ısr
hıgh int_led ' make ınterrupt bit high
hserın[str rx_byte] ' read rcreg and put into byte array
pır1.5 = 0 ' just to be sure: clear the ınterrupt flag
cmd_str[0] = rx_byte[0] ' store first byte in string at pos 0
cmd_str[1] = rx_byte[1] '
cmd_str[2] = rx_byte[2] '
cmd_str[3] = 0 ' terminate the string
delayms 100 ' wait 100 ms (just for fun )
ıf cmd_str = "lre" then hserout["live read ok!"] ' ıf lre, output string
ıf cmd_str = "mra" then hserout["memory read ok!"] ' ıf mra, output string
low int_led ' the end of the ısr, clear ınt-led
goto start ' goto start so ısr will be used again

maın: ' main programloop
low flash_led ' flashled is off
delayms 500 ' wait 500 ms
hıgh flash_led ' flashled is on
delayms 500 ' wait 500 ms
goto maın ' again, begin the loop


end ' end of program!

******************************************************************************************
@config_req

@__config config1h, osc_hs_1 & fcmen_off_1 & ıeso_off_1
@__config config2l, boren_on_2 & borv_46_2 & pwrt_on_2
@__config config2h, wdt_off_2 & wdtps_1_2
@__config config3h, mclre_off_3 & lpt1osc_off_3& pbaden_off_3

@__config config4l, xınst_off_4 & stvren_off_4 & lvp_off_4 & debug_off_4
@__config config5l, cp0_off_5 & cp1_off_5 & cp2_off_5 & cp3_off_5
@__config config5h, cpb_off_5 & cpd_off_5
@__config config6l, wrt0_off_6 & wrt1_off_6 & wrt2_off_6 & wrt3_off_6
@__config config6h, wrtb_off_6 & wrtc_off_6 & wrtd_off_6
@__config config7l, ebtr0_off_7 & ebtr1_off_7 & ebtr2_off_7 & ebtr3_off_7
@__config config7h, ebtrb_off_7

declare watchdog = off
'declare stack_sıze = 12
device 18f2520
xtal = 20
'clear
declare lcd_ınterface 4
declare lcd_dtpın portc.0
declare lcd_enpın portb.1
declare lcd_rspın portb.2
declare lcd_lınes 2
cls
delayms 2000

print "welcome"

while 0 = 0
wend
Elektrotekno.com Ana Sayfa Microchip Pic Serisi
1. sayfa (Toplam 1 sayfa)

Pic18F4550 iç osilatörü ve config bilgileri - yardım

Gizlilik Politikası

PLC programming