User’s Guide !479 ,12 TM RS-232 to I2C Host Adapter with ASCII Fast Mode Interface with iPort Utility Pack for Windows www.mcc-us.
Introduction The MCC iPort/AFM (#MIIC-203) RS-232 to I2C Host Adapter with ASCII Fast Mode Interface allows any PC, Host Computer, or Data Terminal with an RS-232 port to become an I2C Master or Slave device, transmitting or receiving I2C messages to one or more I2C devices across an I2C Bus. This user’s guide describes the installation and operation of the iPort/AFM (#MIIC-203) RS-232 to I2C Host Adapter with ASCII Fast Mode Interface and iPort Utility Pack Software for Windows.
Copyright© 2002 by Micro Computer Control Corporation. All rights reserved. No part of this publication may be reproduced by any means without the prior written permission of Micro Computer Control Corporation, PO Box 275, Hopewell, New Jersey 08525 USA. DISCLAIMER: Micro Computer Control Corporation makes no representations or warranties with respect to the contents hereof and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose.
Table of Contents: Part 1 RS-232 to I2C Host Adapter w/ASCII Fast Mode Interface Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 iPort/AFM Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 iPort Utility Pack Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Programmer’s Reference . . . . . . . . . . . . . . . . . . . .
Master Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To Master Transmit Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To Master Receive Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slave Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To Slave Transmit a message . . . . . . . . . . . . . . . . . . . . . . .
iNterrupt Signal Assert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 iNterrupt Signal Release . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 iPort/AFM Prompts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iPort/AFM Ready . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slave Not Acknowledging . . . . . . . . . . . . . . . . . . . . . . . . . . .
Part 1 Model MIIC-203 2 RS-232 to I C Host Adapter w/ASCII Fast Mode Interface Model MIIC-203 8
RS-232 to I2C Host Adapter w/ASCII Fast Mode Interface Overview The MCC iPort/AFM (#MIIC-203) RS-232 to I2C Host Adapter with ASCII Fast Mode Interface allows any PC, Host Computer, or Data Terminal with an RS-232 port to become an I2C Master or Slave device, transmitting or receiving I2C messages to one or more I2C devices across an I2C Bus. PRODUCT FEATURES Turn ANY Computer’s Serial Port into an I2C Port. Supports Standard (100) and Fast (400) I2C Bus Activity.
Packing Slip This package includes the following items: • iPort/AFM (#MIIC-203) RS-232 to I2C Host Adapter with ASCII Fast Mode Interface. • 4 Foot I2C Interface Cable. (#CAB4) • 1Ft. /INT-Trigger Cable (#AXM-12G) • Serial Port Cable, 9F/25M, 1 Foot Long. (#C9F25M1) • 1Ft. /INT-Trigger Cable (#AXM-12G) • iPort/AFM User’s Guide. • iPort Utility Pack for Windows Software.
DB-25 Serial Port Pinout DB-25 Pin 2, Transmit Data from the Host Computer to the iPort DB-25 Pin 3, Receive Data from the iPort to the Host Computer. DB-25 Pin 4, Request to Send from the Host Computer to iPort. DB-25 Pin 5, Clear to Send from the iPort to the Host Computer. DB-25 Pin 7, Ground between Host Computer and iPort DB-9 Serial Port Pinout DB-9 Pin 3, Transmit Data from the Host Computer to the iPort DB-9 Pin 2, Receive Data from the iPort to the Host Computer.
3. I2C Interface Connector The iPort/AFM Host Adapter includes a four wire, positive locking, modular connector (see Appendix A for more info on these parts) for interfacing to an external I2C Bus. Lines provided include I2C Clock (SCL), Data (SDA), Ground, and +5VDC. Receptacle Connector An I2C Interface Cable (White=SCL, Red=+5VDC, Green=SDA, Black=Ground) is provided to connect to a external I2C Bus.
Hardware Configuration Pull-up Resistors The iPort/AFM Host Adapter includes a slide switch used to enable or disable internal 1.8K ohm Pull-Up resistors on the SCL, SDA, and INT lines. Every I2C Bus system must have at least one Pull-Up on each line. Use this switch to configure the iPort/AFM appropriately for your system. Connecting to a 3.3v System 1. Shut off iPort internal pull-ups. (See Pull-up Resistor section) 2. Use external pull-ups to 3.3 volts. The iPort uses a 5 volt device. 3.
Part 2 iPort Utility Pack for Windows V5 14
iPort Utility Pack for Windows 1. Introduction to Utility Pack This product includes two (2) Windows applications (Message Manager and Message Center) that help a user get started sending and receiving I2C Bus messages quickly. iPort Message Center The iPort Message Center operates with all versions of the iPort I2C Bus Host Adapter.
iPort Message Manager The Message Manager operates with all versions of the iPort I2C Bus Host Adapter.
2. System Requirements a. One of the following: 1. iPort (#MIIC-201) Windows to I2C Bus Host Adapter. 2. iPort/AI (#MIIC-202) RS-232 to I2C Bus Host Adapter with ASCII Interface 3. iPort/AFM (#MIIC-203) RS-232 to I2C Bus Host Adapter with ASCII Fast Mode Interface. b. Windows 95 or higher c. 1 free RS-232 Serial Port. 3. Software Installation Windows 95 and Above: 1. Insert software distribution diskette into floppy drive. 2. Select Start Run. Type “A:SETUP.EXE”. 3. Follow instructions on screen.
iPort Message Center for Windows Introduction to Message Center The iPort Message Center supports I2C Master Transmit and Receive activities for all versions of the iPort I2C Bus Host Adapter. With this program you can create, save, and execute scripts of I2C Master messages. The MCC iPort Message Center Software, when used with an MCC iPort allows a PC to become an I2C Master transmitter or receiving device, sending I2C messages between the PC and one or more I2C devices across an I2C Bus.
I2C Message Operations In order to communicate with another I2C device, a user must take the following steps: 1. Start Programs iPort Utility Pack iPort Message Center 2. Select which device you are operating with by choosing the corresponding image (Opening Screen), or the correct checkbox on the main application. Opening Screen Main Application The Main Application screen is opened by selecting an image on the Opening Screen.
3. Select the PC ComPort where the iPort is connected to your computer. 4. Use the Options menu to override default Baud Rate and I2C Bus Clock rate settings. 5. Establish a link to the iPort with the Open button. The iPort Message Center software sets the iPort’s own I2C Slave address to 0xFE. 6. To open an existing message list, click File|Open List on the menu bar. To enter or edit a message List, open the “I2C Message Editor” screen, by double clicking on a message row in the spreadsheet.
You can insert a new message between existing messages by clicking once on message below where you want to insert, press the “Insert” button on your keyboard, this will bring up the I2C Message Editor screen, set all information and click OK. 7. On the main screen, click on Send to transmit the current list of I2C Master messages, with the option to auto repeat upon completion, or send on INT assert (low). Once the link has opened successfully, you are now an active I2C node.
iPort Message Manager Software for Windows Introduction to Message Manager The MCC iPort Message Manager Software, when used in conjunction with an MCC iPort allows a PC to become an I2C Master or Slave device, transmitting or receiving I2C messages between the PC and one or more I2C devices across an I2C Bus. The iPort Message Manager is designed to be a simple application for experimenting with I2C messages. It provides methods to: 1.
I2C Message Operations In order to communicate with another I2C device, a user must take the following steps: 1. Starting the program: Start Programs iPort Utility Pack iPort Message Manager 2. Select iPort Device Select which device you are operating with by choosing the corresponding image (Opening Screen), or the correct checkbox on the main application. Opening Screen Main Application The Main Application screen is opened by selecting an image on the Opening Screen. 3.
Basic Set Up Screen Basic Set-up Select the PC ComPort attached to your iPort and the baud rate, then click OK. The Communications Events window on the Main Screen should report “I2C Open Successful”. If this message does not appear, check the iPort connections and power.
Advanced Set Up Screen Advanced Set-up On the Advanced Set-up screen you can set the following parameters: 1. iPort I2C Slave Address Select iPort’s I2C slave address. iPort will acknowledge messages sent to this address. 2 .iPort General Call Enabled allows iPort to respond to the I2C general call address (00). General call is used to broadcast an I2C message to multiple devices. 3. I2C Bus Master Bit Rate (iPort, iPort/AFM) The speed of the Bus will run. 100KHz is standard mode, 400kHz is fast mode.
Diagnostic Set Up Screen Diagnostic Set-up (iPort Only) On the Diagnostic Set-up screen you can set the following parameters: 1. iPort Log File Level Select iPort logging level.1 gives minimal info, 4 is verbose. Use the log file to troubleshoot communication problems. 2. Log File Name iPort log file name if enabled. 3. Log File Size (Lines) iPort log file length if enabled. 4.
Sending Messages Master Operations 1. To Master Transmit Data On the main screen, set the Master Tx Message Bytes edit box to the data you want to send by single clicking on the box. For example: To send a 0x05(hexadecimal) to the device, enter ~05 in the edit box. Click Ok and then the Master TX button to send the message. The Communications Events window on the main screen should report “Master TX Complete”. If this message does not appear, check the slave device address, connections, and power.
2. To Master Receive Data On the main screen, use the I2C Destination Address list control to set the slave address of the device you want to communicate with. Main Application Screen On the lower part of the main screen, set the Bytes to MasterRx edit box to the number of bytes you want to read. For example: Set this to 1 to read a single byte. Click on the Master RX button to receive the message. Data received from the slave is displayed in the Received Messages text box on the main screen.
Slave Operations To Slave Transmit a message: Enter data to be transmitted in the Slave Tx Message Bytes control by single clicking. Binary data bytes are entered using a three character Hex-Equivalent format (~00 ... ~FF), you may also type in ASCII text. These bytes are automatically transmitted when a Slave Transmit Request is received from a Master device. To Slave Receive a message: Data bytes received from a Master Transmitter are automatically displayed in the Received Message window.
Part 3 Programmer’s Reference ASCII Command Interface Definitions V2 30
iPort/AFM Quick Start Follow these steps to start sending and receiving I2C messages: 1. Install iPort/AFM as directed in the “Installation Instructions” section of this User’s Guide. 2. Use a terminal emulator program (like the Windows Terminal Program or Windows Hyperterminal) to get started. Remember to select the correct Com Port (COM1, COM2,…) and set the terminal emulator to 19200 Baud, 8 Data Bits, No Parity, and 1 Stop Bit. 3. Enter // to get an iPort/AFM Status Report.
iPort/AFM ASCII Text Interface Commands Note: [CR] = Carriage Return Code or Enter Key. Syntax: [Select], (Optional), xx = [00..FE], n = [0..32767] Command Description Ctrl/R,Ctrl/R,Ctrl/R iPort/AFM Reset This command resets the iPort/AFM to its default state. //[CR] Status Display Display iPort/AFM status information. /B[0|1|2][CR] RS-232 Baud Rate Control Set the RS-232 Baud rate (0 = 19.2, 1 = 57.6, 2 = 115.2 Baud) /C[CR] Close I2C Connection Disconnect from the I2C Bus.
/N( [0|1|A|R] )[CR] iNterrupt Signal Monitor/Control/Status Sets Monitor/Control/Status of INT line. [0 = Disable, 1 = Enable, A = Assert, R = Release/CR=Status] /O[CR] Open I2C Connection Activates iPort/AFM as an I2C device attached to the bus. /(*)Rn[CR] Master Read Message Read the specified number of data bytes from the current Destination I2C Slave device.
Command: Ctrl/R,Ctrl/R,Ctrl/R ‘iPort Reset Response. * ‘iPort/AFM Ready Default Setting: None Status Display This command displays current iPort/AFM status. Command: //[CR] 'Status Display Response: iPort/AFM I2C Host Adapter w/ASCII Fast Mode Interface Vxx.xx Copyright © xxxx, Micro Computer Control Corp. Visit our Web Site at: http://www.mcc-us.com RS-232 Baud Rate (19.
Close I2C Connection This command disconnects iPort/AFM from the I2C Bus. Command: /C[CR] Response: /CCC[CR] Default Setting: 'Close I2C Connection 'Close Connection Complete 'Closed Set Destination I2C Slave Address This command sets the destination I2C Slave Address (Hex 0,2...FE) for all subsequent Master Transmit or Receive operation.
The RTS/CTS protocol uses two additional wires in the cable connecting communicating devices. The RTS wire is an output signal. It indicates that the device generating the signal has buffer space available, and can receive. The CTS wire is an input signal. It indicates that the other device has buffer space available, and can receive. In general, XON/XOFF requires a minimal three-wire connection, Ground, Transmit Data, and Receive Data.
Command: /H[0|1][CR] Response: * Default Setting: 'Hex Only Display [0 = Disabled, 1 = Enabled] 'iPort/AFM Ready Enabled Set iPort/AFM’s Own I2C Slave Address This command sets iPort/AFM's own I2C Slave Address (Hex 2...FE). Subsequent I2C messages to this address will cause iPort/AFM to become an active Slave device on the bus.
// /B[0|1|2] /C /Dxx /E[0|1] /F[0|1] /G[0|1] /H[0|1] /Ixx Set /K[0|1|2|3] /M /N([0|1|A|R]) /O /(*)Rn /S(text) /(*)T(text) /Un /V /X[...]... /Y Status Display RS-232 Baud Rate Control (0=19.2, 1=57.6, 2=115.
Master Read Message This command causes iPort/AFM to read the specified number of data bytes from the currently selected Destination I2C Slave Address with or without generating an I2C Stop condition after the last byte is received. Enter Byte Count (Decimal 0...32767) then Press Enter, or ESCape to Cancel. A Byte Count of Zero (0) represents a Variable Length message, where the first byte read from the I2C Slave device indicates the number of additional trailing bytes are available to read.
Slave Transmit Message This command should be issued to iPort/AFM in response to a Slave Transmit Request (/STR). This command causes iPort/AFM to write the specified data bytes to the requesting I2C Master Receiver device. Enter Message Bytes (1 or more Printable ASCII or Hex-equivalent ~00..~FF), then Press Enter, or ESCape to Cancel.
/Sab~7Ecd[CR] /S12~0D24[CR] ‘Tilde embedded in ASCII Printable characters ‘Carriage Return embedded in ASCII Printable characters Master Transmit Message This command causes iPort/AFM to write the specified data bytes to the currently selected Destination I2C Slave Address with or without generating an I2C Stop condition after the last byte is transmitted. Enter Message Bytes (0 or more Printable ASCII or Hex-equivalent ~00..~FF), then Press Enter, ESCape to Cancel.
Default Setting: None Examples: /Tabcd1234[CR] /T~00~01~02[CR] /*T~00~01~02[CR] /Tab~7Ecd[CR] /T12~0D24[CR] ‘ASCII Printable characters "abcd1234" ‘Binary data bytes 00, 01,02 ‘Binary data bytes 00, 01,02 with No Stop ‘Tilde embedded in ASCII Printable characters ‘Carriage Return embedded in ASCII Printable characters Set I2C Bus Time-oUt in msec Set bus time-out in msec (0=disable) The iPort/AFM reports a bus time-out if no bus activity for the specified time occurs within an I2C Bus message.
Command: /X[S|~xx|R|r|P|0|1|?|D|d|C|c|L|A| |"]..., then Press Enter or ESCape Enter /X followed by zero or more sub-commands, the [CR] Response: /XCC(see commands below)[CR] High Level Sub-Commands: S = Send Start ~xx = Send Byte (xx = 00...
Mid Level Response: /XCC0000[CR] Low Level Command:/X dc dCcDCcdCcdCcDCcDCcDCcdCc DCAc dCcdCcdCcdCcdCcdCcdCcDCc DCAcdCcdCcdCcdCcdCcdCcDCcdCc DCAc dCcdCcdCcdCcdCcdCcdCcDCc DCAc dCD[CR] Low Level Response: /XCC0000[CR] Master read three bytes from slave address 0x4F. First two bytes are acknowledged by master. Command: /X S ~4f Rrr P [CR] Response: /XCCA~xx~xx~xx[CR] ‘(xx = 00...FF) Master transmit a Write WCR command to a Xicor X9241 at slave address 0x50. WCR data is 0x00.
Display Tx bYte Count (requires V2.00+) Returns the number of bytes received by the slave device in the last master transmit message. Command: /Y[CR] Response: /TBCn[CR] 'Tx bYte Count 'n =00000...
Asynchronous Interface Events Asynchronous Events are those iPort/AFM interface activities initiated by the iPort/AFM I2C Host Adapter in response to activities on the I2C Bus. Slave Transmit Request This event is caused by the reception of an I2C Bus Slave Transmit message directed at the current iPort/AFM’s own Slave address. Prompt: /STR[CR] Command: /Stext[CR] ‘Slave Transmit Request ‘Slave Transmit Text The normal Host computer response is to send a Slave Transmit Text (/Stext[CR]) command.
The received text is a representation of the data bytes within the Slave Receive message. The format of this data is controlled by the current setting of the Hex Only Display Control . Prompt: /GRCtext[CR] Command: ‘General Call Receive Complete None Required I2C Bus Time-out Detected Prompt: /I85[CR] I2C Bus Time-out Detected Cause: iPort/AFM issues this response when an I2C Bus message lasts for more than 1 second. No corrective action is taken by iPort/AFM.
iPort/AFM Prompts iPort/AFM Prompts are messages generated by iPort/AFM in response to Host computer commands. iPort/AFM Ready Prompt: * ‘iPort/AFM Ready Cause: iPort/AFM is ready for the next Host command. Slave Not Acknowledging Prompt: /SNA[CR] ‘Slave Not Acknowledging Cause: There is no response (I2C Slave Address Acknowledgment) during a Master Transmit or Receive operation from an I2C Slave device at the current Destination I2C Address.
iPort/AFM Connection Closed Prompt: /I88[CR] ‘iPort/AFM Connection is Closed. Cause: Host is attempting to perform an I2C Bus message operation while the iPort/AFM Connection is Closed. The Host should issue an Open I2C Connection command before attempting to perform I2C Bus message operations. Invalid Command Argument Prompt: /I89[CR] ‘Invalid Command Argument Detected Cause: This event normally indicates the value of a Host command argument was out of range.
Example Code The following examples are written in MS Visual Basic V3 for Windows using the serial communications control (MSCOMM.VBX). It can be used as a guide in implementing iPort/AFM interface programs in other programming languages and operating environments. Note: This example code is available online at: http://www.mcc-us.com/202ug.htm#ExampleCode. iPort/AFM Reset Comm1.Output = Chr$(18) Comm1.Output = Chr$(18) Comm1.Output = Chr$(18) iPort/AFM Initialization Comm1.Output = "/f0" Comm1.
If Msg$ = Chr$(13) Then Msg$ = "" If Msg$ = Chr$(10) Then Msg$ = "" If Msg$ = "*" Then Msg$ = "****" CharIn$ = Chr$(13) End If LineBuf$ = LineBuf$ + Msg$ ' Remove CR ' Remove LF ' if iPort/AFM Ready ‘ Substitute Token ‘ Terminate Line 'Add new text to line buffer If CharIn$ = Chr$(13) Then ' if Carriage Return detected iPortResp$ = Left$(LineBuf$, 4) 'Isolate Response Code ' Test for iPort/AFM Synchronous Interface Events If (StrComp(iPortResp$, "/OCC") = 0) Then ' Open Connection Complete Processing Text
ElseIf (StrComp(iPortResp$, "/BC2") = 0) Then ' iPort/AFM Baud Change 2 {115.2K} TextBox.Text = "iPort/AFM Baud Change 0 {115.2K} " ' Test for iPort/AFM Asynchronous Interface Events ElseIf (StrComp(iPortResp$, "/SRC") = 0) Then ' Slave Rx Complete Processing TextBox.Text = LineBuf$ 'Update Display ElseIf (StrComp(iPortResp$, "/GRC") = 0) Then ' General Call Rx Complete Processing TextBox.Text = LineBuf$ 'Update Display ElseIf (StrComp(iPortResp$, "/STR") = 0) Then ' Slave Tx Request Processing Comm1.
TextBox.Text = "/I83 Arbitration Loss" 'Update Display ElseIf (StrComp(iPortResp$, "/I84") = 0) Then TextBox.Text = "/I84 I2C Bus Error Detected" ElseIf (StrComp(iPortResp$, "/I85") = 0) Then TextBox.Text = "/I85 I2C Bus Time-out Detected" ElseIf (StrComp(iPortResp$, "/I88") = 0) Then TextBox.Text = "/I88 iPort/AFM Connection Closed" ElseIf (StrComp(iPortResp$, "/I89") = 0) Then TextBox.Text = "/I89 Invalid Command Argument" ElseIf (StrComp(iPortResp$, "/I8A") = 0) Then TextBox.
iPort/AFM Revision Report This section defines revisions and changes made to the iPort/AFM interface: Revision: 1.02 1. Initial Release Revision: 2.00 1. Add Firmware Version Command. 2. Add eXtended Commands. 3. Add Tx bYte Count Command. Additional Information For additional information on the I2C Bus, please refer to the following: “The I2C and How to Use It” http://www.mcc-us.com/i2chowto.htm "80C51-Based 8-Bit Microcontroller" Data Handbook. Philips Semiconductors, Tel.
Software License Agreement BY INSTALLING THIS SOFTWARE, YOU ARE AGREEING TO BECOME BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, PROMPTLY RETURN THE ENTIRE PRODUCT WITHIN 7 DAYS WITH ALL ITS CONTENTS TO THE PLACE OF PURCHASE, WITH A NOTE THAT YOU RETAIN NO COPIES OF THE SOFTWARE OR PRINTED MATERIALS, FOR A FULL REFUND. The computer files and materials supplied in this package are non-exclusively licensed to Purchasers of the MCC iPort I2C Host Adapter.
implied, included but not limited to the implied warranties of merchantability and fitness for a particular purpose. The Purchaser assumes entire risk as it applies to the quality and performance of the Software. Should the Software prove defective, the Purchaser (and not MCC, authorized MCC distributors, or dealers) assume the entire cost of all necessary servicing, repair or correction.
Appendix A Interface Connector and Plug Information MCC uses two (2) different connectors and plug assemblies. These parts are all compatible with one another and are interchangeable. Connectors Molex SEMCONN ACCESS.bus Receptacle Connector Molex Part # 15-83-0064 AMP SDL (Shielded Data Link) Connectors for ACCESS.bus AMP Part # 4-943197-1 Plugs Molex SEMCONN ACCESS.bus Plug Molex Part # 15-83-1564 AMP SDL (Shielded Data Link) Plug for ACCESS.