![Telit Wireless Solutions EZ10 Series Скачать руководство пользователя страница 52](http://html1.mh-extra.com/html/telit-wireless-solutions/ez10-series/ez10-series_product-description_1083786052.webp)
Telit EZ10-GPRS/-PCS
Product Description
80269ST10014a, Rev. 3 – 26/09/05
Reproduction forbidden without written authorization by Telit Communications S.p.A.
Page 52 of 74
All Rights reserved – Right of modification reserved
c = IICbus.sendbyte(0x0d)
d = IICbus.readbyte()
which sends 'test' followed by CR and receives data waiting for one second.
NOTE that you must provide external pull-up on SDA line since the line is working as open
collector, SCLK instead is driven with a complete push pull.
More details about IIC built-in module object methods are in the following paragraphs.
3.3.5.5.1 IIC.new(SDA_pin, SCL_pin)
Creates a new IIC bus object on the GPIO pins number.
Input parameter SDA_pin, SCL_pin are Python bytes which are the GPIO pin number where the
SDA (Serial DAta) and SCL (Serial CLock) lines are mapped.
Return value is the Python custom IIC bus object pointer which then shall be used to interface with
the IIC bus created.
Example:
bus1 = IIC.new(3,4)
bus2 = IIC.new(5,6)
This creates two IIC bus, one over the GPIO3 and GPIO4 and one over the GPIO5 and GPIO6.
Available pins for the IIC bus are GPIO3 - GPIO13, while GPIO1 and GPIO2 are not available for
IIC.
3.3.5.5.2 IIC object method: init()
Does the first pin initialisation on the IIC bus previously created.
Return value is a Python integer which is -1 if an error occurred otherwise is 1.
Example:
a = bus1.init()
3.3.5.5.3 IIC object method: sendbyte(byte)
Sends a byte to the IIC bus previously created.
Input parameter byte is a Python byte which is the byte to be sent to the IIC bus.
The start and stop condition on the bus are added by the function.
Return value is a Python integer which is -1 if an error occurred otherwise is 1 the byte has been
acknowledged by the slave.
Example:
a = bus1.sendbyte(123)
sends byte 123 to the IIC bus , assigning return result value to a.
3.3.5.5.4 IIC object method: send(string)
Sends a string to the IIC bus previously created.
Input parameter string is a Python string which is the string to send to the IIC bus.
Return value is a Python integer which is -1 if an error occurred otherwise is 1 if all bytes of the
string have been acknowledged by the slave.
Example:
a = bus1.send('test')
sends string 'test' to the IIC bus , assigning return result value to a.