SUPER MICRO Computer MIIC-203 Example Code, IPort/AFM Initialization, Master Receive Message

Page 49

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)

'Ctrl/R

Comm1.Output = Chr$(18)

'Ctrl/R

Comm1.Output = Chr$(18)

'Ctrl/R

iPort/AFM Initialization

 

Comm1.Output = "/f0"

'Set iPort/AFM XON/XOFF Flow Control

Comm1.Output = Chr$(13)

 

Comm1.Output = "/i70"

'Set iPort/AFM’s Own Slave Address

Comm1.Output = Chr$(13)

 

Comm1.Output = "/d4e"

'Set Destination Slave Address

Comm1.Output = Chr$(13)

 

Comm1.Output = "/o"

'Open I2C Connection

Comm1.Output = Chr$(13)

 

Master Transmit Message

 

Comm1.Output = "/T~00~01"

'Send Master Tx Command

Comm1.Output = Chr$(13)

'Terminate Command

Master Receive Message

 

Comm1.Output = "/R10"

'Send Master Rx Command

Comm1.Output = Chr$(13)

'Terminate Command

Communication Event Processing

Static Sub Comm1_OnComm ()

Static LineBuf$

While Comm1.InBufferCount

Msg$ = Comm1.Input ' Get Comm input character

CharIn$ = Msg$

50

Image 49
Contents 479,12 Introduction Page Table of Contents Programmer’s Reference Ascii Command Interface Definitions Page Model MIIC-203 PartOverview RS-232 to I2C Host Adapter Ascii Fast Mode InterfaceSystem Requirements RS-232 Serial Port ConnectorInterconnects Packing SlipDB-25 Serial Port Pinout +5VDC Power JackINT, Interrupt Signal Control I2C Interface ConnectorConnecting to an SMBus System Connecting to a 3.3v SystemHardware Set-Up Pull-up ResistorsIPort Utility Pack for Windows Introduction to Utility Pack IPort Message CenterIPort Message Manager Software Installation Page I2C Message Operations Page Page Page Select iPort Device Starting the programEstablish iPort Link Basic Set-up Advanced Set-up Diagnostic Set-up iPort Only To Master Transmit Data Sending Messages Master OperationsTo Master Receive Data To Slave Transmit a message Uninstalling iPort Utility PackTo Slave Receive a message Programmer’s Reference IPort/AFM Quick Start Command Description IPort/AFM Ascii Text Interface CommandsSynchronous Interface Events IPort/AFM ResetRS-232 Baud Rate Status DisplaySet Destination I2C Slave Address Close I2C ConnectionEcho/Prompt Control Flow ControlHex Only Display Control I2C General Call ControlSet iPort/AFM’s Own I2C Slave Address Command Menu DisplayI2C Bus Clock Rate Control Open I2C Connection Interrupt Signal Control/StatusMaster Read Message Slave Transmit Message Master Transmit Message Set I2C Bus Time-oUt in msec EXtended Commands requires V2.00+Display Firmware Version requires V2.00+ Page Issue a Read WCR command to a Xicor X9241 at slave address Display Tx bYte Count requires V2.00+ Slave Transmit Request Asynchronous Interface EventsSlave Receive Complete General Call Receive CompleteINterrupt Signal Release INterrupt Signal AssertI2C Bus Time-out Detected IPort/AFM Prompts I2C Bus Error DetectedIPort/AFM Ready Slave Not AcknowledgingInvalid iPort/AFM Command Invalid Command ArgumentIPort/AFM Connection Closed Slave Transmit Request Not ActiveIPort/AFM Initialization Example CodeMaster Receive Message Communication Event ProcessingPage Page Page Revision IPort/AFM Revision ReportAdditional Information Micro Computer Control CorporationLife Support Applications Limited WarrantyLimitation of Remedies and Damages Appendix a