Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

????

Status
Not open for further replies.
You should be able to ignore the OSCCAL code for EEPROM and FLASH chips, any decent programmer software will do it automatically, read the chip, store the OSCCAL value, then write it back when you write the chip.

For a 12C508JW you need to manually save and restore the value, as it's erased by the UV eraser - 12C508's aren't a problem, because they are OTP, so the OSCCAL value doesn't get erased.
 
Nigel Goodwin said:
You should be able to ignore the OSCCAL code for EEPROM and FLASH chips, any decent programmer software will do it automatically, read the chip, store the OSCCAL value, then write it back when you write the chip.

For a 12C508JW you need to manually save and restore the value, as it's erased by the UV eraser - 12C508's aren't a problem, because they are OTP, so the OSCCAL value doesn't get erased.

I must try like that way u said......I must get it confirm with my PIC 16f628a first........all the time I used external oscillators........anyway thankx.............:)
 
Gayan Soyza said:
Same like PIC12f629 prob...... when u program 12c508a & PIC16f628a when selecting internal oscillator do u need to write the OSCCAL codes in the program....or can u wright the main code by ignoring that OSCCAL codes ?????bcuz I got stucked in programing 508a wasted about 4 chips.......

You're free to use the calibration value or not, when you write the code.
The PIC12C508A has been replaced by the PIC12F508, which has flash memory. The PIC16F628A doesn't have the OSCCAL register and can't be calibrated. If you want a good stability of the internal oscillator, the PIC 16F628A should be operated with Vcc=3.5 V and T=25°C.
 
eng1 said:
If you want a good stability of the internal oscillator, the PIC 16F628A should be operated with Vcc=3.5 V and T=25°C.

The output of any oscillator is usually stable at a particular value when one specified both voltage and temperature. Frequency only changes either with changing voltage, changing temperature, aging or all of them together.

If you have read about this piece of information from the 16F628A datasheet, then it is the main reason why Microchip have stated it that way. This does not mean it is the optimum operating condition for 16F628A.

Or you can show us your source of reference.
 
eblc1388 said:
This does not mean it is the optimum operating condition for 16F628A.
I thought it is!

As far as the voltage and the temperature are constant, the frequency will be stable, but different from the nominal value (not whithin 1% of the nominal value). This was my interpretaion, am I wrong?
 
If you look at the datasheet:

2.0V < Vdd < 5.5V and temperature 0 < temp < 85 degree, the frequency variation is 3.92 to 4.08MHz.

How can you be so sure that Vdd=3.5V and temp=25 degree is the optimum?

If I put the PIC at 30 degree and but change Vdd up or down to obtain exactly 4.000000MHz, is my operating point the optimum?
 
eblc1388 said:
If you look at the datasheet:

2.0V < Vdd < 5.5V and temperature 0 < temp < 85 degree, the frequency variation is 3.92 to 4.08MHz.
So this is ±2% with respect to 4 MHz. Since they say that the internal oscillator is factory calibrated to 1%, it will have that precision with the same operating conditions (Vcc and T).

eblc1388 said:
If I put the PIC at 30 degree and but change Vdd up or down to obtain exactly 4.000000MHz, is my operating point the optimum?
I understand this, but if I can't calibrate I'll be satisified with 1% tolerance.

Thanks
 
Last edited:
eng1 said:
So this is ±2% with respect to 4 MHz. Since they say that the internal oscillator is factory calibrated to 1%, it will have that precision with the same operating conditions (Vcc and T).

Yes, but that's an area of polygon on a 2-D graph with temperature and Vdd as axis, when both parameters can varies.

Inside this polygon, there is another polygon which falls within the 1% precision limit. What I'm saying is the 3.5V 25 degree point is just one point inside this second 1% polygon and there are many others too.

Edited: We can easily regulate the PIC supply voltage to 5V. How can one keep the PIC temperature constant at 25 degree C?
 
Last edited:
eblc1388 said:
Edited: We can easily regulate the PIC supply voltage to 5V. How can one keep the PIC temperature constant at 25 degree C?

Put it inside a temperature-controlled chamber, with A/C and a heater and a PID controller running it all. Should only cost you a few thousand dollars :rolleyes:

