If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
I have the Microchip PICKit2 programmer so that PIC is supported.
I just tryed to recompile a PBP program with the 18F2550 and i have no errors, the PIC starts and the LCD display works but not the serin2 and serout2 commands
it only sends junk data to the serialcommunicator via a FTDI232 chip.
When i import the code into the PICKit2 program i get a warning that says "Warning, Some configurations words not in HEX file"
well i think i have to read some datasheets about the config words i guess.
Are there any good webpage exept the datasheet that explain all the common configurations words for 18F2550 and how to set them in PBP?
Fredrick,
Unfortunately, no. You have to search the datasheet quite a bit as every PIC is a little bit different. However, here's a way to make it relatively quick:
Open the .INC file for your PIC. Assuming you're using Windows and installed everything in the default locations, go to: C:\PBP and open, in this case, 18F2550.INC. You'll see the following open in Notepad.
Here you see the default configurations PBP makes if you perform no changes. You have two options to change the config settings.Code:;**************************************************************** ;* 18F2550.INC * ;* * ;* By : Leonard Zerman, Jeff Schmoyer * ;* Notice : Copyright (c) 2007 microEngineering Labs, Inc. * ;* All Rights Reserved * ;* Date : 11/08/07 * ;* Version : 2.50a * ;* Notes : * ;**************************************************************** NOLIST ifdef PM_USED LIST "Error: PM does not support this device. Use MPASM." NOLIST else LIST LIST p = 18F2550, r = dec, w = -311, w = -230, f = inhx32 INCLUDE "P18F2550.INC" ; MPASM Header __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H __CONFIG _CONFIG3H, _PBADEN_OFF_3H __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L & 0DFh NOLIST endif LIST EEPROM_START EQU 0F00000h BLOCK_SIZE EQU 32
Method One: modify the config bits as needed (more on this below) and save the file. The only caveat is these settings will take effect in every PIC18F2550 you program unless you remember to change this file each and every time, so it's not typically recommended you do this. Additionally, doing this prevents having people help you with your code if a config setting is wrong or off.
Method Two: put a semi-colon in front of each and every __CONFIG, like so:
and save the file. All this does is comment out the default config settings so you can use your own in your program. Next, you need to set the config bits within you program, so use the following format at the beginning of your program:Code:;**************************************************************** ;* 18F2550.INC * ;* * ;* By : Leonard Zerman, Jeff Schmoyer * ;* Notice : Copyright (c) 2007 microEngineering Labs, Inc. * ;* All Rights Reserved * ;* Date : 11/08/07 * ;* Version : 2.50a * ;* Notes : * ;**************************************************************** NOLIST ifdef PM_USED LIST "Error: PM does not support this device. Use MPASM." NOLIST else LIST LIST p = 18F2550, r = dec, w = -311, w = -230, f = inhx32 INCLUDE "P18F2550.INC" ; MPASM Header ;__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L ;__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H ;__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H ;__CONFIG _CONFIG3H, _PBADEN_OFF_3H ;__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L & 0DFh NOLIST endif LIST EEPROM_START EQU 0F00000h BLOCK_SIZE EQU 32
What can I change is in the next post. Sorry, apparently this is too long for just one reply.Code:asm __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H __CONFIG _CONFIG3H, _PBADEN_OFF_3H __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L & 0DFh endasm
Now the question becomes, what can I change? Glad you asked, again assuming you've got Windows and everything is in the default location, open: C:\Program Files\Microchip\MPASM Suite. Now find and open P18F2550.INC, which will be a fairly large document. Scroll down to the very bottom and you'll see:
This is just a portion of all the configuration options, you'll have to open it up to see them all. Note that this chip has multiple config registers, so be sure to match up the desired setting with the proper register. The tedious part will be looking up what each of these mean in the datasheet if you don't already know. Off the bat, in register CONFIG2H I know WDT is watchdog timer and for most programs, I turn it off, but you may want it. I usually copy the config settings I don't recognize and perform a find (CTRL + F) in the datasheet. This may not always work as the abbriviations in the .INC file may not be in the datasheet, but a little searching and you'll find it. Hope this helps.Code:;========================================================================== ;========================================================================== ; ; Configuration Bits ; ; NAME Address ; CONFIG1L 300000h ; CONFIG1H 300001h ; CONFIG2L 300002h ; CONFIG2H 300003h ; CONFIG3H 300005h ; CONFIG4L 300006h ; CONFIG5L 300008h ; CONFIG5H 300009h ; CONFIG6L 30000Ah ; CONFIG6H 30000Bh ; CONFIG7L 30000Ch ; CONFIG7H 30000Dh ; ;========================================================================== ; The following is an assignment of address values for all of the ; configuration registers for the purpose of table reads _CONFIG1L EQU H'300000' _CONFIG1H EQU H'300001' _CONFIG2L EQU H'300002' _CONFIG2H EQU H'300003' _CONFIG3H EQU H'300005' _CONFIG4L EQU H'300006' _CONFIG5L EQU H'300008' _CONFIG5H EQU H'300009' _CONFIG6L EQU H'30000A' _CONFIG6H EQU H'30000B' _CONFIG7L EQU H'30000C' _CONFIG7H EQU H'30000D' ;----- CONFIG1L Options -------------------------------------------------- _PLLDIV_1_1L EQU H'F8' ; No prescale (4 MHz oscillator input drives PLL directly) _PLLDIV_2_1L EQU H'F9' ; Divide by 2 (8 MHz oscillator input) _PLLDIV_3_1L EQU H'FA' ; Divide by 3 (12 MHz oscillator input) _PLLDIV_4_1L EQU H'FB' ; Divide by 4 (16 MHz oscillator input) _PLLDIV_5_1L EQU H'FC' ; Divide by 5 (20 MHz oscillator input) _PLLDIV_6_1L EQU H'FD' ; Divide by 6 (24 MHz oscillator input) _PLLDIV_10_1L EQU H'FE' ; Divide by 10 (40 MHz oscillator input) _PLLDIV_12_1L EQU H'FF' ; Divide by 12 (48 MHz oscillator input) _CPUDIV_OSC1_PLL2_1L EQU H'E7' ; [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2] _CPUDIV_OSC2_PLL3_1L EQU H'EF' ; [OSC1/OSC2 Src: /2][96 MHz PLL Src: /3] _CPUDIV_OSC3_PLL4_1L EQU H'F7' ; [OSC1/OSC2 Src: /3][96 MHz PLL Src: /4] _CPUDIV_OSC4_PLL6_1L EQU H'FF' ; [OSC1/OSC2 Src: /4][96 MHz PLL Src: /6] _USBDIV_1_1L EQU H'DF' ; USB clock source comes directly from the primary oscillator block with no postscale _USBDIV_2_1L EQU H'FF' ; USB clock source comes from the 96 MHz PLL divided by 2 ;----- CONFIG1H Options -------------------------------------------------- _FOSC_XT_XT_1H EQU H'F0' ; XT oscillator, XT used by USB _FOSC_XTPLL_XT_1H EQU H'F2' ; XT oscillator, PLL enabled, XT used by USB _FOSC_ECIO_EC_1H EQU H'F4' ; External clock, port function on RA6, EC used by USB _FOSC_EC_EC_1H EQU H'F5' ; External clock, CLKOUT on RA6, EC used by USB _FOSC_ECPLLIO_EC_1H EQU H'F6' ; External clock, PLL enabled, port function on RA6, EC used by USB _FOSC_ECPLL_EC_1H EQU H'F7' ; External clock, PLL enabled, CLKOUT on RA6, EC used by USB _FOSC_INTOSCIO_EC_1H EQU H'F8' ; Internal oscillator, port function on RA6, EC used by USB _FOSC_INTOSC_EC_1H EQU H'F9' ; Internal oscillator, CLKOUT on RA6, EC used by USB _FOSC_INTOSC_XT_1H EQU H'FA' ; Internal oscillator, XT used by USB _FOSC_INTOSC_HS_1H EQU H'FB' ; Internal oscillator, HS used by USB _FOSC_HS_1H EQU H'FC' ; HS oscillator, HS used by USB _FOSC_HSPLL_HS_1H EQU H'FE' ; HS oscillator, PLL enabled, HS used by USB _FCMEN_OFF_1H EQU H'BF' ; Fail-Safe Clock Monitor disabled _FCMEN_ON_1H EQU H'FF' ; Fail-Safe Clock Monitor enabled _IESO_OFF_1H EQU H'7F' ; Oscillator Switchover mode disabled _IESO_ON_1H EQU H'FF' ; Oscillator Switchover mode enabled ;----- CONFIG2L Options -------------------------------------------------- _PWRT_ON_2L EQU H'FE' ; PWRT enabled _PWRT_OFF_2L EQU H'FF' ; PWRT disabled _BOR_OFF_2L EQU H'F9' ; Brown-out Reset disabled in hardware and software _BOR_SOFT_2L EQU H'FB' ; Brown-out Reset enabled and controlled by software (SBOREN is enabled) _BOR_ON_ACTIVE_2L EQU H'FD' ; Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled) _BOR_ON_2L EQU H'FF' ; Brown-out Reset enabled in hardware only (SBOREN is disabled) _BORV_0_2L EQU H'E7' ; Maximum setting _BORV_1_2L EQU H'EF' ; _BORV_2_2L EQU H'F7' ; _BORV_3_2L EQU H'FF' ; Minimum setting _VREGEN_OFF_2L EQU H'DF' ; USB voltage regulator disabled _VREGEN_ON_2L EQU H'FF' ; USB voltage regulator enabled ;----- CONFIG2H Options -------------------------------------------------- _WDT_OFF_2H EQU H'FE' ; HW Disabled - SW Controlled _WDT_ON_2H EQU H'FF' ; HW Enabled - SW Disabled _WDTPS_1_2H EQU H'E1' ; 1:1 _WDTPS_2_2H EQU H'E3' ; 1:2 _WDTPS_4_2H EQU H'E5' ; 1:4 _WDTPS_8_2H EQU H'E7' ; 1:8 _WDTPS_16_2H EQU H'E9' ; 1:16 _WDTPS_32_2H EQU H'EB' ; 1:32 _WDTPS_64_2H EQU H'ED' ; 1:64 _WDTPS_128_2H EQU H'EF' ; 1:128 _WDTPS_256_2H EQU H'F1' ; 1:256 _WDTPS_512_2H EQU H'F3' ; 1:512 _WDTPS_1024_2H EQU H'F5' ; 1:1024 _WDTPS_2048_2H EQU H'F7' ; 1:2048 _WDTPS_4096_2H EQU H'F9' ; 1:4096 _WDTPS_8192_2H EQU H'FB' ; 1:8192 _WDTPS_16384_2H EQU H'FD' ; 1:16384 _WDTPS_32768_2H EQU H'FF' ; 1:32768
-Tony
Thank you very much Tony.
That helped alot, now SERIN and SEROUT are working.
Now i trying to figure out how to make RA5 to digital input/output.
Look in the Analog to digital section... maybe in the comparator section (if there's any)
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Yepp i find it
sets all AN pins to Digital I/O.Code:ADCON1 = %000001111
See "REGISTER 21-2: ADCON1: A/D CONTROL REGISTER 1" in the datasheet for 18F2550
Thank you...
Bookmarks