K8048 No config word warning!

Hi,
I just bought a K8048 PIC programmer to start experimenting with PICS.
I have studied PICs but only done one basic program at college!

My Problem - I assembled all the demo programs and wrote them to the supplied PIC (16F627) then decided to buy a 16F84A that I have in mind for a project. Again I assembled the demo files and wrote them to this chip with no probs. I then copied a program from a book (traffic light sequence) and it assembled ok but as soon as I open the file with progpic2 a warning is displayed saying “No config word in file or file does not match to the controller type” If I ok the message and proceed to write the status field steps through the write and gives an ok. However the program I am expecting does not run.

I’ve tried: Bulk erasing before writing, I’ve compared my .asm to one of demos and they look different, my .asm file I’ve copied does have a config section (assembler) and I’ve tried using the updated software download from your site!

I guess the answer is fundamental to the style of program I’m trying to write - can you explain! I’d be greatful if you could supply a template for the .asm and supply a list of your programming commands - thankyou!

Your program file should contain something like…

LIST p=16F84A ;tell assembler what chip we are using
include “P16F84A.inc” ;include the defaults for the chip
ERRORLEVEL 0,-302 ;suppress bank selection messages
__config 0x3F18 ;sets the configuration settings (oscillator type etc.)

Look at the datasheet for the PIC you are using, to find the correct config settings.

Thanks for the advice!

First thing I did after reading your reply was to look for the commands you mentioned in one of the demo files that comes with the kit. None of the commands appear in the demo file I looked at!

My program does have a configuration section and does list the PIC type in another section!

The other commands (include, error level and _config) don’t seem to be listed in the instruction set summary!

I think the problem is to do with the commands I’m using and your reply backs this up! The commands that velleman use in their demo.asm and the ones you mention don’t appear in the PIC datasheet or the program I am trying to run - I need to understand why, can you help?

The Velleman demo .asm files use a different way of configuring the PIC’s to that which is listed in the above message.

Velleman’s usage is as below (For the 16F627A):

[color=green][code]_BODEN_ON EQU H’3FFF’
_BODEN_OFF EQU H’3FBF’
_CP_ALL EQU H’03FF’
_CP_75 EQU H’17FF’
_CP_50 EQU H’2BFF’
_CP_OFF EQU H’3FFF’
_DATA_CP_ON EQU H’3EFF’
_DATA_CP_OFF EQU H’3FFF’
_PWRTE_OFF EQU H’3FFF’
_PWRTE_ON EQU H’3FF7’
_WDT_ON EQU H’3FFF’
_WDT_OFF EQU H’3FFB’
_LVP_ON EQU H’3FFF’
_LVP_OFF EQU H’3F7F’
_MCLRE_ON EQU H’3FFF’
_MCLRE_OFF EQU H’3FDF’
_ER_OSC_CLKOUT EQU H’3FFF’
_ER_OSC_NOCLKOUT EQU H’3FFE’
_INTRC_OSC_CLKOUT EQU H’3FFD’
_INTRC_OSC_NOCLKOUT EQU H’3FFC’
_EXTCLK_OSC EQU H’3FEF’
_LP_OSC EQU H’3FEC’
_XT_OSC EQU H’3FED’
_HS_OSC EQU H’3FEE’

__CONFIG        _BODEN_ON & _CP_OFF & _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_ON & _XT_OSC[/code][/color]

If you look at the datasheet for the 16F84A ( ww1.microchip.com/downloads/en/D … 35007b.pdf ), page 21 onwards, paying particular attention to the Configuration Word part, you will see that there are 14 bits that comprise the Config Word…it may look daunting at first but PIC Programmer can help you out with them.

Within PIC Programmer, at the right of the screen, there is a View/Set button that takes you to a selection of boxes you can tick/clear, to give you the correct HEX value for the Config Word. Once you know which parameters you need to have set, you can either use the PIC Programmer option, or list the parameters as in the code above, such as _CONFIG _BODEN_ON & _CP_OFF & …

Without knowing what you are trying to achieve, this is about as much as I can help, but you do need to be aware that different PIC’s sometimes use different instructions - one that springs to mind is the usage of BODEN & BOREN between differing families:
Brown
Out
Detection
ENable

Vs.

Brown
Out
Reset
ENable

If porting code to a PIC different from that which it was written for, you may (read: will most-likely) have to consult the specific datasheets and change certain parameters to suit the new PIC.

Good luck.

Here is a snip from an .asm listing specifically written for the 16F84A PIC:

[color=green]8: list p=pic16f84a 9: include p16f84a.inc 10: __config _hs_osc & _wdt_off & _pwrte_on & _cp_off [/color]

HTH.

Another way of writing the Config Word for:

10: __config _hs_osc & _wdt_off & _pwrte_on & _cp_off

would be “__config 0x3FF2” but without the quotes.

Fire up PIC Programmer and click View/Set. Open the Datasheet for 16F84A and look at Page 21. Look at the selections for _hs_osc, _wdt_off, _pwrte_on and _cp_off. You will see that the appropriate bits need to be set/cleared to produce the HEX value 3FF2.

HTH

Hi Mickster,
Thanks for your help! Got my code to run after setting 3FF2 in the config word. The sequence of lights switching on and off are too fast though. I guess the oscillator option that the code was written for is different to that you suggested as the HS setting in the config word. As a matter of interest is the oscillator fitted to the K8048 a HS type.

Once again thanks for your help!!!
Stevo

The Crystal Oscillator mounted on the K8048 board is 4MHz, so it falls into both the XT and HS types using the same value caps (15 - 33 pF) when you look at the datasheet.

I haven’t got into this yet myself, but I think you may need to either use [color=blue]pre-scaling[/color] (Look here - mikroe.com/en/books/picbook/2_08chapter.htm ) to slow down the program execution speed, or use the PIC in another board (breadboard or a DIY PCB) with a different value crystal.

HTH.