[time-nuts] Pictic II mods

Richard H McCorkle mccorkle at ptialaska.net
Sat Jul 3 02:03:22 UTC 2010


Bob,
I have posted a code revision on the WIKI that provides serial commands
for modifying the OSCTUNE and SPBRG registers for those that might want
to adjust the baud rate and internal oscillator timing and don't have
facilities for programming the PIC. These commands won't alter the
default values so re-establishing communications at the default rate
after an incorrectly entered value can be done by a power cycle. But
they will need to be re-entered after any power-up to change the baud
or oscillator rate from the default 9600 baud and factory calibrated
8M oscillator rate.

Richard


> Hi
>
> The gotcha with the tune register is that it's not much help for those without a
> PIC programmer...
>
> Bob
>
>
> On Jul 2, 2010, at 8:15 PM, Richard H McCorkle wrote:
>
>> Bob,
>> Another option with the 16F688 is to "tweak" the internal oscillator
>> rate slightly to give the proper baud rate. The code includes the
>> following two lines (normally commented out) to do this.
>>
>> ;	movlw	0x00	;put the cal value in OSCTUNE
>> ;	movwf 	OSCTUNE 	;to calibrate oscillator
>>
>>> From the Spec Sheet:
>>
>> The HFINTOSC is factory calibrated but can be adjusted in software
>> by writing to the OSCTUNE register. The default value of the OSCTUNE
>> register is ‘0’. The value is a 5-bit two’s complement number. When
>> the OSCTUNE register is modified, the HFINTOSC frequency will begin
>> shifting to the new frequency. Code execution continues during this
>> shift.
>>
>> bit 4-0 TUN<4:0>: Frequency Tuning bits
>>
>> 01111 = Maximum frequency
>> 00001 = Increasing Frequency
>> 00000 = Oscillator module is running at the calibrated frequency.
>> 11111 = Decreasing Frequency
>> 10000 = Minimum frequency
>>
>> Richard
>>
>>





More information about the time-nuts mailing list