Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MPLAB simulator timer anomaly - differs from realtime.

Status
Not open for further replies.

AlGeorge

Member level 1
Joined
Nov 17, 2009
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Waihi Beach
Activity points
1,606
Using MPLAB with PIC10F206/int 4Mhz osc, MPLAB stopwatch says 948.031000 ms to line>> if (++seconds>59) below.
It says 47.400000 ms >> if (part_seconds<20) return;
This should mean the onboard clock will run way too fast, but in fact it is running much slower than the MPLAB stopwatch suggests on 4Mhz clock. EG a second anomaly per minute. See code below any suggestions please?
Code:
void Clock_Proc(void)
{
    static unsigned int timecheck;
    clrwdt ();                                    //if wdt enabled, this will reset
    astate=0;
    TMR0=Timer_offset;
    ++part_seconds;
    if (part_seconds<20) return;
    part_seconds=0;
    if (++seconds>59)
 

Hi,
Have you set the clock settings properly by selecting "Settings" under the "Debugger Menu"?
 

Yes, if I hadn't, the difference would have been much more significant. The internal clock on those parts is fixed at 4Mhz.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top