Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 00:24 04 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PEEK and POKE

Author Message
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1097
Posted: 12:45pm 13 Dec 2016
Copy link to clipboard 
Print this post

For Geoff perhaps?

It has been mentioned that extreme care should be used when using the PEEK and POKE commands as this can cause a machine exception in certaion cases and corrupt the interpretter.

Is this the case for PEEK if an unused or unreachable memory location is addressed? I would like to modify my HEXDUMP program to print out memory locations but am wary of doing so if it could corrupt the interpretter.

Note, I can understand POKE being problematic and plan to stay well clear of that little monkey

Cheers, Doug.



... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1985
Posted: 01:39pm 13 Dec 2016
Copy link to clipboard 
Print this post

No. Peek reads memory and doesn't change its contents. Poke has the potential to break things because it can change the instruction that is executed at a given address or some other crutial value like pointers or structures etc.

There may be restrictions on where you can peek but that would cause program errors (which you could handle in your code) and not brick your 'mite

hthEdited by CaptainBoing 2016-12-14
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1097
Posted: 02:05pm 13 Dec 2016
Copy link to clipboard 
Print this post

@CaptainBoing,

Thanks mate, that is what I assumed but just wanted to check with someone.

Cheers,
Doug.

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 06:39pm 13 Dec 2016
Copy link to clipboard 
Print this post

In earlier versions of MMBasic PEEKing at an invalid address would cause an exception and reboot the Micromite. The current versions (5.2 and later) check that the address is valid and will throw a standard error if invalid (you can trap this with ON ERROR).

The same address checking applies to POKE. In either case you cannot damage the Micromite or corrupt MMBasic, the worst that can happen is that you might trigger an exception and experience an involuntary reboot.

Geoff
Geoff Graham - http://geoffg.net
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1097
Posted: 08:26pm 13 Dec 2016
Copy link to clipboard 
Print this post

Thanks Geoff.

Doug.

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
f1fco

Senior Member

Joined: 18/03/2012
Location: France
Posts: 154
Posted: 11:30pm 13 Dec 2016
Copy link to clipboard 
Print this post

Hi Geoff and the list,
is it a "special" POKE (adress and value) to voluntarily rebbot the chip ?

thanks for answer

Pierre.
73s de F1FCO
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 11:42pm 13 Dec 2016
Copy link to clipboard 
Print this post

Commands.

CPU RESTART - Page 54 of standard manual.
WATCHDOG 1 - Page 72 of standard manual.

Watchdog 1 will cause the CPU to restart 1ms later.
Smoke makes things work. When the smoke gets out, it stops!
 
f1fco

Senior Member

Joined: 18/03/2012
Location: France
Posts: 154
Posted: 12:10am 14 Dec 2016
Copy link to clipboard 
Print this post

sorry for the question !
I have forget to read attentively the manual
CPU RESTARST is exactly what I need

thank you Grogster

Pierre.
73s de F1FCO
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 12:19am 14 Dec 2016
Copy link to clipboard 
Print this post

You are most welcome.

Cordialement.


Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024