At 09:23 PM 5/6/2003 -0400, you wrote: >A friend of mine, who is a very experienced programmer, but knows nothing >about PIC's (at least I don't think he does) has offered to make a bet with >me as follows: He is willing to bet, any amount I want to name, that he >can write a program which can figure out the clock speed of the computer it >is running on. > >To rephrase it, he thinks that he can figure out, in software, the number >of MIPS of the machine he is running on. > >Since he is used to machines that have operating systems, with system >clocks and that sort of thing available to users, he might be able to do it >on those. But I do not think there is any way whatsoever on a PIC to do >this. (No peripherals -- just the raw chip running, with his program). > >However, he is very experienced, and I have lost bets with him before. So >even thought it seems to me to be a sure thing, I am a bit hesitant to >bet. Can any of you experts think of a way to do this???? If you place limitations on the problem ... - PIC core - no EEPROM - no WDT - no interrupts - no port pins - no ADC - no sleep mode - no inputs at all (possible trickery!) - no outputs at all (ditto!) The processor is only powered/reset up ONCE and must REPEATEDLY re-calculate he clock speed or MIPS and place it into (say) a 32 bit register. Specify some accuracy (5% or whatever). It must be in units of 1/second. I don't think that can be done. But all the same, betting more than his answer is worth to you for fun might not be wise. ;-) Best regards, Spehro Pefhany --"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu