Here I use an MSGEQ7 and a Futaba BJ044GK That are currently available on ebay.
Here is the link to purchase the tubes:
http://www.ebay.com/itm/Futaba-BJ044GK-VFD-Display-audio-level-indicator-tube-/261335425858?pt=LH_DefaultDomain_0&hash=item3cd8ce2342
The VFD Driver IC I use is an Allegro A6810SA, which is a 10-bit DIP HV Driver. Discontinued, you can find aftermarket supplies from china, Or use the current available MAX6921. You would only need 1 of these ICs, whereas I use 2.
Schematic is self-explanatory based on code, Also you may notice some variables/data that is orphaned, Well this is becuase I developed, debugged, and changed along the way. Feel free to clean it up, I'm too lazy.
[code:1:27d36c1fe2]
' * Title : Display.bas
' * Version : 1.0
' * Target : ATMega8
' * Author : Techknight
' * Program code : BASCOM AVR
' * Hardware req. : MSGEQ7 Spectrum IC.
' * Description : VFD VU Bargraph Driver for Futaba BJ044GK VFD Tube.
' *
' ***************************************************************************
$regfile = "m8def.dat" ' use the Mega8
$crystal = 18432000
$baud = 115200
Reset Watchdog
Config Watchdog = 1024
Stop Watchdog
'Serial Shift Register pinouts:
Config Portd = Output
Vfdio Alias Portd.2
Vfdclock Alias Portd.3
Vfdstrobe Alias Portd.4
Vfdblanking Alias Portd.5
Pw_led Alias Portd.6
'Define pins for MSGEQ7 Spectrum IC
Config Portb = Output
Strobe_pin Alias Portb.1 ' strobe is attached to Portb.1
Reset_pin Alias Portb.2 ' reset is attached to Portb.2
'ADC0 contains MSGEQ7 DC Level.
'BASCOM-AVR Doesnt reference True/False as a boolean argument. So we define it.
True Alias 1
False Alias 0
'Setup the LM9022/TD2822 Drive PWM.
'LM9022 is Obsolete now, Sad really. So i had to come up with my own intuitive way
'to handle Anode voltages, and the AC Drive for the filament.
Config Timer2 = Pwm , Prescale = 64 , Compare Pwm = Clear Up
Enable Timer2
On Ovf2 Scan
Ocr2 = 240 '50% Duty
Config Com1 = 115200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
'Setup the ADC
Config Adc = Single , Prescaler = Auto , Reference = Avcc 'config ADC
Start Adc
Dim A As Byte
Dim B As Byte
Dim C As Byte 'C Used in scan routine, Dont use elsewhere!
Dim I As Byte
Dim Temp As Byte 'Temp used by scanning routine. Dont use elsewhere!
Dim Temp2 As Word
Dim Temp3 As Word
Dim Bar As Byte
Dim Displaybuffer(7) As Word
Dim Scanbuffer(7) As Word
Dim Scancount As Byte
Dim Grids As Byte
Dim Datacomplete As Byte
Datacomplete = False
Start Watchdog
'=============================================================================================
'MAINLOOP
'Fetch MSGEQ7 data,.
Main:
'Setup MSGEQ7 for reading.
Set Reset_pin
Waitus 36
Set Strobe_pin
Reset Reset_pin
Waitus 17
Enable Interrupts
'Once reset into a known condition, the MSGEQ7 will auto-rotate between 1 through 7 on each strobe.
Do
Waitms 25
For I = 1 To 7 Step 1
Reset Strobe_pin
Waitus 18
Temp3 = Getadc(0)
Select Case Temp3
Case 0 To 56
Scanbuffer(i) = &B0000000000000000
Case 57 To 93
Scanbuffer(i) = &B0000000000000001
Case 94 To 186
Scanbuffer(i) = &B0000000000000011
Case 187 To 279
Scanbuffer(i) = &B0000000000000111
Case 280 To 372
Scanbuffer(i) = &B0000000000001111
Case 373 To 465
Scanbuffer(i) = &B0000000000011111
Case 466 To 558
Scanbuffer(i) = &B0000000000111111
Case 559 To 651
Scanbuffer(i) = &B0000000001111111
Case 652 To 744
Scanbuffer(i) = &B0000000011111111
Case 745 To 837
Scanbuffer(i) = &B0000000111111111
Case 838 To 930
Scanbuffer(i) = &B0000001111111111
Case 931 To 1023
Scanbuffer(i) = &B0000011111111111
Case Else
Scanbuffer(i) = &B0000011111111111
End Select
Waitus 18
Set Strobe_pin
Waitus 36
Next
Loop
'************************************************************************************************************
'SUBROUTINE
'Futaba VFD Time Division Multiplex (refresher/update)
Scan:
Stop Watchdog
Reset Vfdstrobe
Set Vfdblanking
Reset Vfdclock
If Scancount => 7 Then
Scancount = 1
Grids = &B00000010
Else
Incr Scancount
Shift Grids , Left
End If
'Turn on Frequency indicator icons.
Set Vfdio
Set Vfdclock
Reset Vfdclock
Set Vfdclock
Reset Vfdclock
'Now, lets shift out the 11 bits of Bargraph data for the currently active grid.
C = 0
Temp2 = Scanbuffer(scancount)
Do
Shift Temp2 , Left 'Throw away Most Significant 5 bits. Word is 16bits, Bardata is 11 bits
Incr C 'Piss it off the end of the shift register.
Loop Until C = 5
C = 0
Do
Reset Vfdio
Shift Temp2 , Left
A = Sreg And 1
If A = 1 Then
Set Vfdio
End If
Set Vfdclock
Reset Vfdclock
Incr C
Loop Until C = 11
'Shift out the current active grid element first.
Temp = Grids
C = 0
Do
Reset Vfdio
Shift Temp , Left
A = Sreg And 1
If A = 1 Then Set Vfdio
Set Vfdclock
Reset Vfdclock
Incr C
Loop Until C = 7
Set Vfdstrobe
nop
Reset Vfdstrobe
Reset Vfdblanking
Start Watchdog
Reset Watchdog
Return
'************************************************************************************************************
[/code:1:27d36c1fe2]
↧