Hello Kirk,
I have tried your code from post1 using the configs that Mackrackit gave you. It seems to work fine over here. Since you don't have a pause between your on and off, the pulses will occur at about 15000 times per second. "Should scope to > 200Hz" indeed! If you were trying to make a blink (and be able to see it with your naked eye, the common way is to: (Page 6 of the PBP manual)
Code:
Loop1:
portb.0 = 1
pause 500
portb.0 = 0
pause 500
goto Loop1
This will make your LED turn on once per second for half a second.

Originally Posted by
Kirk Fraser
Ok, I've tried and conclude there is something way wrong with your software and documentation.
Perhaps you ought to try the usual strategy of providing software updates. You know, when a new
PIC is available, make an update button on your MicroCode Studio to go to your website and get the
new code for it.
Not sure what you mean about updates. Are you missing some chips in Micro Code Studios drop down menu?
The above "Define" means nothing to me and I can't find anywhere to learn about
it. Your URL is maybe for someone at your level of expertese but I need more handholding.
(See page 33 of the PBP manual, under section 4.16). The define OSC 8 tells PBP what speed your oscillator is set to run at. Without this, PBP assumes you are using a 4 mhz osc, and a pause 1000 will not be one second if you are using a different osc speed.The configs are settings for that particular chip. Each project you do, may need different settings for these configuration fuses, depending on what you are trying to do. You can find them in the data sheet for the chip, but I find it easier to look in the Microchip include files here: C:\Program Files\Microchip\MPASM Suite. If you look at the bottom of the include file for your particular chip, it shows:
Code:
;----- 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' ; [Primary Oscillator Src: /1][96 MHz PLL Src: /2]
_CPUDIV_OSC2_PLL3_1L EQU H'EF' ; [Primary Oscillator Src: /2][96 MHz PLL Src: /3]
_CPUDIV_OSC3_PLL4_1L EQU H'F7' ; [Primary Oscillator Src: /3][96 MHz PLL Src: /4]
_CPUDIV_OSC4_PLL6_1L EQU H'FF' ; [Primary Oscillator 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)
_FOSC_XTPLL_XT_1H EQU H'F2' ; XT oscillator, PLL enabled (XTPLL)
_FOSC_ECIO_EC_1H EQU H'F4' ; EC oscillator, port function on RA6 (ECIO)
_FOSC_EC_EC_1H EQU H'F5' ; EC oscillator, CLKO function on RA6 (EC)
_FOSC_ECPLLIO_EC_1H EQU H'F6' ; EC oscillator, PLL enabled, port function on RA6 (ECPIO)
_FOSC_ECPLL_EC_1H EQU H'F7' ; EC oscillator, PLL enabled, CLKO function on RA6 (ECPLL)
_FOSC_INTOSCIO_EC_1H EQU H'F8' ; Internal oscillator, port function on RA6, EC used by USB (INTIO)
_FOSC_INTOSC_EC_1H EQU H'F9' ; Internal oscillator, CLKO function on RA6, EC used by USB (INTCKO)
_FOSC_INTOSC_XT_1H EQU H'FA' ; Internal oscillator, XT used by USB (INTXT)
_FOSC_INTOSC_HS_1H EQU H'FB' ; Internal oscillator, HS oscillator used by USB (INTHS)
_FOSC_HS_1H EQU H'FC' ; HS oscillator (HS)
_FOSC_HSPLL_HS_1H EQU H'FE' ; HS oscillator, PLL enabled (HSPLL)
_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' ; WDT disabled (control is placed on the SWDTEN bit)
_WDT_ON_2H EQU H'FF' ; WDT enabled
_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
;----- CONFIG3H Options --------------------------------------------------
_CCP2MX_OFF_3H EQU H'FE' ; CCP2 input/output is multiplexed with RB3
_CCP2MX_ON_3H EQU H'FF' ; CCP2 input/output is multiplexed with RC1
_PBADEN_OFF_3H EQU H'FD' ; PORTB<4:0> pins are configured as digital I/O on Reset
_PBADEN_ON_3H EQU H'FF' ; PORTB<4:0> pins are configured as analog input channels on Reset
_LPT1OSC_OFF_3H EQU H'FB' ; Timer1 configured for higher power operation
_LPT1OSC_ON_3H EQU H'FF' ; Timer1 configured for low-power operation
_MCLRE_OFF_3H EQU H'7F' ; RE3 input pin enabled; MCLR pin disabled
_MCLRE_ON_3H EQU H'FF' ; MCLR pin enabled; RE3 input pin disabled
;----- CONFIG4L Options --------------------------------------------------
_STVREN_OFF_4L EQU H'FE' ; Stack full/underflow will not cause Reset
_STVREN_ON_4L EQU H'FF' ; Stack full/underflow will cause Reset
_LVP_OFF_4L EQU H'FB' ; Single-Supply ICSP disabled
_LVP_ON_4L EQU H'FF' ; Single-Supply ICSP enabled
_ICPRT_OFF_4L EQU H'DF' ; ICPORT disabled
_ICPRT_ON_4L EQU H'FF' ; ICPORT enabled
_XINST_OFF_4L EQU H'BF' ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
_XINST_ON_4L EQU H'FF' ; Instruction set extension and Indexed Addressing mode enabled
_DEBUG_ON_4L EQU H'7F' ; Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug
_DEBUG_OFF_4L EQU H'FF' ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
This gives a short description of the configuration fuses. For things you have not heard of before, a little research in the data sheet is recommended. See post #5 from the link Mackrackit gave you for some more details about commenting out other configs, if you chose to put the configs in your codespace. http://www.picbasic.co.uk/forum/show...=6775#post6775
Can
you please provide it or tell me what PIC programming system I need to learn and use? Maybe the
C or ASM products? Currently PicBasic PRO doesn't work for my simplest example.
I really like PBP for its ease of programming, and its capabilities. But yes, configs are a pain for the more complex chips. The same pain will be had for C, etc. No matter what language you choose, you will have to learn to set the configs and of course do some data sheet reading.
Bookmarks