PDA

View Full Version : 16f883



Meriachee
- 7th September 2009, 17:56
Hi folks,

I got a bunch of 16f883 chips last week, and am having some ah, issue, with the clock progrmamming in PBPro.
Using the string:
'INITIALIZE
@ DEVICE INTRC_OSC_NOCLKOUT, MCLR_OFF, WDT_OFF, BOD_OFF, PWRT_ON

I get an illegal operation warning when it compiles. It's complaining about the clock statement. Ok, so continuing blindly along, I set the Oscillator to either INTOSC IO or INTOSC Clockout in the Config window, and press Program, returns an error and a whole bunch of mismatch in the compare. The Config dropdown reverts to XT for the clock and all is not overly happy.
What the heck.
I've changed the INTRC to every flavour that I can find in the datasheet and it's simply does not want to go.

Anybody have any insight?

Cheers
Gary

aratti
- 7th September 2009, 18:08
Gary, I was just reading "THE FUSES SETTING SAGA" few days ago, I think you should read it to have the insight you are searching.

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

Al.

Meriachee
- 7th September 2009, 18:44
Thanks Al,

Having just read enough of that nonesense to really give me a headache, I'll just go back to using the trusty 12f675 chips. This stuff clearly does not need to be this complicated, with soooooo many niggly differences based on what Microchip was thinking on that particular day. For some of us (me particularly) I have 4 different telephony manufacturers worth of niggly data plugging my cells, and can't rmember 1/2 of that stuff I -need- every day!

Pics should be fun, not another reason to spend hours digging through freakin datasheets for that one bit of data that puts you back on track, or necessitating reams of posts to get supposedly "simple" stuff working.....

(Maybe it's time for a holiday)

Cheers
Gary

mackrackit
- 7th September 2009, 19:51
What version of PBP are you using?

Meriachee
- 8th September 2009, 00:03
Dave,

PBP 250c
Microcode Studio 3.0.0.5
MPASM/MPLAB/win 8.36
Using the MELabs U2 programmer with MEup46 Firmware.

The funnny thing is, I've never been able to get the "@ device, blah blah" stings to work, and I've been through almost all the possible iterations every time I try, even cutting and pasting directly from posts, from people who seem to know what they are talking about...... I'm sure that it's some stupid user thing, but eventually something should work.........

All I want to do is use the 16F833 with the internal oscillator. Can't be that difficult. (My code, however.. heh..heh..)

Cheers
Gary

Archangel
- 8th September 2009, 02:40
Dave,

PBP 250c
Microcode Studio 3.0.0.5
MPASM/MPLAB/win 8.36
Using the MELabs U2 programmer with MEup46 Firmware.

The funnny thing is, I've never been able to get the "@ device, blah blah" stings to work, and I've been through almost all the possible iterations every time I try, even cutting and pasting directly from posts, from people who seem to know what they are talking about...... I'm sure that it's some stupid user thing, but eventually something should work.........

All I want to do is use the 16F833 with the internal oscillator. Can't be that difficult. (My code, however.. heh..heh..)

Cheers
GaryHi Gary,
You need to open the 16F833.inc file located in the PBP Root directory and add a semicolon ahead of the default configs. Then the @ DEVICE . . . will work without the error message. There are configs for both PM and MPASM assemblers there. You will have to redo this when you "UPGRADE" PBP to a newer version as the upgrades overwrite those files. You must do this for each part number PIC you are using to use anything other than the default config, or modify the default config to your particular liking.

mackrackit
- 8th September 2009, 03:36
I set the Oscillator to either INTOSC IO or INTOSC Clockout in the Config window, and press Program
Config window???

I seem to remember others having trouble like this and I think part have the solution was to shut that "window" stuff off. I do not have the programmer you have so...

You need to (how ever you can)set things up so ALL of the code and configs are in files. Either change the *.inc when needed or comment out the appropriate lines and set the configs in code. Relying on software to set things up in my opinion is just plane stupid. What happens when you go with another programmer that does not have that option?

Meriachee
- 9th September 2009, 03:45
After inserting a ; into the inc file in front of the "offending" lines, I recompiled the code and with only the following line:
@ DEVICE INTRC_OSC_NOCLOCKOUT
As the ONLY text, I get the following:
Warning [207] c:\progrm-blah-blah 54: found label after column1. DEVICE
Error [122] c:\progrm-blah-blah 54: Illegal opcode (INTRC_OSC_NOCLOCKOUT)

It almost looks like PBPro doesn't like this oscillator. ?

The confusion continues.
Gary

hatchethand1000
- 9th September 2009, 03:57
I am using this line with the 16F883 with no other @ DEFINE lines or anything else, jus the one line.


@ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_ON & _CPD_ON

and I modified the file C:\PBP\16F883.INC


;************************************************* ***************
;* 16F883.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2009 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 07/02/09 *
;* Version : 2.60 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
include 'M16F88x.INC' ; PM header
device pic16F883, intrc_osc_noclkout, wdt_on, mclr_on, lvp_off, protect_off
XALL
NOLIST
else
LIST
LIST p = 16F883, r = dec, w = -302
INCLUDE "P16F883.INC" ; MPASM Header
; __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
NOLIST
endif
LIST

Comment out the __config line and save the file.
This works good for me.
K

mackrackit
- 9th September 2009, 03:57
After inserting a ; into the inc file in front of the "offending" lines, I recompiled the code and with only the following line:
@ DEVICE INTRC_OSC_NOCLOCKOUT
As the ONLY text, I get the following:
Warning [207] c:\progrm-blah-blah 54: found label after column1. DEVICE
Error [122] c:\progrm-blah-blah 54: Illegal opcode (INTRC_OSC_NOCLOCKOUT)

It almost looks like PBPro doesn't like this oscillator. ?

The confusion continues.
Gary
If you use the
@ DEVICE
method,then you have to compile using PM. You are using MPASM to get the error and warning you have.

Meriachee
- 9th September 2009, 04:26
Absolutely, almost fabulous.

Everything works, up to the verify stage of the programmer without so much as a burp, but then:

Code verify error at 0000
3FFF should be 2828

and on and on it goes 3FFF at 0001, 3FFF at 0002 etc etc.
Erasing the target doesn't clear it.

hatchethand1000
- 9th September 2009, 04:36
Absolutely, almost fabulous.

Everything works, up to the verify stage of the programmer without so much as a burp, but then:

Code verify error at 0000
3FFF should be 2828

and on and on it goes 3FFF at 0001, 3FFF at 0002 etc etc.
Erasing the target doesn't clear it.

I have had the same type of problems with the MElabs U2 programmer. The only way I could fix it was to reload the defaults to the programmer.

meProg - Options - More Options - Set Options to Default

I have not had this problem with other chips but the 16F883 seems to do it late and night or early in the morning. I went so far as to think my programmer was either out of date or broken. I purchased a new one with updated code and it did the same thing. Restoring defaults does seem to fix the strange errors with the U2.

K

Meriachee
- 9th September 2009, 16:04
Reset it a couple of times, and same issue. I am going to contact MeLabs over this one....

Meriachee
- 10th September 2009, 00:45
Once again Charles comes through. It was the U2 programmer, indirectly. MeLabs updated the programmer code after the 883 chip was released. When the programmer was up-issued to 4.31 from 4.20 it worked exactly as it should. The firmware is current at #56.

Thanks all for the help!

Gary