256 steps to heaven...

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
I've finally managed to get it together. It tok me some years but here is a picture of my volume control for the Aleph P 1.7 :angel: :angel: :angel:



BR

/loovet
 

Attachments

  • 002.jpg
    002.jpg
    39.8 KB · Views: 2,254
Official Court Jester
Joined 2003
Paid Member
loovet said:
And here is the asambler code that I've used.

I have to say that I am not that much in to programing, but it works. The only problem I have recognised so far is that there is a "blip" when several relays are released at the same time.

besides solutions in code for bleeps,you can always put cap in parallel with each coil
 
Algar_emi said:
What processor did you used?

You may change the code to make sure that only one relay is changed state at one time.

What do you use for volume control? Do you have the schematic of the controller circuit?

Thanks...

SB

I used th PIC16F84!

I will change the code as soon as I have the rest up and running. But i have to figure out how:rolleyes:

The volume control is from the Aleph 1.7.

BR

/loovet
 
Official Court Jester
Joined 2003
Paid Member
loovet said:
Hi Zen Mod,

I’m on my way to get the rest together and might soon start to focus on the volume control and a solution for the bleeps.

With elco i asume you mean electrolytic, right? Any hint on the value of these?

And Zen Mod, it’s a nice avatar you’ve got, Hope you’ve read the book.

Thanks in advance

/loovet

elco - yup - electrolytic

say - that for usual 5-15mA coil 220uF is enough

book ........ not just once ......... even in 40. , that's one of books I read every 10-20 months ......
I like movie too - from which that pic is taken .....
 
try this with a Picaxe 28X on 8Mhz

; * Preamp input and volume controler for PICAXE 28X( 16F873A ) Stones 2007 *
; *********************************************************
; * Pin 1 Reset -| |- Pin 28 Vol Rly *
; * Pin 2 PWR switch -| |- Pin 27 Vol Rly *
; * Pin 3 Encoder switch -| |- Pin 26 Vol Rly *
; * Pin 4 Serial IR -| |- Pin 25 Vol Rly *
; * Pin 5 -| |- Pin 24 Vol Rly *
; * Pin 6 - Serial RXD -| |- Pin 23 Vol Rly *
; * Pin 7 - Serial TXD -| |- Pin 22 Vol Rly *
; * Pin 8 0v -| |- Pin 21 Vol Rly *
; * Pin 9 Xtal -| |- Pin 20 +V *
; * Pin 10 Xtal -| |- Pin 19 0v *
; * Pin 11 Encoder in -| |- Pin 18 amp input 3*
; * Pin 12 Encoder in -| |- Pin 17 amp input 2*
; * Pin 13 DIODE FROM 2,3&4 -| |- Pin 16 amp input 1*
; * Pin 14 PWR AMP TRIGGER -| |- Pin 15 amp PWR *
; *********************************************************

SYMBOL B12_SAVE_ADDRESS = 0
SYMBOL B11_SAVE_ADDRESS = 1
SYMBOL B10_SAVE_ADDRESS = 2
SYMBOL B7_SAVE_ADDRESS = 7
SYMBOL B3_SAVE_ADDRESS = 4
SYMBOL B5_SAVE_ADDRESS = 5
SYMBOL B2_SAVE_ADDRESS = 6
READ B12_SAVE_ADDRESS,b12 ' Load b12 (w6) from EEPROM
READ B11_SAVE_ADDRESS,b11
READ B10_SAVE_ADDRESS,b10
READ B7_SAVE_ADDRESS,b7
READ B3_SAVE_ADDRESS,b3
READ B5_SAVE_ADDRESS,b5
SYMBOL snap = b1
SYMBOL in_select = b5
SYMBOL ser = b4
SYMBOL log = b3
SYMBOL mute = bit0
SYMBOL pwr = b2
SYMBOL mode = bit1
SYMBOL update = b8
SYMBOL Lcd_Mode = b6
SYMBOL input_0 = b11
SYMBOL input_1 = b10
SYMBOL input_2 = b7
SYMBOL counter = W6
LET dirsC = %11111000 'make port C > 2 outputs


