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: AustraliaPosts: 1097 |
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 KingdomPosts: 1985 |
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 hth |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1097 |
@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: AustraliaPosts: 3165 |
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: AustraliaPosts: 1097 |
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: FrancePosts: 154 |
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 ZealandPosts: 9066 |
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: FrancePosts: 154 |
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 ZealandPosts: 9066 |
You are most welcome. Cordialement. Smoke makes things work. When the smoke gets out, it stops! |
||||
Print this page |