Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
OpenI2C() question

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
victorf



Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York

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

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
Posts: 342
Location: Schenectady, New York

Posted: 24 January 2006, 13:18 PM    Post subject: Reply with quote

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
Posts: 765
Location: Austin, TX

Posted: 24 January 2006, 14:06 PM    Post subject: Reply with quote

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
Posts: 661

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

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
Posts: 2493
Location: Portland, OR

Posted: 24 January 2006, 16:42 PM    Post subject: Reply with quote

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:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 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