PIC12F675 Oscillator Calibration

Find out how to setup your programmer's software and how to solve many common problems.

Moderator: phalanx

User avatar
phalanx
Non-SFE Guru
Posts: 1980
Joined: Sun Nov 30, 2003 8:57 am
Location: Candia, NH

Re: PIC12F675 Oscillator Calibration

Post by phalanx » Tue Nov 17, 2015 2:09 pm

I'm certainly glad you're ok. I'll still be here when you check back in.

Cheers,

-Bill

Old Frank
Posts: 13
Joined: Tue Sep 01, 2015 12:46 pm

Re: PIC12F675 Oscillator Calibration

Post by Old Frank » Sun Nov 29, 2015 1:43 pm

I think a muted "Yee haa" might be in order as I've actually got the LED to flash courtesy of the PICkit 2 I borrowed and your changes to the template. It's flashing too quickly, but by waving it about very quickly I could see the gaps. The important thing is that I've got a program into the chip and it does as it's told. I'll now correct the program and let you see the result. Many thanks for your help with this. Cheers for now,
Frank

User avatar
phalanx
Non-SFE Guru
Posts: 1980
Joined: Sun Nov 30, 2003 8:57 am
Location: Candia, NH

Re: PIC12F675 Oscillator Calibration

Post by phalanx » Mon Nov 30, 2015 1:05 pm

That's good that you have it blinking! From my post a while back, I noted that your blink rate would be very fast. To slow it down, you can add an outer loop to your current delay routine. This will make your inner (existing) delay routine run multiple times. It would look something like this:

Code: Select all

	movlw	outtervalue	  ;get outer loop value
	movwf	outtercounter	;load it into the outter loop counter
ONT2
	movlw	innervalue	   ;get inner loop value
	movwf	innercounter	 ;load it into the inner loop counter
ONT1
	decfsz  innercounter	 ;decrement inner loop counter and
	goto	 ONT1		      ;repeat the decrement if the inner loop counter is not zero

	decfsz  outtervounter	;decrement outter loop counter and
	goto	 ONT2		      ;repeat the inner loop routine if the outter loop counter is not zero	
You can adjust your outtervalue and innervalue constants to achieve the delay you require. In MPLAB, there is a stopwatch feature you can use to measure the time between two breakpoints while debugging or while using the simulator. This would let you quickly fine tune the delay routine.

-Bill

Old Frank
Posts: 13
Joined: Tue Sep 01, 2015 12:46 pm

Re: PIC12F675 Oscillator Calibration

Post by Old Frank » Tue Jan 05, 2016 12:23 am

At last! Happy New Year, Bill. I hope you managed to get in some serious relaxing. Over the holidays I managed to get at the strobe again and, after your help, I've got it more or less working. I needed App. Note AN556 to get over the memory boundary business. I'm learning! It uses 3 look-up tables (taking up pages 1,2 &3 but not over-writing the OSCCAL calibration at 3FF) to feed 3 nested counters and gives about 1Hz for an ADC value of zero on the high range and about 0.1Hz on the low range. Haven't checked any other frequencies yet, but the main trouble seems to be that the PICkit 2 is misbehaving. I get error messages about VDD and no chip detected, even when it's just programmed the same chip and there've been no changes to the settings. After that I can't reset the OSCCAL value in 3FF, but keep getting invalid value, 0FCB. This happened with 5 chips. Today I noticed that the busy LED suddenly starts flashing rapidly and doesn't stop even when left for ages. Is the PICkit2 damaging chips?
Sorry to give you more trouble.

User avatar
phalanx
Non-SFE Guru
Posts: 1980
Joined: Sun Nov 30, 2003 8:57 am
Location: Candia, NH

Re: PIC12F675 Oscillator Calibration

Post by phalanx » Tue Jan 05, 2016 12:02 pm

Hi Frank,

Relaxing was tough when my SWMBO had a list of things for me to do during my 2 weeks of vacation. I got through them all and kept her happy!

It's possible you have a PICkit 2 issue but it's hard to say from here. Make sure you have your MPLAB settings set so that the PICkit 2 is not sourcing power to your target board. After that, do you have access to another PICkit 2 or a PICkit 3? It may be worth trying them out. I wouldn't get too hung up on the invalid value report for OSCCAL.

-Bill

Old Frank
Posts: 13
Joined: Tue Sep 01, 2015 12:46 pm

Re: PIC12F675 Oscillator Calibration

Post by Old Frank » Wed Jan 06, 2016 2:45 pm

Thanks, Bill.
I'll use my Christmas vouchers for mundane things and replace them with cash to buy my own PICkit 3 from a reputable UK firm, then I'll have more faith in it. Apparently the PICkit 2 I borrowed is a clone from " a land far away". It certainly looks like an original, but ....
I hope to have another go at it tomorrow as the last few days have been occupied by SWMBO's health matters.
Hope you got a load of Brownie points for all those jobs.
Cheers for now,
Frank

Old Frank
Posts: 13
Joined: Tue Sep 01, 2015 12:46 pm

Re: PIC12F675 Oscillator Calibration

Post by Old Frank » Mon Jun 20, 2016 1:00 am

Another "at last". I got the strobe working well enough this month for 28 people at 2 workshop sessions to assemble and go away happy with a 2 range version (0.6-25.5Hz & 6-255Hz) using 2 look-up tables instead of 3.
Many thanks for your help. I was lost without it.
I hope to do a similar job at another conference in October, but might have managed the wider range by then.
All the best,
Frank

User avatar
phalanx
Non-SFE Guru
Posts: 1980
Joined: Sun Nov 30, 2003 8:57 am
Location: Candia, NH

Re: PIC12F675 Oscillator Calibration

Post by phalanx » Mon Jun 20, 2016 5:42 am

Glad you got it working well enough for your workshops.

Cheers!

-Bill

Post Reply