Library used to interface to the 7-band Graphic Equalizer Chip MSGEQ7, made by company Mixed Signal Integration

Dependents:   MSGEQ7_Hello_World LCD_Spectrum_Analyzer 4180_Lab4 MSGEQ7_Hello_World ... more

Notebook page detailing chip interfacing and library usage

The MSGEQ7 Library API

The MSGEQ7 library is very simple to use. In the class called 'MSGEQ7' there are 3 public functions and 2 arrays.

Descriptions of functions: MSGEQ7(PinName reset, PinName strobe, PinName analog) - Creates a MSGEQ7, taking 3 pin arguments specifying which Mbed pins are connected to the chip's reset, strobe, and analog out lines.

void readByte() - Interfaces with the MSGEQ7 chip and reads out all 7 frequency data values and stores the values in the byte array (in the form of an array of unsigned chars) called freqDataByte, of length 7. Each value stored ranges from 0 to 255, with 255 representing the maximum sound magnitude the MSGEQ7 chip can detect at that frequency.

void readInt(int max) - Interfaces with the MSGEQ7 chip and reads out all 7 frequency data values and stores the values in the integer array called freqDataInt, of length 7. Each reading will be scaled so that the stored data ranges from 0 to value 'max' specified by the user. This 'max' variable allows the user to scale the output of the chip to a useful range.

The user chooses between readByte() and readInt(int max) based on what form they want the data returned to them in. The user needs only to call one of those functions, not both.

Once the function readByte() or readInt(int max) has been executed, the frequency data from the MSGEQ7 chip is stored in a certain array, depending on which function was called.

readByte() stores data in freqDataByte[7], and readInt(int max) stores data in freqDataInt[7]. Both arrays are available as public data arrays in the MSGEQ7 class. For both arrays, the data at index = 0 is the value at frequency = 63Hz, and the data at the last position, index = 6 is the value at frequency = 16kHz.

See example program MSGEQ7_Hello_World for an example of basic API usage.


Example Programs

Import programMSGEQ7_Hello_World

Demonstration of MSGEQ7 library interfacing with MSGEQ7 7-band Graphic Equalizer Chip made by Mixed Signal Integration.

Import programLCD_Spectrum_Analyzer

This program gets 7-band frequency data from the MSGEQ7 library and displays a 7-band, 2-row bar graph on an LCD display using custom characters.

Committer:
chrisisthefish
Date:
Wed Oct 16 06:33:29 2013 +0000
Revision:
0:974a4855a7f8
Created MSGEQ7 Library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chrisisthefish 0:974a4855a7f8 1 /*
chrisisthefish 0:974a4855a7f8 2 MSGEQ7 Library for interfacing to the MSGEQ7 Seven Band Grapic Equalizer chip made by Mixed Signal Integration
chrisisthefish 0:974a4855a7f8 3
chrisisthefish 0:974a4855a7f8 4 Chris Wilson
chrisisthefish 0:974a4855a7f8 5 twilson8@gatech.edu
chrisisthefish 0:974a4855a7f8 6 10/16/2013
chrisisthefish 0:974a4855a7f8 7 */
chrisisthefish 0:974a4855a7f8 8
chrisisthefish 0:974a4855a7f8 9 #ifndef MBED_MSGEQ7_H
chrisisthefish 0:974a4855a7f8 10 #define MBED_MSGEQ7_H
chrisisthefish 0:974a4855a7f8 11
chrisisthefish 0:974a4855a7f8 12 #include "mbed.h"
chrisisthefish 0:974a4855a7f8 13
chrisisthefish 0:974a4855a7f8 14 class MSGEQ7 {
chrisisthefish 0:974a4855a7f8 15 public:
chrisisthefish 0:974a4855a7f8 16 MSGEQ7(PinName reset, PinName strobe, PinName analog);
chrisisthefish 0:974a4855a7f8 17 void readByte();
chrisisthefish 0:974a4855a7f8 18 void readInt(int max);
chrisisthefish 0:974a4855a7f8 19 unsigned char freqDataByte[7]; //Byte array to store frequency data
chrisisthefish 0:974a4855a7f8 20 int freqDataInt[7]; //Int array for storing frequency data
chrisisthefish 0:974a4855a7f8 21
chrisisthefish 0:974a4855a7f8 22 private:
chrisisthefish 0:974a4855a7f8 23 DigitalOut _reset; //Reset line
chrisisthefish 0:974a4855a7f8 24 DigitalOut _strobe; //Strobe line
chrisisthefish 0:974a4855a7f8 25 AnalogIn _analog; //Analog input from chip
chrisisthefish 0:974a4855a7f8 26
chrisisthefish 0:974a4855a7f8 27 float read();
chrisisthefish 0:974a4855a7f8 28 };
chrisisthefish 0:974a4855a7f8 29
chrisisthefish 0:974a4855a7f8 30 #endif