; * To change the attenuation resolution hold input 3 High durning power up *
Startup:
LET ser = 21
LET PORTC = %00000000
pause 1000
LET PORTC = %00001000
PAUSE 600
LET PORTC = %00000000
PAUSE 4000
HIGH PORTC 3
IF input2 = 1 THEN
Lcd_Mode = log SERTXD ("L",44,#b12,44,#in_select,44,#Lcd_Mode,44)
PAUSE 2000 GOTO Direction
ELSE LET Lcd_Mode = 5
GOTO Main ENDIF
Again:
IF input0 = 1 AND input1 = 0 THEN
log = log max 3 + 1 GOTO Direction
ELSEIF input0 = 0 AND input1 = 1 THEN
log = log min 1 - 1 GOTO Direction
ELSEIF input2 = 0 THEN
SERTXD ("M",44,#5,44) pause 2000 WRITE B3_SAVE_ADDRESS,b3
GOTO Main ENDIF
GOTO Again
Direction:
pause 1000
SERTXD ("M",44,#log,44)
DO
IF input2 = 0 THEN
SERTXD ("M",44,#5,44) pause 4000 WRITE B3_SAVE_ADDRESS,b3 EXIT ENDIF
IF input0 = 1 AND input1 = 1 OR input0 = 0 AND input1 = 0 THEN GOTO Again
LOOP
; * Quadrature Decoder Using Finite State Machine *
; States are named as _<from>_<to>_<inc/dec>
;
; For example, when in state 00, and the new inputs are 01, the new
; state is _00_01. The inc/dec ( _i/_d ) is carried over from the
; previous direction the encoder was moving. In this example, 00 to
; 01 is always an increment - hence the new state is _00_01_i. If the
; new inputs had been 10 the new state it is always a decrement and
; the new state is _00_10_d. In the case of 00 to 11, whether it is
; an increment or a decrement depends upon whether we previously
; incremented or decremented. From _00_00_i it becomes _00_11_i, and
; from _00_d it becomes _00_11_d.
Main:
SELECT CASE in_select
CASE 0
LET PORTC = %00100000
CASE 1
LET PORTC = %01000000
CASE 2
LET PORTC = %10000000
ENDSELECT
SETINT %00000100,%00000100 ' input 3 now used for interrupt (mute)
LET counter = counter max 63 'turn on 25% volume limit
SERTXD ("L",44,#b12,44,#in_select,44,#6,44)
PAUSE 4000
LET pins = counter
snap = pins & 3
BRANCH snap,( _00_00_i , _01_01_i , _10_10_i , _11_11_i )
; * Moving CW *
SubUp:
IF log > 0 THEN
LET counter = counter + log
ELSEIF counter < 65 THEN
LET counter = counter + 1
ELSE LET counter = counter + 2
ENDIF
LET counter = counter max 255
LET pins = counter
LET update = update + 1
IF update > 1 then
SERTXD ("L",44,#b12,44,#in_select,44)

update = 0
ENDIF
RETURN
Sub_Up:
RETURN
_11_00_i:
GOSUB Sub_Up
_01_00_i:
GOSUB SubUp
_00_00_i:
snap = pins & 3
BRANCH snap,( _00_00_i , _00_01_d , _00_10_i , _00_11_i )
_10_01_i:
GOSUB Sub_Up
_11_01_i:
GOSUB SubUp
_01_01_i:
snap = pins & 3
BRANCH snap,( _01_00_i , _01_01_i , _01_10_i , _01_11_d )
_01_10_i:
GOSUB Sub_Up
_00_10_i:
GOSUB SubUp
_10_10_i:
snap = pins & 3
BRANCH snap,( _10_00_d , _10_01_i , _10_10_i , _10_11_i )
_00_11_i:
GOSUB Sub_Up
_10_11_i:
GOSUB SubUp
_11_11_i:
snap = pins & 3
BRANCH snap,( _11_00_i , _11_01_i , _11_10_d , _11_11_i )
; * Moving CCW *
SubDown:
IF log > 0 THEN
LET counter = counter min log - log
ELSEIF counter < 68 THEN
LET counter = counter min 1 - 1
ELSEIF counter < 256 THEN
LET counter = counter - 2 ENDIF
LET pins = counter
LET update = update + 1
IF update > 1 then
SERTXD ("L",44,#b12,44,#in_select,44)

update = 0
ENDIF
RETURN
Sub_Down:
RETURN
_11_00_d:
GOSUB Sub_Down
_10_00_d:
GOSUB SubDown
_00_00_d:
snap = pins & 3
BRANCH snap,( _00_00_d , _00_01_d , _00_10_i , _00_11_d )
_10_01_d:
GOSUB Sub_Down
_00_01_d:
GOSUB SubDown
_01_01_d:
snap = pins & 3
BRANCH snap,( _01_00_i , _01_01_d , _01_10_d , _01_11_d )
_01_10_d:
GOSUB Sub_Down
_11_10_d:
GOSUB SubDown
_10_10_d:
snap = pins & 3
BRANCH snap,( _10_00_d , _10_01_d , _10_10_d , _10_11_i )
_00_11_d:
GOSUB Sub_Down
_01_11_d:
GOSUB SubDown
_11_11_d:
snap = pins & 3
BRANCH snap,( _11_00_d , _11_01_i , _11_10_d , _11_11_d )
; *****************************************************************************
Sub_Save:
WRITE B12_SAVE_ADDRESS,b12 ' Put b12 (w6) to EEPROM 'pwr
WRITE B11_SAVE_ADDRESS,b11
WRITE B10_SAVE_ADDRESS,b10
WRITE B7_SAVE_ADDRESS,b7
WRITE B5_SAVE_ADDRESS,b5
WRITE B3_SAVE_ADDRESS,b3
LET pwr = 1
WRITE B2_SAVE_ADDRESS,b2
LET pins = 0
SELECT CASE in_select
CASE 0
LET PORTC = %00101000
PAUSE 600
LET PORTC = %00100000
PAUSE 1000
LET PORTC = %00110000
CASE 1
LET PORTC = %01001000
PAUSE 600
LET PORTC = %01000000
PAUSE 1000
LET PORTC = %01010000
CASE 2
LET PORTC = %10001000
PAUSE 600
LET PORTC = %10000000
PAUSE 1000
LET PORTC = %10010000
ENDSELECT
Sub_Off:
IF PORTA pin2 = 1 THEN RETURN ENDIF
IF PORTA pin0 = 1 THEN 'turn back on
SubOn:
SELECT CASE in_select
CASE 0
LET PORTC = %00100000
PAUSE 3000
LET PORTC = %00101000
PAUSE 600
LET PORTC = %00100000
CASE 1
LET PORTC = %01000000
PAUSE 3000
LET PORTC = %01001000
PAUSE 600
LET PORTC = %01000000
CASE 2
LET PORTC = %10000000
PAUSE 3000
LET PORTC = %10001000
PAUSE 600
LET PORTC = %10000000
ENDSELECT
LET counter = counter max 63 'turn on 25% volume limit
PAUSE 4000
SERTXD ("L",44,#b12,44,#in_select,44,#5,44)
LET pwr = 0
LET pins = counter RETURN ENDIF
GOTO Sub_Off
GoAgain:
SERTXD ("L",44,#b12,44,#in_select,44)
IF input0 = 1 AND input1 = 0 THEN
UP:
in_select = in_select max 1 + 1 let ser = 0 RETURN
ELSEIF input0 = 0 AND input1 = 1 THEN
DOWN:
in_select = in_select min 1 - 1 let ser = 0 RETURN
ELSEIF PORTA pin1 = 0 THEN RETURN ENDIF
GOTO GoAgain
Input_Select:
LET mute = 0
LET pins = 0
SELECT CASE in_select
CASE 0
LET input_0 = B12 'counter
CASE 1
LET input_1 = B12 'counter
CASE 2
LET input_2 = B12 'counter
ENDSELECT

IF SER = 16 THEN SERTXD ("L",44,#b12,44,#in_select,44) GOSUB UP ENDIF
IF SER = 17 THEN SERTXD ("L",44,#b12,44,#in_select,44) GOSUB DOWN ENDIF
PAUSE 200
SERTXD ("L",44,#b12,44,#in_select,44)
SELECT CASE in_select
CASE 0
LET counter = input_0 max 63
CASE 1
LET counter = input_1 max 63
CASE 2
LET counter = input_2 max 63
ENDSELECT
PAUSE 200
SERTXD ("L",44,#b12,44,#in_select,44)
DO
IF input0 = 1 AND input1 = 1 OR input0 = 0 AND input1 = 0 THEN GOSUB GoAgain
IF SER = 16 THEN SERTXD ("L",44,#b12,44,#in_select,44) GOSUB UP endif
IF SER = 17 THEN SERTXD ("L",44,#b12,44,#in_select,44) GOSUB DOWN endif
SELECT CASE in_select
CASE 0
LET counter = input_0 max 63
CASE 1
LET counter = input_1 max 63
CASE 2
LET counter = input_2 max 63
ENDSELECT
PAUSE 200
SERTXD ("L",44,#b12,44,#in_select,44)

LOOP WHILE input2 = 1 or ser > 15
RETURN
Ir:
SERIN 2,N1200,ser ' recieve serial data from IR chip
IF ser = 18 THEN GOSUB SubUp '+v
IF ser = 19 THEN GOSUB SubDown '-v
IF ser = 16 THEN GOSUB Input_Select
IF ser = 17 THEN GOSUB Input_Select

IF ser = 20 THEN LET pins = 0 PAUSE 30 SERTXD ("L",44,#0,44,#3,44) PAUSE 3000
LET counter = counter max 63 ENDIF'turn on 25% volume limit

IF ser = 21 AND pwr = 0 THEN ' IF power is on then save var's and turn off (loop until on)
GOSUB Sub_Save ENDIF

IF ser = 21 AND pwr = 1 THEN GOSUB SubOn' IF power is off

RETURN
Interrupt:
IF PORTA pin2 = 1 THEN GOSUB Ir
IF PORTA pin1 = 1 THEN
LET ser = 0 GOSUB Input_Select
ENDIF
IF PORTA pin0 = 1 AND SER = 21 THEN GOSUB Sub_Save
IF ser <> 20 then LET pins = counter ENDIF

SELECT CASE in_select
CASE 0
LET PORTC = %00100000
CASE 1
LET PORTC = %01000000
CASE 2
LET PORTC = %10000000
ENDSELECT

LET ser = 21
SETINT %00000100,%00000100
RETURN
 
Hi Loovet and others.

Have you considered how to implement a left/right balance control? I imagine a larger chip such as the 16F877 would be required to double the number of outputs to work each channel independently, but otherwise it should not be too difficult a task even for an old man like me.

What you have done looks so neat and "easy", and the code looks easy to read. I have been toying with making a volume control like that for a long time with a PIC controller, but have not proceeded because of my temptation to always make things too complicated, for example with a balance control and LCD display ... and I really would like a remote control. I wish that Russ White had gone down that path for his volume control.

Have you had any thoughts about planning a remote control? I have searched for information on how to make a remote control receiver (no luck at all on that so far.)

I have also tried to do the same for how to drive an LCD display (so that I know what my pre-amp is doing - even with something as simple as a L/R balance control). For this one, I have discovered a lot of information, but I cannot understand it as yet ... all very technical, you know.

With thanks,
George

P.S. Part of the problem may be that a lot of information is written in PIC Basic rather than assembler code (and the PIC Basic program would cost about 5 times more than all the parts for the controller). And the next part of the problem is a lot of the information is for Atmel microprocessors, and learning one set of controllers would be quite enough for my dwindling synapses.
 
GeorgeBoles said:
Hi Loovet and others.

Have you considered how to implement a left/right balance control? I imagine a larger chip such as the 16F877 would be required to double the number of outputs to work each channel independently, but otherwise it should not be too difficult a task even for an old man like me.
Never had any intrest for balance, but not hard to do.
GeorgeBoles said:
Hi Loovet and others.
What you have done looks so neat and "easy", and the code looks easy to read. I have been toying with making a volume control like that for a long time with a PIC controller, but have not proceeded because of my temptation to always make things too complicated, for example with a balance control and LCD display ... and I really would like a remote control. I wish that Russ White had gone down that path for his volume control.

Have you had any thoughts about planning a remote control? I have searched for information on how to make a remote control receiver (no luck at all on that so far.)
I have an 8pin picaxe chip sending (rs232 commands derived from Sony remote control) into the 28 pin chip.
GeorgeBoles said:
Hi Loovet and others.
I have also tried to do the same for how to drive an LCD display (so that I know what my pre-amp is doing - even with something as simple as a L/R balance control). For this one, I have discovered a lot of information, but I cannot understand it as yet ... all very technical, you know.
For LCD I have RS232 sent to an 18 pin picaxe that controls the LCD
GeorgeBoles said:
Hi Loovet and others.
P.S. Part of the problem may be that a lot of information is written in PIC Basic rather than assembler code (and the PIC Basic program would cost about 5 times more than all the parts for the controller). And the next part of the problem is a lot of the information is for Atmel microprocessors, and learning one set of controllers would be quite enough for my dwindling synapses.
Search for picaxe the chips are 5 - 10 times that of the Pic chips that they are based on (still not much to worry about for single chips) but the software is free.
Let me know if you need the remote and or LCD code.

P.S. There is last input and volume storage, last set volume stored for each input, Both with upper limit in code. Volume steps can be set as (for each state change) + -1, + -2. +-3, +-4 and +-1 to quarter then +-2 from there to max (255). Remote power switching for your amps
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.