PDA

View Full Version : CLKFREQ change during runtime



Laci82
11-17-2010, 04:49 PM
Hello,

I have a problem with the clkfreq.
I try to open a file (it is working), but the clkFreq value change during this process and I don't know why. The value befor open: 80.000.000, value after : 3.
Code:

ser.dec(clkfreq)
waitcnt(cnt + 2 * clkfreq)

if strcomp(fsrw.openFile(fileNamePtr,"r"),fileNamePtr) == false
ser.str(string(13,10,"File not found!"))
return -1'fail
ser.dec(clkfreq)
waitcnt(cnt + 2 * clkfreq)

Please Help!

Laci

Mike Green
11-17-2010, 05:28 PM
It's very difficult to tell what's going on from just a small program fragment. Usually the problem is somewhere else. Keep in mind that CLKFREQ is just the 1st 4 bytes of memory. If you're using pointers and the pointer value is zero, it's easy to accidentally change CLKFREQ via a pointer reference. For example,

LONG[ Pointer ] := 3

will change CLKFREQ to 3 if Pointer is zero.