DIY Electronics Message Board
Sign up  |   |   |  Latest Topics
 
 
 


Reply
  Author   Comment  
agdyer

Registered:
Posts: 4
Reply with quote  #1 
I am having a problem setting the OSCCAL value when I am trying to program an erasable chip. I have successfully programmed several OTP chips.

Programmer: K150V2
Software: diypack22.zip
Help, About shows: DIY K150 PICmicro Programmer
v160704
Protocol: P016
Help, Protocol shows:
MicroPro: P016  Firmware: P016
System is matched

Target chip: PIC12C509/JW

Before programming the chip the first time, I read it: all memory locations
were zero, including the last one. Clicking CALIB, Read showed:
OSCAL Value: 0C [00]

Then, I UV erased the chip. All locations showed FFF.

I loaded my hex file, used CALIB to set the OSCAL value: 0C[00] and programmed the chip. It said program OK, but on examination, the loaded file had changed: the last location was now CFF. Reading the chip confirms that, and OSCAL is shown as 0C[FF].

I re-erased the chip, and tried again (in case I had made a mistake) with the same result.

I tried programming the chip with all zeroes, still the last location remained
as CFF.

How do I correctly program the OSCCAL value?

Is this a 'feature' to prevent accidental changes to the OSCCAL value on OTP chips? If so, it is not appropriate when programming the UV erasable chips.

Thanks
Allan Dyer


KitsRUsBob

Registered:
Posts: 419
Reply with quote  #2 
There is no automatic way to save it.

What people do is to read in the value with MicroPro, and make note of it. Then when they get ready to reprogram it, they manually install the value, or include it in their code.

--Bob

agdyer

Registered:
Posts: 4
Reply with quote  #3 
Sorry, I think you misunderstood. I read the value on the new chip (0C[00]), erased the chip. Then I loaded my program, set the OSCCAL value using the CALIB button and programmed the chip. After programming the value is 0C[FF] instead of the 0C[00] I set.

What is going wrong, or what am I doing wrong?

Thanks
Allan Dyer

KitsRUsBob

Registered:
Posts: 419
Reply with quote  #4 
I haven't programmed the PIC12C509 in a while.

Ideas, anyone? It always seemed to work OK to me....

--Bob

rahulb

Registered:
Posts: 3
Reply with quote  #5 
Hi, this sounds like the same problem I'm having with my 676.
  1. I read in a factory fresh blank 676, and when I hit calib I see a calib of 34[01].
  2. I pop in another 676 and try to program it (with the clean hex I just read) and click program.  It programs fine, but when I look at the the calib again for the hex file, and it is suddenly 30[00].  Something changed it.
  3. I read the second chip (the one I just programmed) to make sure and the calib is still the same (incorrect value).
I'm not quite sure why this is happening.

KitsRUsBob

Registered:
Posts: 419
Reply with quote  #6 
sounds like an error with the programming algorithm.

Anybody else have PIC16F676 problems?

--Bob

KitsRUsBob

Registered:
Posts: 419
Reply with quote  #7 
Quote:
Originally Posted by agdyer
I am having a problem setting the OSCCAL value when I am trying to program an erasable chip. I have successfully programmed several OTP chips.

Programmer: K150V2
Software: diypack22.zip
Help, About shows: DIY K150 PICmicro Programmer
v160704
Protocol: P016
Help, Protocol shows:
MicroPro: P016  Firmware: P016
System is matched

Target chip: PIC12C509/JW

Before programming the chip the first time, I read it: all memory locations
were zero, including the last one. Clicking CALIB, Read showed:
OSCAL Value: 0C [00]

Then, I UV erased the chip. All locations showed FFF.

<respectful snip>



