|
|
| Author |
Message |
victorf
Joined: 01 Jan 2006
Posts: 342
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.
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: |
|
|
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
Vic |
|
| Back to top |
|
 |
mikep
Joined: 24 Sep 2005
Posts: 765
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
Posts: 661
|
|
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.
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: |
|
|
| 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 |
|
 |
|