PDA

View Full Version : File won't compile in PBP 2.6



mikejp56
- 30th May 2016, 04:45
Hi All,
I am very new to PIC programming. I started out with the 12F683 and played with it for a while until I was comfortable with it. I then bought several types to experiment with. I decided to make a template file for each type of PIC that I have. The template file would be a "skeleton" PBP file with all of the configuration settings listed. All but one would be commented out so I could see what config options are available.
After listing all of the settings and options, I would save and compile this file. If it compiled then I know that my spelling and syntax are correct. If not, then I corrected spelling and syntax, and then recompiled.
This worked great for 12F683 and various 16F PICs (887,88, 688.628A) However when compiling for the 16F1827 I get the following error messages (see attached).
Syntax appears to be good; the values are from meConfig. I am using PBP 2.6. I am completely stumped as to why this file will not compile.
Any help would be greatly appreciated.
Regards,
mikejp56

HenrikOlsson
- 30th May 2016, 06:12
On the 16F1827 there is no PortC and therefor no TrisC either which would explain the first two errors. The others seems to indicate that the program is too big, which I doubt if it's what you say it is so it might just be a problem due to the first error. If they don't go away you're going to have to post the code so we can see it.

EDIT: Hmm, it says Program word too large.... So it's probably NOT the "length" of the program it's complaining about after all. But again, if it doesn't go away we (or I at least) need to see the code.

/Henrik.

Scampy
- 30th May 2016, 09:39
Without showing the code you are trying to compile it's going to be difficult for people to try and diagnose what the cause may be. Paste up the full code you are trying to compile and I'm sure you will get a more definitive answer

mikejp56
- 30th May 2016, 14:19
Sorry guys,
It was almost midnight last night when I posted this.
Here is the code:
'************************************************* ***************
'* Name : 16F1827 Template.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 5/29/2016 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
;----[16F1827 Hardware Configuration]-------------------------------------------
ASM
cfg1 = _FOSC_ECH ; ECH, External Clock, High Power Mode (4-32 MHz): device clock supplied to CLKIN pin
;cfg1 = _FOSC_ECM ; ECM, External Clock, Medium Power Mode (0.5-4 MHz): device clock supplied to CLKIN pin
;cfg1 = _FOSC_ECL ; ECL, External Clock, Low Power Mode (0-0.5 MHz): device clock supplied to CLKIN pin
;cfg1 = _FOSC_INTOSC ; INTOSC oscillator: I/O function on CLKIN pin
;cfg1 = _FOSC_EXTRC ; EXTRC oscillator: External RC circuit connected to CLKIN pin
;cfg1 = _FOSC_HS ; HS Oscillator, High-speed crystal/resonator connected between OSC1 and OSC2 pins
;cfg1 = _FOSC_XT ; XT Oscillator, Crystal/resonator connected between OSC1 and OSC2 pins
;cfg1 = _FOSC_LP ; LP Oscillator, Low-power crystal connected between OSC1 and OSC2 pins
;------------------------------
cfg1&= _WDTE_ON ; WDT enabled
;cfg1&= _WDTE_NSLEEP ; WDT enabled while running and disabled in Sleep
;cfg1&= _WDTE_SWDTEN ; WDT controlled by the SWDTEN bit in the WDTCON register
;cfg1&= _WDTE_OFF ; WDT disabled
;------------------------------
cfg1&= _PWRTE_ON ; PWRT enabled
;cfg1&= _PWRTE_OFF ; PWRT disabled
;------------------------------
cfg1&= _MCLRE_ON ; MCLR/VPP pin function is MCLR
;cfg1&= _MCLRE_OFF ; MCLR/VPP pin function is digital input
;------------------------------
cfg1&= _CP_ON ; Program memory code protection is enabled
;cfg1&= _CP_OFF ; Program memory code protection is disabled
;------------------------------
cfg1&= _CPD_ON ; Data memory code protection is enabled
;cfg1&= _CPD_OFF ; Data memory code protection is disabled
;------------------------------
cfg1&= _BOREN_ON ; Brown-out Reset enabled
;cfg1&= _BOREN_NSLEEP ; Brown-out Reset enabled while running and disabled in Sleep
;cfg1&= _BOREN_SBODEN ; Brown-out Reset controlled by the SBOREN bit in the BORCON register
;cfg1&= _BOREN_OFF ; Brown-out Reset disabled
;------------------------------
cfg1&= _CLKOUTEN_ON ; CLKOUT function is enabled on the CLKOUT pin
;cfg1&= _CLKOUTEN_OFF ; CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
;------------------------------
cfg1&= _IESO_ON ; Internal/External Switchover mode is enabled
;cfg1&= _IESO_OFF ; Internal/External Switchover mode is disabled
;------------------------------
cfg1&= _FCMEN_ON ; Fail-Safe Clock Monitor is enabled
;cfg1&= _FCMEN_OFF ; Fail-Safe Clock Monitor is disabled
;------------------------------
__CONFIG _CONFIG1, cfg1

