Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:55 24 Nov 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 : (DM MM) Trapping Hardware Errors MMBas

Author Message
DuinoMiteMegaAn
Senior Member

Joined: 17/11/2011
Location: Australia
Posts: 231
Posted: 03:34pm 01 Dec 2011
Copy link to clipboard 
Print this post

(DM MM) Trapping Hardware Errors in MMBasic.

Under command "OPTION ERROR" you have two parameters of "ABORT" and "CONTINUE"
This applies ONLY for reading and writing from a SD card. <-----<<<<

Lets say you have I2C RTC basic code and the I2C device is missing.
How do you trap on this error to prevent a program halt?

Code example

120 I2Caddr = &h68
130 I2CEN 100,100
140 I2CRCV I2Caddr, 0, 8, RTCbuff(0), 1, 0
150 I2CDIS

Having the I2C device missing (not connected) will halt/abort program execution with
the following error which halts program execution.

Error Line 140: Receive variable not found.

I need to trap this error BEFORE this halts program execution ... any suggestions?
 
DuinoMiteMegaAn
Senior Member

Joined: 17/11/2011
Location: Australia
Posts: 231
Posted: 04:44pm 05 Dec 2011
Copy link to clipboard 
Print this post

Trapping errors revisited ...

The "Error Line 140: Receive variable not found" was
caused by not having a DIM RTCBuff(8) assigned.
The I2C should have timed-out and I could have used
"? "0=ok 1=nack 2=timeout"; MM.I2C" to pick up the I2C error.


Edited by DuinoMiteMegaAn 2011-12-07
 
Print this page


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

© JAQ Software 2024