In case it wasn't clear enough already, controlling the temperature and voltage of the PIC is NOT going to make an INHERENTLY UNSTABLE oscillator into a wonderfully stable one.

Crystals are designed specifically for this kind of application. You can easily find crystals with a tolerance of around 20 parts per million (PPM). that's 0.002%! And the temperature coefficient is often on the order of parts per BILLION. Even with a perfect temperature-controlled chamber and a rock-solid 5v rail the PIC's internal oscillator couldn't touch that kind of accuracy... It's not meant to! Crystals are very cheap, and you only need the crystal and two capacitors, so it's not like it takes up a ton of board space.
 
Last edited:
For anyone that's interested, I can confirm that I/O pins that are configured as analogue inputs will act as digital outputs when the tris register is set to output. The above code does work with CMCOM=0 and ANSEL=0xff. It also simulates correctly as well.

Mike.
 
QUOTE=Pommie]For anyone that's interested, I can confirm that I/O pins that are configured as analogue inputs will act as digital outputs when the tris register is set to output. The above code does work with CMCOM=0 and ANSEL=0xff. It also simulates correctly as well.

Mike.[/QUOTE]
Hi
an add on querry-- mine is a specific case- of trying to convert a clock code in pic application AN615 (on PIC16C54A) to be able to work on PIC16F84A. with the encourgaement given by Nigel and others, i have sucseeded.After that i could modify the same to display continuously instead swithing off display at 8th sec.

Now the issue- i am trying to work it with 16F628A - as per the datasheet the equ set i started from 20H onwards-- modified the initialization moving the defined value to CMCON register. below is a small part of init portion
Code:
        CLRF	PORTA 
        MOVLW	0X07
        MOVWF	CMCON
        BSF	STATUS,RP0         ; SELECT BANK 1
        BCF	STATUS, RP1
        BSF	STATUS, RP0
        MOVLW      OPTION_SETUP    ; Place option reg setup into W
        MOVWF     OPTION_REG 	; Set up OPTION register
        BCF	STATUS,RP0      ; SELECT BANK 0
        MOVLW        PORTA         ; Place beginning of RAM/Port location into W
        MOVWF        FSR             ; Now initialize FSR with this location


the actual modified version is attached as zip file

I am not getting the clock thro on 16F628A and ot of idas. the display as seen in demo version of picsimide is MSD gilttering with '0'

My specific doubt is whether we are permitted to clear the PORTA as i hahve seen it done many times in the original programm by the author and now i am using it on 16f628a

Can some one support debug the mistakes.
 
Last edited:
evandude said:
Put it inside a temperature-controlled chamber, with A/C and a heater and a PID controller running it all. Should only cost you a few thousand dollars ....................

Hi,
Evandude and Nigel are to be thanked . i see other parametrers drifting frequecy of crystal or internal osc. that is moisture level around-- .... endless .... we can't create ideal circumstances like national or international labs. that muh maynot be required even.
 
Sarma,

I haven't looked at your main code as the bit you posted has a mistake. CMCON is in bank 1. If you move the 4th and 5th line to line 2 then that should fix it.

IE,
Code:
        CLRF	PORTA 
        BSF	STATUS,RP0         ; SELECT BANK 1 <---Moved
        BCF	STATUS, RP1        ;                       <---Moved
        MOVLW	0X07
        MOVWF	CMCON
        BSF	STATUS, RP0
        MOVLW      OPTION_SETUP    ; Place option reg setup into W
        MOVWF     OPTION_REG 	; Set up OPTION register
        BCF	STATUS,RP0      ; SELECT BANK 0
        MOVLW        PORTA         ; Place beginning of RAM/Port location into W
        MOVWF        FSR             ; Now initialize FSR with this location

HTH

Mike.
 
Hi Pommie
thanks for identifying the initial mistake. but if can see the PIC16C628A datasheet, they gave a example and i just tried to use part of the same.
i tried the suggested change. still the MSD flicking beween its value '1' ( i tried to set the cl;ock say at 12;00) and zero.
i shall also try to debug please try if you are able to spare little time for me.

thanks again
 
Last edited:
i wud like to do a project related to a transmitter at distant end,where it shud have a microfone,and a camera.i must have a reciever so that i shud be able to recieve both the audio as well as video.plz help me how shud i proceed.
thanks in advance.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top