Timing diagram for MSGEQ7 spectrum analyzer chip, is it correct?


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Grantwt's Avatar
    Grantwt Guest


    Did you find this post helpful? Yes | No

    Default Re: Timing diagram for MSGEQ7 spectrum analyzer chip, is it correct?

    From the datasheet the times stated are for the minimum times, therefore I went with 100uS not 18uS, also I used a FOR NEXT loop to keep the code short. I am using an 18F252 to read from the ADC and outputting onto a standard LCD, using two arrays of seven each in the code variables for the code setup:

    Code:
    'Port Definitions
    RESET  VAR PORTB.6
    STROBE VAR PORTB.7
    
    'Variables
    AD0  VAR WORD  ' A to D 1 variable holder
    AD1  VAR WORD  ' A to D 2 variable holder
    RD VAR WORD[7] ' Right ADC value
    LD VAR WORD[7] ' Left ADC value
    C  VAR WORD    ' Count variable holder
    
    TRISA = 1111            ' Set as outputs & inputs
    TRISB = 000000        ' Set as outputs
    LOW RESET 
    LOW STROBE     
    
    'Here is the working code:
    
    REM ============================== LCD Setup ===================================
    LCDOUT $FE,$40,$00,$00,$00,$00,$00,$00,$00,$1F ' Bar 1
    LCDOUT $FE,$48,$00,$00,$00,$00,$00,$00,$1F,$1F ' Bar 2
    LCDOUT $FE,$50,$00,$00,$00,$00,$00,$1F,$1F,$1F ' Bar 3
    LCDOUT $FE,$58,$00,$00,$00,$00,$1F,$1F,$1F,$1F ' Bar 4
    LCDOUT $FE,$60,$00,$00,$00,$1F,$1F,$1F,$1F,$1F ' Bar 5
    LCDOUT $FE,$68,$00,$00,$1F,$1F,$1F,$1F,$1F,$1F ' Bar 6
    LCDOUT $FE,$70,$00,$1F,$1F,$1F,$1F,$1F,$1F,$1F ' Bar 7
    LCDOUT $FE,$78,$0E,$0A,$0A,$0A,$0A,$0A,$0A,$0E ' Bar over
    LCDOUT 254,1                        ' Clear display 
    
    REM ============================== Main loop ===================================
    Main:
    GOSUB EQread
    GOSUB Display
    PAUSE 10
    GOTO Main
    
    REM ============================= MSGEQ7 code ==================================
    EQread:
    HIGH RESET   'Reset
    HIGH STROBE 
    PAUSEUS 100 
    LOW STROBE
    PAUSEUS 100
    LOW RESET
    HIGH STROBE
    PAUSEUS 100
    FOR C=0 TO 6  'Read
    LOW STROBE
    PAUSEUS 100
    ADCIN 0,AD0
    RD[C]=AD0
    ADCIN 1,AD1 
    LD[C]=AD1
    HIGH STROBE
    PAUSEUS 100
    NEXT C
    LOW STROBE 
    RETURN
    
    REM =============================== Display ====================================
    Display:
    FOR C=0 TO 6
    RD[C]=RD[C]/8192
    LD[C]=LD[C]/8192
    IF RD[C]=0 THEN
    RD[C]=$20
    ELSE
    RD[C]=RD[C]-1
    ENDIF
    IF LD[C]=0 THEN
    LD[C]=$20
    ELSE
    LD[C]=LD[C]-1
    ENDIF
    NEXT C      
    LCDOUT 254,129,LD[0],LD[1],LD[2],LD[3],LD[4],LD[5],LD[6]," ",RD[0],RD[1],RD[2],RD[3],RD[4],RD[5],RD[6]       ' Display output on line 1      
    RETURN
    END
    Last edited by Ioannis; - 21st November 2021 at 14:31.

  2. #2
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Timing diagram for MSGEQ7 spectrum analyzer chip, is it correct?

    Welcome to our community, Grant. Looks like you are familiar with PBP already. Thanks for sharing your work. For future posts, you can put code in a smaller window by using [ CODE ] at the beginning of your code (without the spaces) and at the end, add [ / CODE ] (again, without the spaces). It looks like this:
    Code:
    Some Variable = Some SFR Value

Similar Threads

  1. How to define OSC for vlaues below 1mhz? so you get the timing correct.
    By ofuzzy1 in forum FAQ - Frequently Asked Questions
    Replies: 1
    Last Post: - 3rd May 2011, 16:17
  2. Timing Diagram software suggestions?
    By PickyBiker in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 11th April 2010, 06:11
  3. Circuit Diagram Applications
    By -Dan- in forum General
    Replies: 5
    Last Post: - 11th April 2009, 06:32
  4. Circuit Diagram for interfacing AC to PIC IC?
    By wellyboot in forum Schematics
    Replies: 3
    Last Post: - 8th March 2008, 19:40
  5. Poor mans "semi" logic analyzer
    By anj in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st September 2004, 13:26

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts