Searching \ for '[PIC]: Can it be done???' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'Can it be done???'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Can it be done???'
2003\05\06@212506 by John Nall

flavicon
face
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????

John

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu>

2003\05\06@213955 by hard Prosser

flavicon
face
How accurate does it need to be - I'm thinking that the wdt ( or an
external RC network) could be used ?

Richard P




                   John Nall
                   <jnall01@ALLTE        To:     .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
                   L.NET>                cc:
                   Sent by: pic          Subject:     [PIC]: Can it be done???
                   microcontrolle
                   r discussion
                   list
                   <PICLIST@MITVM
                   A.MIT.EDU>


                   07/05/03 13:23
                   Please respond
                   to pic
                   microcontrolle
                   r discussion
                   list






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????

John

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu>

2003\05\06@214145 by M. Adam Davis

flavicon
face
The only question is how much error can he have and still count is
knowing the clock speed.

It would be a lot of work, but one could characterize the watchdog timer
for each chip and revision microchip produces.  Then you simply have to
count how many instruction cycles occur before a watchdog reset.  The
watchdog might allow you to get within 10-20% of the clock frequency on
a chip which is the same type and revision as another chip which has
been previously characterized.  The error would largely be due to
temperature.  Add a known temperature reference to the PIC and you can
get that down a bit.

But I suspect he is expecting a 'computer', and the PIC meets very few
of the common definitions of a computer alone.  He is probably, at
minimum, expecting some sort of stable timing mechanism or frequency,
such as a clock, or the old 18 times per second tick, etc.

-Adam

John Nall wrote:

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamspam_OUTmitvma.mit.edu>

2003\05\06@214350 by Doug Butler

picon face
Beware of having him measure the baud rate of a command in clock cycles.
Without any reference of time I would say it is impossible.

Doug Butler
Sherpa Engineering


> {Original Message removed}

2003\05\06@214357 by Ben Jackson

flavicon
face
On Tue, May 06, 2003 at 09:23:47PM -0400, John Nall wrote:
> 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).

PICs have several builtin timers that are fairly well characterized which
you could use to estimate your clock speed.  In no particular order:

       The WDT
       The internal A/D conversion timer
       The time it takes to write to EEPROM memory

--
Ben Jackson
<@spam@benKILLspamspamben.com>
http://www.ben.com/

--
http://www.piclist.com hint: To leave the PICList
KILLspampiclist-unsubscribe-requestKILLspamspammitvma.mit.edu>

2003\05\06@214606 by Bob Ammerman

picon face
The watchdog timer would provide a system clock independent reference,
albeit a rather poor one.

Bob Ammerman
RAm Systems

{Original Message removed}

2003\05\06@214611 by William Chops Westfield

face picon face
   To rephrase it, he thinks that he can figure out, in software, the number
   of MIPS of the machine he is running on.

You can come up with a "reasonable" guess as to clock speed on a PIC or
related processor by seeing how many instructions it will execute in
between watchdog timeouts (the WDT timer is normally a separate RC
controlled clock, I believe.)  You could probably get a bit closer with
a single resistor and cap connected to an IO pin, PERHAPS even using the
pin's inherent capacitance and leakage...

It depends how accurate he needs to be, and whether he's allowed to make
baseline measurements to compare to, and so on...

BillW

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu>

2003\05\06@215412 by Picdude

flavicon
face
Outside of all the WDT suggestions, what circuitry is he allowed to put on?  I'm thinking that discharging a capacitor and measuring with an a/d or comparator input could also provide a fairly accurate pic-clock-independent time reference.

Cheers,
-Neil.



