CircuitGizmos

Electronic Products for Creative Minds

  • Home
  • Gizmo Store/Products
  • Documentation/Datasheets
  • Projects/Libraries
  • GizmoBlog
  • Services/Contact
    • Design
    • Contact Gizmo!
  • Your Gizmo Cart
    • Your Account
You are here: Home / Projects / ColorMax MMStick Projects / CGMMSTICK I2C Interface

CGMMSTICK I2C Interface

As an example of the operation if the I2C function of the CGMMSTICK, this example interfaces to a PCF8574A I/O expansion device.

PCF8574A I2C port expander circuit.

I/O Pins 12 and 13 are used for I2C, as described in the documentation.

The code used in this example assumes that the address pins (A0-A2) are all grounded, giving this chip an address (offset) of 0.

The example code runs a ‘cylon’ pattern on the LEDs.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
' Enable I2C
' speed = 100 kHz
' timeout = 100 milliseconds
I2CEN 100, 100
DO
 
  FOR loop1 = 0 TO 7
    cylon = 2^loop1
    cylon = (cylon XOR &hFF)
    ' Send I2C command to PCF8574A
    ' 8574A address = &h38
    ' send 1 byte
    I2CSEND &h38, 0, 1, cylon
    PAUSE 100
  NEXT loop1
  FOR loop2 = 6 TO 1 STEP -1
    cylon = 2^loop2
    cylon = (cylon XOR &hFF)
    ' Send I2C command to PCF8574A
    ' 8574A address = &h38
    ' send 1 byte
    I2CSEND &h38, 0, 1, cylon
    PAUSE 100
  NEXT loop2
LOOP
' Disable I2C
I2CDIS



Simplified schematic for general CGMMSTICK to PCG8574 interface. This example also includes the resistors and LEDs on the output lines as well as pull up resistors for the I2C lines.

Schematic including I2C pull up resistors and the resistor/LED combination for one of the eight I/O lines.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

A Ton of Documentation

Open all | Close all

Projects made by Gizmo, Friends, and Members

open all | close all

Recent GizmoBlog Musings

  • Altair 8800 using a ColorMax!
  • Re-energizing the ColorMax, Pt. 3

Visit us!

  • Facebook

Electronic Products for Creative Minds

CircuitGizmos is your source for electronic products that help you create your embedded projects. Here at CircuitGizmos.com you will find a friendly store filled with creative products and all of the documentation that you need to use these gizmos.

We create devices that we believe make electronics fun, but we also know that our products are used for professional designs. For decades we have designed products for commercial, military, and medical industries. Our gizmos here are great for engineers and hobbyists alike.

Copyright © 2008+ CircuitGizmos, L.L.C. All rights reserved

Image already added

Recently Viewed Products

Copyright © 2021 · Generate Pro Theme on Genesis Framework · WordPress · Log in