Forum Index
OpenI2C() question

 
Author Message
victorf



Joined: 01 Jan 2006
Location: Schenectady, New York

Posted: 24 January 2006, 13:11 PM    Post subject: OpenI2C() question

Can OpenI2C() fail. If so, how can this be determined programmatically? The docs do not seem to address this. Confused

Any enlightenment will be appreciated.

Vic
Back to top
victorf



Joined: 01 Jan 2006
Location: Schenectady, New York

Posted: 24 January 2006, 13:18 PM    Post subject:

I just noticed an error (I think) in the docs for OpenI2C().
Quote:

bitRate ByVal integral The optional clock speed designation, see discussion


Shouldn't the data type be Byte? Don't know intergral Smile

Vic
Back to top
mikep



Joined: 24 Sep 2005
Location: Austin, TX

Posted: 24 January 2006, 14:06 PM    Post subject:

What failure conditions do you expect for I2COpen?
1. If you use invalid values then you may get garbage as there is not complete error checking in ZBasic - GIGO as they say. For example you could open I2C channel 10 but it will not give the expected result.
2. If you call I2COpen on the same channel twice, then the parameters to the last call override the previous.

Integral essentially means any numeric type except Single and Numeric means any numeric type. The following table from the documentation should make thing clear: http://www.zbasic.net/doc/ZBasicSysLib/ZBasicSysLib17.html
Back to top
spamiam



Joined: 13 Nov 2005

Posted: 24 January 2006, 16:28 PM    Post subject: Re: OpenI2C() question

victorf wrote:
Can OpenI2C() fail. If so, how can this be determined programmatically? The docs do not seem to address this. Confused

Any enlightenment will be appreciated.

Vic


It can not "fail" The function simply sets a bunch of parameters. It does not do any checking to see if the parameters you specify make sense.

It will happily set the parameters to anything you want, including potentially non-functional/unuseful settings.

Programmer beware.

-Tony
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Location: Portland, OR

Posted: 24 January 2006, 16:42 PM    Post subject:

Quote:
Shouldn't the data type be Byte? Don't know intergral

Integral means any type that is integral, e.g. Byte, Integer, UnsignedInteger, Long, etc.

Many of the System Library routines allow greater latitude in the types of parameters used, in effect implementing polymorphism with respect to parameter types. There is a page in the System Library Reference Manual that shows which actual types belong to various type categories such as Integral.
Back to top
Display posts from previous:   
Page 1 of 1

 



ZBasic Microcontrollers Home
All content Copyright © 2005, 2006, 2007, 2008, 2009, 2010 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group