The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

AN1820 Freescale Semiconductor, Inc. Software Communications


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



Order this document AN1820/D
AN1820
Freescale Semiconductor, Inc.
Software Communications
Brad Bierschenk Applications Engineering Austin, Texas
Introduction
(inter-integrated circuit) protocol 2-wire serial communications interface, implemented numerous microcontrollers peripheral devices. Many MCUs (microcontroller units) have module, they required communicate 2-wire, I2C, devices. This application note describes method communicating controlling digital input/output (I/O) pins. This "bit-banged" method implemented Motorola MCU.
Overview
2-wire communications link, requiring clock line (SCK) data line (SDA) communicate. frequency clock Kbits second standard mode, Kbits second fast mode. both master devices slave devices attached master defined device which initiates transfer, generates clock signals, terminates transfer. slave device simply device
Motorola, Inc., 1999
AN1820
More Information This Product, www.freescale.com
Freescale Semiconductor, Inc. Application Note
addressed master. provides multiple masters same bus. also provides some error checking acknowledgment bits during byte transfers. application presented this document illustrates limited version specification. intended implement features bus. only provides basic functionality required transmit master device slave devices through 2-wire interface. advantage this method uses standard digital input/output pins available Motorola MCU.
Freescale Semiconductor, Inc.
application presented here provides following functionality: 7-bit addressing Single master transmitter Multiple data bytes within serial transfer Serial clock frequency approximately (arbitrary) Acknowledgment polling error checking
controlling digital pins, simulate transfer. When pins CMOS open-drain, some safegaurds have implemented. series resistor should used between CMOS output receiver's input pin. This will provide some current limiting should devices attempt output conflicting logic levels. other consideration supporting logic high open-drain receiver pins. pullup resistor used receiver's open-drain passively pullup supply voltage, when being actively driven low. This pullup resistor should carefully chosen, that when master drives low, valid level presented receiver's pin. diagram shown Figure illustrates connect digital pins external receiver device. this case, MC68HC705J1A microcontroller connected Maxim MAX517 (Digital-toAnalog Converter). MAX517 2-wire interface that compatible. MC68HC705J1A CMOS bidirectional input/output
AN1820 More Information This Product, www.freescale.com MOTOROLA
Application Note Overview
pins. When connected shown, successful communications made external transfer composed specific stages, defined states wires. Figure shows timing between clock data lines. signal beginning transmission, START condition presented bus. This START condition indicated falling edge SDA, while held high. Once START condition been driven, master device places 7-bit address bus, with most significant first. This address corresponds address device transfer intended for. eighth following 7-bit address high low, depending whether "read" "write" operation.
Freescale Semiconductor, Inc.
OUTPUT OUT0 CLOCK DATA MAX517 REF0
MC68HC705J1A
Figure Hardware Diagram
START
STOP
Figure Example Transfer Timing
AN1820 MOTOROLA More Information This Product, www.freescale.com
Application Note Overview
with bytes transferred bus, ninth clock cycle used acknowledgment. line read during this ninth clock cycle signifies whether byte acknowledged. receiver will drive line during ninth clock cycle acknowledges byte transmission. number data bytes follow address byte, each composed eight data bits ninth acknowledge bit. transfer, STOP condition imposed bus. STOP condition indicated rising edge SDA, while line held high.
Freescale Semiconductor, Inc.
NOTE:
avoid unwanted START STOP conditions, software must transition only while line held low. listing assembly code that shows specific implementation software follows this text. This application does require some software overhead, somewhat interruptible completely synchronous. implementation that requires less software overhead could created using more automated timing source, such freerunning counter real-time interrupt. code shows MC68HC705J1A microcontroller connected peripheral, this case Maxim MAX517 DAC. software continuously sends write command DAC, ramping digital value from back down again. This creates triangular wave output DAC. point show completely useful application, illustrate digital input/output pins master device.
AN1820 MOTOROLA More Information This Product, www.freescale.com
Application Note Code Listings
Code Listings
TRIANGLE.ASM Purpose: Test bit-banging using Target: 705J1A Author: Brad Bierschenk, Applications Tested using Maxim MAX517 "2-wire interface" (another word I2C) This code continuously sends 8-bit data Digital Analog incrementing from $FF, back down again. This creates triangular waveform output chip. frequency approximately kHz. This completely arbitrary. Assembler Equates -RAMSPACE ;RAM start address ROMSPACE $300 ;EPROM start address PORTA ;Port PORTB ;Port DDRA ;Data direction DDRB ;Data direction Emulated lines Port pins Need clock (SCL) data (SDA) -SCL ;Serial clock ;Serial data DACADDR ;Slave address
Freescale Semiconductor, Inc.
Variables -ORG RAMSPACE BitCounter ;Used count bits Value ;Used store data value Direction ;Indicates increment ;decrement Start program code -ORG ROMSPACE ;Start EPROM Start: ;Initialize variables Value ;Clear variables BitCounter Direction ;Setup parallel ports #$03 ;PA0 outputs PORTA ;driven high start DDRA AN1820 MOTOROLA More Information This Product, www.freescale.com
Freescale Semiconductor, Inc. Application Note
This main loop just ramps down data value that sent chip. -TxLoop: Direction ;Increment decrement? GoUp GoDown: Value ;Decrement ;Change direction needed Direction SendIt GD2: Value ;Decrement data value SendIt GoUp: Value ;Increment #$FF ;Change direction needed Direction ;Increment data value SendIt GU2: Value Send transmission, including START, address, data, STOP -SendIt: ;START condition I2CStartBit ;Give START condition ;ADDRESS byte, consists 7-bit address LSbit #DACADDR ;Slave device address ASLA ;Need this align address I2CTxByte ;Send eight bits ;DATA bytes #$00 I2CTxByte Value I2CTxByte ;$00 command byte ;Send bits ;Value value ;Send ;Give STOP condition ;Wait ;Repeat
Freescale Semiconductor, Inc.
;STOP condition I2CStopBit I2CBitDelay TxLoop
I2CTxByte Transmit byte (Acc will restored return) Must careful change values only while low, otherwise STOP START could implied I2CTxByte: ;Initialize variable #$08 BitCounter AN1820 More Information This Product, www.freescale.com MOTOROLA
Application Note Code Listings
Freescale Semiconductor, Inc.
I2CNextBit: ROLA SendHigh: BSET setup BSET SendLow: BCLR BSET I2CTxCont: BCLR I2CAckPoll: BSET BCLR BSET BRSET BCLR BSET
SendLow SDA,PORTA I2CSetupDelay SCL,PORTA I2CBitDelay I2CTxCont SDA,PORTA I2CSetupDelay SCL,PORTA I2CBitDelay SCL,PORTA BitCounter I2CAckPoll I2CNextBit SDA,PORTA SDA,DDRA I2CSetupDelay SCL,PORTA I2CBitDelay SDA,PORTA,I2CNoAck SCL,PORTA SDA,DDRA
;Shift MSbit into Carry ;Send high ;Set data value ;Give some time data ;Clock ;Wait ;Continue
;Restore clock state ;Decrement counter ;Last bit?
;Set input ;Clock line ;Look from slave ;device ;Restore clock line ;SDA back output
acknowledgment received from slave device ;Some error action performed here ;For now, just restore I2CNoAck: BCLR SCL,PORTA BSET SDA,DDRA START condition defined falling edge while high BCLR SDA,PORTA I2CBitDelay BCLR SCL,PORTA STOP condition defined rising edge while high I2CStopBit: BCLR SDA,PORTA BSET SCL,PORTA BSET SDA,PORTA I2CBitDelay
AN1820 MOTOROLA More Information This Product, www.freescale.com
Freescale Semiconductor, Inc. Application Note
Provide some data setup time allow stabilize slave device Completely arbitrary delay cycles) I2CSetupDelay: delay provide (approximately) desired frequency Again, this arbitrary cycles) I2CBitDelay: Vector Definitions -ORG $07FE ;Reset vector Start
Freescale Semiconductor, Inc.
Motorola reserves right make changes without further notice products herein. Motorola makes warranty, representation guarantee regarding suitability products particular purpose, does Motorola assume liability arising application product circuit, specifically disclaims liability, including without limitation consequential incidental damages. "Typical" parameters which provided Motorola data sheets and/or specifications vary different applications actual performance vary over time. operating parameters, including "Typicals" must validated each customer application customer's technical experts. Motorola does convey license under patent rights rights others. Motorola products designed, intended, authorized components systems intended surgical implant into body, other applications intended support sustain life, other application which failure Motorola product could create situation where personal injury death occur. Should Buyer purchase Motorola products such unintended unauthorized application, Buyer shall indemnify hold Motorola officers, employees, subsidiaries, affiliates, distributors harmless against claims, costs, damages, expenses, reasonable attorney fees arising directly indirectly, claim personal injury death associated with such unintended unauthorized use, even such claim alleges that Motorola negligent regarding design manufacture part. Motorola registered trademarks Motorola, Inc. Motorola, Inc. Equal Opportunity/Affirmative Action Employer.
reach USA/EUROPE/Locations Listed: Motorola Literature Distribution, P.O. 5405, Denver, Colorado 80217, 1-303-675-2140 1-800-441-2447. Customer Focus Center, 1-800-521-6274 JAPAN: Motorola Japan Ltd.; SPS, Technical Information Center, 3-20-1, Minami-Azabu, Minato-ku, Tokyo, 106-8573 Japan. 81-3-3440-8573 ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd.; Silicon Harbour Centre, King Street, Industrial Estate, N.T., Hong Kong. 852-26668334 MfaxTM, Motorola Back System: RMFAX0@email.sps.mot.com; http://sps.motorola.com/mfax/; TOUCHTONE, 1-602-244-6609; Canada ONLY, 1-800-774-1848 HOME PAGE: http://motorola.com/sps/ Mfax trademark Motorola, Inc.
Motorola, Inc., 1999
AN1820/D More Information This Product, www.freescale.com

Other recent searches


VTE1285 - VTE1285   VTE1285 Datasheet
TDA8780M - TDA8780M   TDA8780M Datasheet
TC1264 - TC1264   TC1264 Datasheet
SST25VF010 - SST25VF010   SST25VF010 Datasheet
SST25VF0101 - SST25VF0101   SST25VF0101 Datasheet
NA1636 - NA1636   NA1636 Datasheet
CDRH5D18R - CDRH5D18R   CDRH5D18R Datasheet
BPW85 - BPW85   BPW85 Datasheet
BPT42E04 - BPT42E04   BPT42E04 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive