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.

Making a PIC Dice for grandson but small problem

Status
Not open for further replies.
Thanks Eric,
just wanted to make sure I was actually doing what was necessary and not missing something easier.
Cheers.
 
@Eric Gibbs:
When running files for 12F6XX PICs in Oshonsoft, do you REM ( ; )/delete the following lines;
bsf STATUS,RP0
call 0x3FF
movwf OSCCAL
...and re-assemble, or do you know of a workaround which doesn't require this?

Thanks.

Eric! I've never had to do this with Oshonsoft! What's the problem here!

Cheers Ian
 
Ian,

the PIC12F629/675, and other??, devices have a factory calibrated value stored at the last location (0x3FF) of the device program memory. This value is retrieved by the 'call 0x3FF' and is used to calibrate the internal 4MHz oscillator, by loading the OSCCAL register using the instruction 'movwf OSCCAL'.

If the value in 0x3FF is incorrect or non-existant, a program may actually run, but any timing-critical operations could be way off and produce erroneous results.

There's a function in the stand-alone PICkit2 GUI program for regenerating an OSCCAL value, should it be erased inadvertently.

For whatever reason, simulators, such as Oshonsoft, see the sequence of reading and loading the OSCCAL value as the end of the program and usually halt after a few instructions..

Removing completely, or simply commenting-out ( ; ) the 'call 0x3FF' and 'movwf OSCCAL' lines, allows the program to be simulated, once assembled, just as it would run on the PIC.
 
Last edited:
hi Ian
As Mick has explained the simulation terminates on the call 0x3ff.

It will also terminate on the sleep command.
You can use conditional assembly statements in the program to skip these commands if in simulation mode.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top