loading

Pic Problems, need Pic Pros!

I recently got a pic prgrammer (the really cheap one off of sparkfun, the PIC_PG2) and I have a problem: Background info: I'm trying to program a 12f675 I'm using IC-Prog when I program the programming led turns on and flickers a bit now and then. A pop-up screen comes up, "No Oscillator Callibration Value found. Do you want to use value from file (3fffh) instead? " I can now hit yes, no, or cancel. If I hit no it goes on, if i hit yes it goes on. after a couple more status bars, like reading, prgramming, little blue bars... then "verify failed at adress 0000h!" I need to fix this.

sort by: active | newest | oldest
1-10 of 25Next »
telluride039 years ago
Sorry meant to say same problem as guyfrom7up. Thanks
telluride039 years ago
Hello all, I'm having pretty much all the same problems as 'chooseausername' except I'm trying to program a 12f629. I have come to the determination from this thread that it's a conflict with my computer. My question is I am buying a serial to usb converter cable for my jdm programmer, do you guys think this will solve my problem and if so what program would work with it if not ic-prog or should I just get a usb programmer? Thanks
No Oscillator Callibration Value found. Do you want to use value from file (3fffh) instead?

Did you write on a paper the oscillator calibration value that was written into the last location of the memory of your PIC before programming it the first time ?

If not, maybe this value got overwritten with 0s or something.

Maybe you know that already, but before programming a Pic, we must write somewhere this value. It's different for each Pic. And if it's not automatically protected by the programmer, we must include it into the program.

I'll tell you more if you need.
guyfrom7up (author)  chooseausername9 years ago
I need more help Don't be afraid of saying really basic stuff related to pic, I'm a programming and PIC noob. can you give me some step by step directions of all of that stuff? thanks in advance!
I'm not a PIC specialist yet. I'm kind of a noob too. A slightly more experienced n00b.

So, here is what I know about PICs :

- they do have an Oscillator Callibration Value stored in the last word of their program memory. On the 12F675 it's at the address 3FFh.
- this OCV (let's call it like that) is required to calibrate the internal 4MHz clock.
- the value is set in the factory.
- as it is stored in the program memory (that is a Flash memory), it is erasable. That's why you should write it somewhere before programming your PIC for the first time.
- if you lost it, and if you need a calibrated internal 4MHz clock, you'll have to find the value by yourself with an oscilloscope and various calculus ... It's not that easy ...

This OCV is only required if you want a perfect 4MHz internal clock. If you don't care, it's not really a problem if you lost it, and you are free to replace it with the value your programmer propose : 3FFFh

Each PIC has a different OCV.
For instance, I got three 12F675, and they all have different OCV.

Some programming software automatically protect this value. Some other don't. And sometimes the last word is filled with 0s or a wrong OCV.

So, it's why you should add this value into your source code.
At the beginning of your source code, you could write :
ORG 3FFh ; you say to the compiler where you want to compile what's following
DATA 0x345C ; and you write your OCV

(then, don't forget to change the ORG to the address where your program must be compiled)

So, as I said, the OCV is stored at the last address of the program memory (3FFh for 12F675 and brothers)
It's a word like : 345C.

This word is not the raw OCV.
Actually, it's a RETLW instruction (returns from a call, and stores a literal value into W) that returns the OCV into W.

This means you can call this instruction : CALL 3FFh
... and W will contains the OCV.
Then, you must put this OCV into the OSCCAL register : MOVWF OSCCAL

Here is an example of how is structured my code :


include "p12f675.inc"__CONFIG    _INTRC_OSC_NOCLKOUT & _WDT_OFF & _BODEN_OFF & _MCLRE_OFF & _PWRTE_OFF; restore the OCV value in the program memory    ORG     0x3FF    DATA    0x345C; reset entry point    ORG     0x000    GOTO    init_code ; we jump to the init code; interruption entry point    ORG     0x004         ; When interruptions are enabled        ; and when an interruption occurs        ; that's where the program will jumps.        ; Once we handled our interruption        ; we return where the main program got interrupted :    RETFIEinit_code      ; our initialization routine    ; --- you init GPIO and stuff here ...    ...    ; --- internal 4MHz clock calibration ---    CALL     3FFh        ; Get the calibration value    MOVWF    OSCCAL      ; Calibrate the internal oscillator    ...        ; once initialized, you can jump to the main loop of your program    GOTO main_loop...main_loop    ... your main code goes here ...    GOTO main_loop   

Hope this help you.
If you need more help, just ask.
Oh ! I forgot to say : About the Watch-Dog timer. If you don't disable it, or if you don't add some CLRWDT instruction all along your code (and at least one in the main loop), your PIC will reset itself "now and then". This could also be a reason why your Led "flickers now and then". the _WDT_OFF flag into the __CONFIG line at the beginning of your source code disables the WatchDog. If you want more info about the WatchDog, just ask.
guyfrom7up (author)  chooseausername9 years ago
thanks for the advice! (you should write an instructable about it! ;) what do you use as a compiler? All I have is IC-prog. The last line on my IC is 03F8 not 33Fh, and all of the empty spaces are 3FFF. And at the end of each line is yyyyyyyy (except eachone has an oomlow, can't spell that, you know, the 2 dots.). So calbration time is special to each ic. They are all around the same area, so you could replace it (if lost) with one that's around that area, it won't be exact, but it'll kinda work, just not that great... Right? so what do you think I should do about the 0000h error?
what do you use as a compiler? All I have is IC-prog.

As IDE, I use a great Linux program : PiKdev
PiKdev uses GPASM (from GPUTILS) as compiler.

As hardware programmer, I use one I made on a breadboard. It's a twist of two schematics I found on http://www.ic-prog.com. It does use the parallel port.

The last line on my IC is 03F8 not 33Fh, and all of the empty spaces are 3FFF. And at the end of each line is yyyyyyyy (except eachone has an oomlow, can't spell that, you know, the 2 dots.).

Here is screen capture from IcProg : http://www.ic-prog.com/Image4.gif

The blue column contains the address of the first word of each lines.
This means that the address of the first 3FFF word is 0000. The second 3FFF word is 0001 and so on till the end of the line.
The address of the first word of the second line is 0008. The next word is 0009 etc etc ...

The yyyyyyyy with double-dot accent, is an ASCII (text) conversion of the words ... It does not really matter, you are free to ignore them.
They are there, because IcProg uses the traditional interface of most Hexadecimal editors and debuggers.

The address of the first word of the last line is 03F8. This means that the address of the last word of the last line is 03FF. (Can you count in hexadecimal ? If, not, just ask and I'll tell you more.)

That's this last word that is supposed to contains the OCV value.

Before programming your PIC for the first time, you click the Read button to read the content of the PIC, and the last word of the program memory will display the OCV that you must write somewhere and keep safely.

So calbration time is special to each ic. They are all around the same area, so you could replace it (if lost) with one that's around that area, it won't be exact, but it'll kinda work, just not that great... Right?

You're correct.
Here are the values of two of mines : 345C and 3450

Actually, it matters only if you want to proceed like in my example code :
    ; --- internal 4MHz clock calibration ---    CALL     0x3FF        ; Get the calibration value    MOVWF    OSCCAL      ; Calibrate the internal oscillator

If you don't care about calibration, you could skip these two lines.
The compiler will still complains about No Oscillator Callibration Value found. Do you want to use value from file (3fffh) instead?, but it will not matter, because you'll not CALL 0x3FF.

so what do you think I should do about the 0000h error?

Oh ! I forgot about this one !
This could comes from various things.
- the serial port is being locked or used by system programs (windows XP)
- the protection bit of your PIC is set (reading disabled)
- the hardware programmer does not works like expected (your PIC PG2 is based on the cheap JDM schematics. This kind of cheap serial programmers use some tricks to try to generated the required 13V directly out of the RS232 serial ports, without using an external power supply. Some computers (portable most of the time), are not compatible with these tricks. It's, thus, impossible to program a PIC ... and you generally get an error message like that.)
I forgot to ask : what does it says when you try to read your PIC ?
guyfrom7up (author)  chooseausername9 years ago
whenever I try and read my pic it reads it, but it's all blank. I think the programmer works cause the led goes on when I click something like read. Some brand new pics should be coming in soon, so I can use your advice on those. IT could be that I'm not uploading a good code. I was only trying the blinker from sparkfun (I downloaded the hex file)
1-10 of 25Next »