Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

AN4655 Datasheet(PDF) 16 Page - STMicroelectronics

Part # AN4655
Description  Virtually increasing the number of serial communication peripherals in STM32 applications
PDF  21 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN4655 Datasheet(HTML) 16 Page - STMicroelectronics

Back Button AN4655 Datasheet HTML 12Page - STMicroelectronics AN4655 Datasheet HTML 13Page - STMicroelectronics AN4655 Datasheet HTML 14Page - STMicroelectronics AN4655 Datasheet HTML 15Page - STMicroelectronics AN4655 Datasheet HTML 16Page - STMicroelectronics AN4655 Datasheet HTML 17Page - STMicroelectronics AN4655 Datasheet HTML 18Page - STMicroelectronics AN4655 Datasheet HTML 19Page - STMicroelectronics AN4655 Datasheet HTML 20Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 16 / 21 page
background image
SW methods
AN4655
16/21
DocID027483 Rev 1
#define setup_dly() {};/* no code is provided */
#define half_bit_dly() {};
2.5.3
I2C master bit-banging sequence
This example is related to procedures controlling I2C master 8 bits data frame read and
write transactions.
#define i2c_bus_init() { I2C_DR |= ((1 << I2C_SDA_PIN) | (1 <<
I2C_SCL_PIN)); }
#define i2c_set_sda() { I2C_DR |= (1 << I2C_SDA_PIN); }
#define i2c_clear_sda() { I2C_DR &= ~(1 << I2C_SDA_PIN); }
#define i2c_get_sda()
(I2C_DR & I2C_SDA_PIN)
#define i2c_set_scl() { I2C_DR |= (1 << I2C_SCL_PIN); }
#define i2c_clear_scl() { I2C_DR &= ~(1 << I2C_SCL_PIN); }
#define sda_wr_control(b) { (b & msk) ?
i2c_set_sda() : i2c_clear_sda(); }
#define sda_rd_control(b) { I f(i2c_get_sda() != 0)
b |= msk;
}
/**
* @brief I2C master write 8-bit data bit-bang
* @param unsigned char b - data to transmit
* @retval unsigned char ack – acknowledgement received
*/
void I2C_master_write (unsigned char b)
{
unsigned char msk = 0x80;
unsigned char ack;
do
{
sda_wr_control(b);
setup_dly();
i2c_set_scl();
half_bit_dly();
i2c_clear_scl();
setup_dly();
}
while ((msk>>=1) != 0);
i2c_set_sda();/* ACK slot checking */
i2c_set_scl();
half_bit_dly();
ack = i2c_get_sda();
i2c_clear_scl();
return (ack);
}



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com