PDA

View Full Version : PIC16LF1939 Configuration Errors



rsocor01
- 1st July 2012, 07:36
Hi,

I've been using this 16LF1939 chip for a while. I always configure it with the Melabs U2 programmer software, which is the easy way to do it :o. Now, I'm trying to set the fuses in the program like this


@ DEVICE PIC16LF1939
@ __CONFIG _CONFIG2, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_ON & _CPD_ON & _BOREN_OFF & _CLKOUTEN_OFF
@ __CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF & _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_25 & _LVP_OFF

And, I'm getting some errors. I'm using PBP2.60c and MPASM. Any ideas of what I'm doing wrong? I suspect the first line is part of the problem.

P.S. There are two *.inc files for this chip. One in the PBP2-60 directory and another one in the MPASM SUITE directory. Do I need to make any changes to these files?

Ioannis
- 1st July 2012, 11:39
1. Drop the DEVICE line and select the device from the IDE (say MicroCode or FineLine).
2. Comment out the config lines in the *.inc file of the PBP folder.

HTH,
Ioannis

rsocor01
- 2nd July 2012, 03:29
Thanks, I'll try that. But, does it work by selecting the device from the IDE only? I need to get the HEX file with the full configuration of the chip and the type of chip. I have seen this "@ DEVICE PIC16LF1939" line been used before by people here in the forum, so I don't know why it doesn't work in my case.

mackrackit
- 2nd July 2012, 06:58
Because you are using MPASM and
"@ DEVICE PIC16LF1939"
is for PM.

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

Ioannis
- 2nd July 2012, 06:59
Yes it works OK. Don't worry about that.

It makes sense if your IDE does not support it. For example compiling from Command Line.

Ioannis

rsocor01
- 3rd July 2012, 07:36
Thank you guys. Now, it works fine. There is a "condensed" version of the thread that Dave mentioned that was really helpful.

http://www.picbasic.co.uk/forum/content.php?r=157-Presetting-Configuration-Fuses-%28PIC-Defines%29-into-your-Program

The tricky part (at least for me) to make it work was figuring out that I needed two CONFIG statement lines. One for CONFIG1 and another one for CONFIG2.


@ __CONFIG _CONFIG1, .......
@ __CONFIG _CONFIG2, .......