PDA

View Full Version : Config Bits



mityeltu
- 7th May 2014, 02:17
I know this has been discussed and rediscussed, but I find none of the posts here useful. Presumably I'm just an amateur idiot in the making. Anyway. I have used a number of different compiler/ide combos and find PBP to be just about the most cumbersome of them all when it comes to configuring trying to get the config bits set.

Is there not a way to do this from within the program? Do I have to modify the include file? Which I did, by the way, and received a large number of errors for my efforts.

how in the world do I get these things set? The include file only has 4 of the 11 config bytes that need to be set (18F4520.inc). What gives? Why does this not put the config bits into the hex file? When I try to load it using pickit2 it has the wrong config bits set.

This is really confusing and tedious. I've about decided to give up and go with arduino.

Any help you guys can give will be greatly appreciated.

Demon
- 7th May 2014, 03:52
Best help I can offer:

http://www.picbasic.co.uk/forum/showthread.php?t=543

http://www.picbasic.co.uk/forum/content.php?r=467-PICs-CONFIGS-and-Oscillator-Settings-for-Beginners

Robert

AvionicsMaster1
- 7th May 2014, 04:49
You oughta try an easier chip first. Those bazillion pin behemoths are pesky to say the least. Spend the 39 cents American and buy a 12F683. Simple and you can make sure your hardware and software work before you graduate to the big boys.

HenrikOlsson
- 7th May 2014, 07:22
Hi,
Since you're a new user to PBP I'm going to guess you've got PBP3. IF that's the case then neither of the posts Robert linked is valid and will only cause further confusion and problems. With PBP3 you should never need to edit the include files, it'll only cause you trouble. Instead you need to look up the #CONFIG / #ENDCONFIG directives in the manual. However, if you ARE on a version prior to PBP3 then obviously the threads referenced earlier are indeed valid.

Either way, provided you do it correctly, the CONFIG bits will be included in the compiled/assembled hex file but depending on the device programmer they may or may not be programmed in (setting in the device programmers software).

You may also be interested in the meCONFIG utillity (http://support.melabs.com/content/563-meCONFIG).

If you need further help please clarify which version of PBP you're using.

/Henrik.

mityeltu
- 7th May 2014, 23:12
OK. I have tried the various solutions presented. I have PBP2.60C. I have had it for a number of years and used it very little because of similar issues to the one I am having now. However, since I BOUGHT the thing, and since mplab really sucks, and because my sourceboost runs unimaginably slow on this laptop (no good reason for that and it really ticks me off), I decided to try this again. Mistake number 4 or five... I lost count.

Anyway. I have tried the various solutions. The config bits are still left unset. I typically get the following an error saying that it is overwriting the previous address contents. My assumption (incorrect as it is) was that the program was actually changing the bits. pickit2 disagrees.

Any other ideas?

Does anyone have an actual program using the config bits that actually compiles and runs that they would be willing to post so that morons like me can actually SEE what REALLY works?

just so you can see this ridiculous program I'm using it is below: BTW, just so you know, I used the meConfig to set the bits in the program as outlines. I made sure to uncheck the PBP3 checkbox as I am NOT using that.
'************************************************* ***************
'* Name : sound_test.BAS *
'* Author : MityEltu *
'* Notice : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 5/6/2014 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************

ASM
__config _CONFIG1H, _OSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__config _CONFIG2L, _PWRT_OFF_2L & _BOREN_SBORDIS_2L & _BORV_3_2L
__config _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
__config _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
__config _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
__config _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
__config _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
__config _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
__config _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
__config _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
__config _CONFIG7H, _EBTRB_OFF_7H
ENDASM


gosub setup
main:
goto main
end


setup:
intcon = $00
intcon2 = $80
intcon3 = $00
pie1 = $00
pie2 = $00

ccp1con = $00
ccp2con = $00

adcon0 = $00
adcon1 = $0f

cmcon = $03
cvrcon = $00
hlvdcon = $00

trisa = $00
porta = $00
trisb = $ff
trisc = $00
portc = $00
trisd = $ff
trise = $00
porte = $00
return

Darrel Taylor
- 8th May 2014, 05:17
OK. I have tried the various solutions presented. I have PBP2.60C. ...
I typically get the following an error saying that it is overwriting the previous address contents. ...

Go back to demon's post #2, and revisit the 543 thread.
In particular, go to post #5 from mister_e ... and like magic from 9 years ago ... your problem will be solved.

Well except for the fact that you've set the HS oscillator mode and don't have a DEFINE OSC xx statement.

And you should just delete that whole setup subroutine.
Maybe keep the ADCON1 and CMCON values, but unless you are planning on using the comparators ... you'll probably want CMCON = 7.

Then just do a ...


LED PORTB.0

Main:
HIGH LED
PAUSE 500
LOW LED
PAUSE 500
GOTO Main

mityeltu
- 10th May 2014, 08:52
You have fixed my problem. I sincerely appreciate your patience and gentleness when faced with my abruptness and rudeness. I apologize for my haste and arrogance and ask for your forgiveness. Thank you again.