On Tuesday 06 May 2003 20:45, William Chops Westfield scribbled:
{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestspamBeGonespammitvma.mit.edu>

2003\05\06@220235 by Picdude

flavicon
face
Oops -- looks like I accidentally erased part of my message...

Outside of all the WDT suggestions, what circuitry is he allowed to put on?
I'm thinking that charging a capacitor and measuring with an a/d or
comparator input could also provide a fairly accurate pic-clock-independent
time reference w/o the resistor even.   Connect the cap to one of the digital inputs which has the pull up resistor, and connect that input to an a/d input as well.  Switch digital output to low, then switch to input and measure the charge time.  Haven't actually done this though, but it sounds reasonable in my head. :-)

Cheers,
-Neil.


On Tuesday 06 May 2003 20:45, William Chops Westfield scribbled:
{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
TakeThisOuTpiclist-unsubscribe-requestEraseMEspamspam_OUTmitvma.mit.edu>

2003\05\06@221104 by Herbert Graf

flavicon
face
{Quote hidden}

       WDT. By knowing WHAT PIC is involved the WDT can be quite repeatable. It
doesn't have stellar accuracy but it would be enough to get a useful MIPS
reading. Another method possibly would be to sense 60Hz on a pin, that is
far harder to accomplish but it would be possible. TTYL

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspamTakeThisOuTmitvma.mit.edu>

2003\05\06@221726 by Tom Messenger

flavicon
face
Ignore any and all of the other responses you received here (piclist), John.

The best advice is to read your first email out loud and listen to all the
advice in it. To wit:


You describe him as: "very experienced programmer"
who: "knows nothing about pics"
yet is: "suggesting to have a wager with YOU"
for: "ANY AMOUNT YOU WANT TO NAME"
that he can do some trick.

Finally, you mention one more time that "he is very experienced"
and the clincher: "I have lost bets with him before".

This entire scenario suggests a certain strategy: spend your money on pic's
and stay away from gambling.  Of course, ymmv, yada yada yada.

Tom M.

ps. let us know how you make out.  I have some other wagers to entice you
with...

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestEraseMEspam.....mitvma.mit.edu>

2003\05\06@223212 by Ned Konz

flavicon
face
On Tuesday 06 May 2003 06:23 pm, John Nall 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.

[snip]

> 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????

Yes. The EEPROM write is fairly predictable on a given kind of PIC.
You can use a timer to time it.

--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspammitvma.mit.edu>

2003\05\06@224646 by Spehro Pefhany

picon face
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"
RemoveMEspeffEraseMEspamEraseMEinterlog.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
RemoveMEpiclist-unsubscribe-requestspam_OUTspamKILLspammitvma.mit.edu>

2003\05\06@233903 by Dale Botkin

flavicon
face
On Tue, 6 May 2003, John Nall 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.

John,

Since others have pointed out the obvious and not-so-obvious (I thought of
the WDT but not EEPROM writes), I won't go into that.  However, it might
be entertaining to make some trivial bet -- say a dollar.  See how long it
takes him to figure it out.  Now figure out his minimum hourly rate from
that...

<evil grin>

Dale
--
It's a thankless job, but I've got a lot of Karma to burn off.

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspamspammitvma.mit.edu>

2003\05\07@075342 by Olin Lathrop

face picon face
> 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).

I can do this without writing any code at all.  Your PIC is running at
20MHz +-20MHz.  Without an accuracy constraint you lose immediately.

You also didn't specify what the external circuit constraints are.  The
watchdog timer can be used to measure the processor clock without any
external timing hardware required.  It's not very accurate, but it depends
on what your accuracy requirements are.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\05\07@080001 by John Nall

flavicon
face
At 10:37 PM 5/6/2003 -0500, you wrote:

> >Since others have pointed out the obvious and not-so-obvious (I thought of
>the WDT but not EEPROM writes), I won't go into that.  However, it might
>be entertaining to make some trivial bet -- say a dollar.  See how long it
>takes him to figure it out.  Now figure out his minimum hourly rate from
>that...

I COULD do that. :-)  But I won't.  I'm convinced, now, after reading all
the replies, that it can be done.  At least within some reasonable fudge
factor.   That will teach me to go around bragging to my old computer
buddies about this neat new thing I am playing with (PIC's).   I suspect
that he has been secretly absorbing datasheets on the side, since he is the
type of guy to read those things for fun and entertainment.  You know the
type.  Heck, some of you ARE the type!!  :-)

So I shall keep my money.

Thanks,
John

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\05\07@111919 by Martin Baker

flavicon
face
>   You know the
>type.  Heck, some of you ARE the type!!  :-)
And your point would be?
:>

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\05\07@113201 by Dennis Hoskins

flavicon
face
   Assume a frequency of say 2mhz and write code to toggle an output at say 5 seconds.  Then, run the code and measure the actual toggle time  with a stopwatch or scope or whatever.  The ratio of the actual toggle speed vs 5 seconds would be the same the actual frequency vs 2mhz.  For example, 10 second toggle would equal 1mhz.  

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\05\07@153452 by Russell McMahon

face
flavicon
face
> So I shall keep my money.

Why not impress him. Say you are aware, on reflection, (and a little advice
:-) ) of x different methods - which did he have in mind and how accurately
did he think he could achieve it?


       RM

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2003\05\07@180444 by John Nall

flavicon
face
At 12:58 AM 5/8/2003 +1200, Russell  wrote:

>Why not impress him. Say you are aware, on reflection, (and a little advice
>:-) ) of x different methods - which did he have in mind and how accurately
>did he think he could achieve it?

Well, yeah, I could do that.  But the context of the discussion was such
that he was basically saying that I could do X if I wanted to, and I was
saying that no, he didn't understand -- it couldn't be done with a PIC.  It
actually had nothing to do with money.  (Now that I think it through, I
think he got intrigued by having my mentioned the PIC, and downloaded the
datasheet and absorbed it, just to see what I was talking about).

The discussion, by the way, fueled by gin and tonics, was on how hard it
would be to write an operating system for the 18F452. :-)  A very basic,
stripped down O/S which would contain "system functions" such as delays and
that sort of thing.  So the immediate issue was how general it could be
made.  (It made a lot better sense through an alcoholic haze).

John

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

More... (looser matching)
- Last day of these posts
- In 2003 , 2004 only
- Today
- New search...