The JW devices are really special chips, with a quartz window and a ceramic seal.
The correct way to handle windowed parts with OSCCAL values is to carefully making note of its value BEFORE you erase it the first time (by reading in the chip;
it will be found shipped from the factory with '0C??' installed at location 0x3ff. warning: some devices have OSCCAL located in two places.

In your assembly program, simply assign an " ORG h'3ff'  " then install a MOVLW (OSCCAL VALUE), whatever it is. Of course that only works for that particular chip.

MicroPro "helps" you by noting that 0x3FF  does NOT have a  movlw instruction, and suggests that it be converted to  MOVLW-, but it does not allow you to install the value.

HINT: You will find that MOST 12C509s and 508s will work very close to nominal with a median value ( a '1' in the highest order bit of the OSCCAL, all other bits = 0).

--Bob
agdyer

Registered:
Posts: 4
Reply with quote  #8 
Bob wrote:
> The JW devices are really special chips, with a quartz window and a ceramic seal.
Yes, that's the beast.

> In your assembly program, simply assign an " ORG h'3ff'  " then install a MOVLW (OSCCAL VALUE), whatever it is. Of course that only works for that particular chip.

Yes, I had that. OK, I tried a test: changing the penultimate location too. My .lst file shows:

               01448         ;; Can I change the next-to last location?
03FE           01449         org     0x3fe
03FE 0CCC      01450         movlw   0xCC
               01451
               01452         ;; calibration for 12C509-JW part
               01453         ifdef   __12c509
               01454         ifdef   jw
03FF           01455         org     0x3ff
03FF 0C80      01456         movlw   0x80                    ; 12c509 # Try a different value

When I load the .hex file, I can see the expected values in the hex listing window:

03F8: FFF FFF FFF FFF FFF FFF CCC C80

I program the chip and read back the contents. MicroPro shows this in the hex listing window:

03F8: FFF FFF FFF FFF FFF FFF CCC CFF

So, the next-to-last location was programmed as I expected, but the last location was not.

I can think of two possibilities: my chip has a fault at this location (unlucky!), or MicroPro is not programming this value.

Regards
Allan

KitsRUsBob

Registered:
Posts: 419
Reply with quote  #9 
Funny, I just got through programming a tube (25) OTP PIC12C509A's, and there wasn't the slightest problem.  I verifed 0x3FF and the value was 0x0CA0 for most of them, a tiny variation for the rest (as expected).

See, what is happening with the JW component is that the UV eraser erases everything, INCLUDING  the  OSCCAL value at 0x3FF. So you must install something there, because if no MOVLW instruction is there, the PIC won't run.at all. MicroPro warns you that no MOVLW is there and will install it, if allowed to.

--Bob
KitsRUsBob

Registered:
Posts: 419
Reply with quote  #10 
Quote:
Originally Posted by agdyer
Bob wrote:

03F8: FFF FFF FFF FFF FFF FFF CCC CFF

So, the next-to-last location was programmed as I expected, but the last location was not.

I can think of two possibilities: my chip has a fault at this location (unlucky!), or MicroPro is not programming this value.



Oops. Oh, I see now. I could have sworn that this would work.

OK, I suggest that while using the JW component to write the following as the
FIRST LINES OF CODE:

movlw  b'00100000'           ;I think 6 bits are correct, right?
movwf  OSCCAL              ;I think that is the name, right?
.
.
etc

This will put the JW into the approximate correct OSC range.
This is what I always did.

--Bob
agdyer

Registered:
Posts: 4
Reply with quote  #11 
Bob said:
> movlw  b'00100000'           ;I think 6 bits are correct, right?

The 509A has 6 bits, the 509 has 4, the topmost bits in each case, so I used:
movlw  b'10000000'

> movwf  OSCCAL              ;I think that is the name, right?
Yes.

I tried - it worked. By that I mean, the timing was close enough for what I'm doing (serial output at 2400 baud was recognised correctly).

Thanks for the workaround. It doesn't explain or fix the problem - why can't I program location 3ff, have I really got a fault at that location?

Regards
Allan
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Thank you for visiting.