cfg2 = _WRT_OFF ; Write protection off
;cfg2 = _WRT_BOOT ; 000h to 1FFh write protected, 200h to FFFh may be modified by EECON control
;cfg2 = _WRT_HALF ; 000h to 7FFh write protected, 800h to FFFh may be modified by EECON control
;cfg2 = _WRT_ALL ; 000h to FFFh write protected, no addresses may be modified by EECON control
;------------------------------
cfg2&= _PLLEN_ON ; 4x PLL enabled
;cfg2&= _PLLEN_OFF ; 4x PLL disabled
;------------------------------
cfg2&= _STVREN_ON ; Stack Overflow or Underflow will cause a Reset
;cfg2&= _STVREN_OFF ; Stack Overflow or Underflow will not cause a Reset
;------------------------------
cfg2&= _BORV_19 ; Brown-out Reset Voltage (Vbor), low trip point selected
;cfg2&= _BORV_HI ; Brown-out Reset Voltage (Vbor), high trip point selected
;------------------------------
cfg2&= _LVP_OFF ; High-voltage on MCLR/VPP must be used for programming
;cfg2&= _LVP_ON ; Low-voltage programming enabled
__CONFIG _CONFIG2, cfg2

ENDASM
;----------Main Program---------------------------------------------------------

There are no references to any ports or tris registers, just config words.
And like I said, this is all from meConfig and done in Micro Code Studio.
Thanks for your help.
Regards,
mikejp56

Dave
- 30th May 2016, 14:39
What did you expect? Meconfig is only to help produce the configuration register settings. After it is done, you are to copy them into your oun program.

flotulopex
- 30th May 2016, 14:47
If you use Microchip's (MPASM) Assembler, config fuses must be set like:


@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _LVP_OFF & _CP_ALL & _DATA_CP_ON

mikejp56
- 30th May 2016, 15:26
Hi Dave,
That's the point. I have done these templates for about 6 or so PICs without any problems. They are only to set the config bits. Yet for the '1827 they think that I am referring to ports and tris registers. All I'm referring to are config bits.

Hi flotulopex,
I might try that next.

HenrikOlsson
- 30th May 2016, 18:08
It could be a problem with the device specific PBP include file for that device. It might have a PortC and TrisC in it (in error).

What if you try to compile, without all the CONFIG stuff, something stupid like

Main:
Pause 100
Goto Main


Does it compile then?

I don't have 2.6 installed any more so I can't actually test here.

/Henrik.

mikejp56
- 30th May 2016, 18:36
Hi Henrik,
I tried your code and it does not compile.
The .INC file supplied by meL is listed below:
;************************************************* ***************
;* 16F1827.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2009 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 06/23/09 *
;* Version : 2.60 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 16F1827, r = dec, w = -302
INCLUDE "P16F1827.INC" ; MPASM Header
;__config _CONFIG1, _FOSC_HS
;__config _CONFIG2, _PLLEN_OFF & _LVP_OFF
NOLIST
endif
LIST
BLOCK_SIZE EQU 8

Note that I commented out the 2 __config lines.
So is this file faulty? If so, any ideas on how to repair or replace it?
Regards,
mikejp56

mikejp56
- 30th May 2016, 18:47
Hi Henrik,
I tried to compile the following code using the original, uncommented .inc file:
'************************************************* ***************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 5/30/2016 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
It resulted in the error message that is attached. 8248
Again, any help or ideas are welcome!
regards,
mikejp56

HenrikOlsson
- 30th May 2016, 19:44
Needless to say it compiles just fine here but I'm on 3.0.8.4 so it doesn't say much.

The version history (http://melabs.com/support/patches.htm) for 2.6A says (among other things)

Fixes assembly errors for 16F1826/16F1827
If you haven't applied that patch I'd certainly try that, in fact I'd apply 2.6C (http://melabs.com/downloads/Patch_PBP260C.exe) which is the last version in the 2.x release. When you do it may overwrite the .inc file where you've commented out the CONFIG so be prepared to do that again.

/Henrik.

mikejp56
- 30th May 2016, 20:29
Hi Henrik,
Applying the patch works.
Thank you so much!
Regards,
mikejp56