Go Back   Home > Forums > Source & Line > Analog Line Level

Analog Line Level Preamplifiers , Passive Pre-amps, Crossovers, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 29th September 2010, 08:43 PM   #301
diyAudio Member
 
Join Date: Aug 2009
Location: Smederevo, Serbia
Quote:
Originally Posted by FarmTech View Post
more later
Kim
Kim, please, we are impatient, how long we have to wait?
  Reply With Quote
Old 29th September 2010, 09:25 PM   #302
diyAudio Member
 
FarmTech's Avatar
 
Join Date: Mar 2010
Location: Hjørring Denmark
Send a message via MSN to FarmTech Send a message via Skype™ to FarmTech
Hi dobrivoje,
Iam making test now so in the weekend I post the code for VU with RC5 special
Half-wave rectifier Schmatic
and the video (wma) VIDEO

Here is my Test code !!
Code:
'$sim
$regfile = "m32def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 30
$framesize = 34
Config Lcdpin = Pin , Db4 = Portc.5 , Db5 = Portc.4 , Db6 = Portc.3 , Db7 = Portc.2 , E = Portc.6 , Rs = Portc.7
Config Lcd = 16 * 2

Cursor Off
Cls

Config Timer1 = Timer , Prescale = 1024
Start Timer1
  Portd.3 = 0
  Input_pin Alias Pind.3                                    ' TSOP1736
  Config Timer0 = Timer , Prescale = 8
  On Timer0 Timer_irq
  Const Timeconst = 78
  Enable Timer0
  Disable Int1
  Enable Interrupts


  Const Samples_early = 8
  Const Samples_late = 12
  Const Samples_min = 3


  Dim Sample As Byte
  Dim Ir_lastsample As Byte
  Dim Ir_bittimer As Byte
  Dim Ir_data_tmp As Word
  Dim Ir_bitcount As Byte



Dim Address_rc5 As Byte , Command_rc5 As Byte , Rc5_flag As Bit

'vu bars
Deflcdchar 1 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16        ' replace ? with number (0-7)
Deflcdchar 2 , 24 , 24 , 24 , 24 , 24 , 24 , 24 , 24        ' replace ? with number (0-7)
Deflcdchar 3 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28        ' replace ? with number (0-7)
Deflcdchar 4 , 30 , 30 , 30 , 30 , 30 , 30 , 30 , 30        ' replace ? with number (0-7)
Deflcdchar 5 , 31 , 31 , 31 , 31 , 31 , 31 , 31 , 31        ' replace ? with number (0-7)
Deflcdchar 0 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32        ' replace ? with number (0-7)


Config Adc = Single , Prescaler = Auto , Reference = Internal       ' Avcc
Start Adc

Dim W As Word
Dim Left_vu As Word
Dim L1 As Word
Dim L2 As Byte
Dim L3 As Word
Dim Sel As Byte
Dim Right_vu As Word
Dim R1 As Word
Dim R2 As Single
Dim R3 As Word
Cursor Off
Dim Vol As Byte
Vol = 20
Sel = 1
Cls
Locate 1 , 1
Lcd Version(1)
Locate 2 , 1
Lcd "FarmTech 2010 VU"
Wait 2
Cls
Locate 1 , 1
Lcd "R"
Locate 2 , 1
Lcd "L"
Gosub Select_inp
Locate 2 , 10
Lcd "Vol " ; Vol
 Dim K As Word , K1 As Word
Do


If Rc5_flag = 1 Then

   Reset Rc5_flag
   Command_rc5 = Command_rc5 And &B01111111

   Locate 2 , 3
   Lcd "      "
   Locate 1 , 3
   Lcd "      "

   If Address_rc5 = 0 Then
   Locate 2 , 14
      If Command_rc5 = 16 Then
         Incr Vol                                           'vol+
         If Vol > 99 Then Vol = 99
         If Vol < 10 Then Lcd " "
         Lcd Vol
      End If
      If Command_rc5 = 17 Then
         Decr Vol                                           'vol-
         If Vol < 1 Then Vol = 1
         If Vol < 10 Then Lcd " "
         Lcd Vol
      End If

      If Command_rc5 = 32 Then                              'ch+
      Incr Sel
      Gosub Select_inp
      Waitms 200
      End If
      If Command_rc5 = 33 Then                              'ch-
         Decr Sel
      Gosub Select_inp
       Waitms 200
      End If

      Waitms 50
     Command_rc5 = 255
     Address_rc5 = 255
    End If
    Reset Rc5_flag
End If

  W = Timer1
If W => 20000 And W < 21000 Then
   Locate 1 , 1
   Lcd "R"
   Locate 2 , 1
   Lcd "L"
End If

If W => 29800 And Rc5_flag = 0 Then
   Stop Timer1
   Left_vu = Getadc(2)                                      ' left ch line in  via LM358
   Right_vu = Getadc(3)                                     '  Right ch line in via LM358

    Right_vu = Right_vu - 12  'some noice i have on the line
    Left_vu = Left_vu - 12                                  'some noice i have on the line
    If Right_vu > 1023 Then Right_vu = 0                    'if negativ value
    If Left_vu > 1023 Then Left_vu = 0                      'if negativ value

   Left_vu = Left_vu / 21                                   'temp div factor for adc in from lm358
   Right_vu = Right_vu / 21

   L2 = Left_vu
   R2 = Right_vu

   'Left

   If L2 = 0 Then
      Locate 2 , 3
      Lcd Chr(l3)
      Lcd "     "
   End If
   If L2 => 0 And L2 < 6 Then
      L3 = L2
      Locate 2 , 3
      Lcd Chr(l3)
      Locate 2 , 4
      Lcd "     "
   End If

   If L2 > 5 And L2 < 11 Then
       L3 = L2 - 5
      Locate 2 , 3
      Lcd Chr(5) ; Chr(l3)
      Locate 2 , 5
      Lcd "    "
   End If

   If L2 > 9 And L2 < 16 Then
      L3 = L2 - 10
      Locate 2 , 3
      Lcd Chr(5) ; Chr(5) ; Chr(l3)
      Locate 2 , 6
      Lcd "   "
   End If

   If L2 > 14 And L2 < 21 Then
       L3 = L2 - 15
      Locate 2 , 3
      Lcd Chr(5) ; Chr(5) ; Chr(5) ; Chr(l3)
      Locate 2 , 7
      Lcd "  "
   End If

   If L2 > 19 And L2 < 26 Then
      L3 = L2 - 20
      Locate 2 , 3
      Lcd Chr(5) ; Chr(5) ; Chr(5) ; Chr(5) ; Chr(l3)
      Locate 2 , 8
      Lcd " "
   End If

   If L2 > 24 And L2 < 31 Then
      L3 = L2 - 25
      Locate 2 , 3
      Lcd Chr(5) ; Chr(5) ; Chr(5) ; Chr(5) ; Chr(5) ; Chr(l3)
   End If

   '-------------------------------------------------------------
    'Right

   If R2 => 0 And R2 < 6 Then
      R3 = R2
      Locate 1 , 3
     Lcd Chr(r3)
      Locate 1 , 4
      Lcd "     "
   End If

   If R2 > 4 And R2 < 11 Then
   R3 = R2 - 5
      Locate 1 , 3
      Lcd Chr(5) ; Chr(r3)
      Locate 1 , 5
      Lcd "    "

   End If

   If R2 > 9 And R2 < 16 Then
      R3 = R2 - 10
      Locate 1 , 3
      Lcd Chr(5) ; Chr(5) ; Chr(r3)
      Locate 1 , 6
      Lcd "   "
   End If

   If R2 > 14 And R2 < 21 Then
      R3 = R2 - 15
      Locate 1 , 3
      Lcd Chr(5) ; Chr(5) ; Chr(5) ; Chr(r3)
      Locate 1 , 7
      Lcd "  "
   End If

   If R2 > 19 And R2 < 26 Then
      R3 = R2 - 20
      Locate 1 , 3
      Lcd Chr(5) ; Chr(5) ; Chr(5) ; Chr(5) ; Chr(r3)
      Locate 1 , 8
      Lcd " "

   End If
   If R2 > 24 And R2 < 31 Then
   R3 = R2 - 25
      Locate 1 , 3
      Lcd Chr(5) ; Chr(5) ; Chr(5) ; Chr(5) ; Chr(5) ; Chr(r3)

   End If

 End If

 Loop
 End


Select_inp:
 Locate 1 , 10
 If Sel > 6 Then Sel = 1
 If Sel = 0 Then Sel = 6
 If Sel = 1 Then Lcd "CD   "
 If Sel = 2 Then Lcd "Radio"
 If Sel = 3 Then Lcd "Tape "
 If Sel = 4 Then Lcd "Blu  "
 If Sel = 5 Then Lcd "Video"
 If Sel = 6 Then Lcd "DVD  "
 Return


'New RC5 code
Timer_irq:
  Timer0 = Timeconst
  Sample = Not Input_pin


  If Ir_bittimer < 255 Then Incr Ir_bittimer
  If Ir_lastsample <> Sample Then
  If Ir_bittimer <= Samples_min Then
     Ir_bitcount = 0
  Else
     If Ir_bittimer >= Samples_early Then
         If Ir_bittimer <= Samples_late Then
            Shift Ir_data_tmp , Left , 1
            Ir_data_tmp = Ir_data_tmp + Sample
            Incr Ir_bitcount
          Else
            Ir_bitcount = 1
            Ir_data_tmp = Sample
          End If
          Ir_bittimer = 0
       End If
     End If


     If Ir_bitcount = 1 Then Ir_bitcount = Ir_data_tmp.0
     If Ir_bitcount >= 14 Then
       Timer1 = 0
       Command_rc5 = Ir_data_tmp
       Shift Ir_data_tmp , Right , 6
       Address_rc5 = Ir_data_tmp And &B00011111
       Command_rc5.6 = Not Ir_data_tmp.6
       Command_rc5.7 = Ir_data_tmp.5
       Set Rc5_flag
       Ir_bitcount = 0
       Timer1 = 15000
       Start Timer1
     End If

  End If

  Ir_lastsample = Sample

Return

what software version do you use ?

Last edited by FarmTech; 29th September 2010 at 09:50 PM. Reason: Added Video and schmatic & test code
  Reply With Quote
Old 30th September 2010, 09:58 AM   #303
diyAudio Member
 
Join Date: Aug 2009
Location: Smederevo, Serbia
Quote:
Originally Posted by FarmTech View Post
Hi dobrivoje,
Iam making test now so in the weekend I post the code for VU with RC5 special

what software version do you use ?
OK, I can wait until weekend.

Actually, my 8515/PGA controller is not ready yet.
I've made mega16/R2R this spring, it works perfect.
Later on, Danzup kindly made change in firmware on my request, adding bar strip for volume, post #198. I made new, more compact PCB with thru hole components, but didn't finish yet, I had a lot obligations this summer. Danzup is still waiting to see result (sorry, Danzup).
Meanwhile, I started to play with 8515/PGA controller, PCB is still in computer, almost ready. I wanted to implement your firmware with learn RC5, post #277, but it is even better to add VU meter. That's why I'm impatient, I want to finish hardware. Also, I'm not good in programming, so I'm expecting you to finish firmware, my job is only to program 8515.

Greetings and keep on working.
  Reply With Quote
Old 30th September 2010, 11:17 AM   #304
diyAudio Member
 
FarmTech's Avatar
 
Join Date: Mar 2010
Location: Hjørring Denmark
Send a message via MSN to FarmTech Send a message via Skype™ to FarmTech
Hi,
M8515 dont have full adc (sorry), but M8535 M16 no peoblems
  Reply With Quote
Old 30th September 2010, 11:47 AM   #305
diyAudio Member
 
Join Date: Aug 2009
Location: Smederevo, Serbia
M8535, M16, M32, no problem. You do software, I can draw schematics, PCB, make prototype, of course with Danzup's blessing.
Unfortunately, I don't have much free time, it can last.
  Reply With Quote
Old 30th September 2010, 01:14 PM   #306
diyAudio Member
 
FarmTech's Avatar
 
Join Date: Mar 2010
Location: Hjørring Denmark
Send a message via MSN to FarmTech Send a message via Skype™ to FarmTech
Hi dobrivoje,

Thats is a good idea cuz Iam not strong in electronic & pcb

Danzup made a good program , its allways hard to get "the" Idea , but so easy just to copy other , I see if I get time to make the M8535 file with RC5 leran/ level meter this week end ,
think I´ll add a full wave rectifier and sample 128 times ,
this will never be a 100% thue VU meter but think its ok for show some kind of level on lcd

But I need some info on the version that is used cuz there are many here
diffrent lcd setup for M8535/8515 version (M8515 cant do the level meter)
I look at schematic and see ADC 6 , 7 is free on M16 version so this can be used

Just a short update on the meter In4148 is now BAT42 its better and only loos 200mV (1N4148 700mV)
Lm324 is better for full wave rectifier (4 opamps)
I will need 2 pr ch in full wave rectifier

Added the 128 sample to my test code and its smoot on lcd now , cant wait to try full wave rectifier ,

SYL8R / Kim
  Reply With Quote
Old 30th September 2010, 05:31 PM   #307
diyAudio Member
 
Join Date: Aug 2009
Location: Smederevo, Serbia
Hi Kim,
I think we made a deal. Just wait to see if Danzup agrees.
  Reply With Quote
Old 30th September 2010, 08:48 PM   #308
Leon08 is offline Leon08  Germany
Banned
 
Join Date: Sep 2010
Location: at Home
Quote:
Originally Posted by FarmTech View Post
Okay, Then you must see what lrc5ok do and make it in Sirc
its just a bit that is set if a correct Ir code is sent
I understand the basic Idea behind this lrc5ok variable, but why is this called lrc5ok in one place and rc5ok in another?

And if it's so easy then why don't you show me how to do this?
  Reply With Quote
Old 30th September 2010, 09:11 PM   #309
diyAudio Member
 
FarmTech's Avatar
 
Join Date: Mar 2010
Location: Hjørring Denmark
Send a message via MSN to FarmTech Send a message via Skype™ to FarmTech
lrc5ok is used in calculation (procedure get_rc5) only
rc5ok is same bit but when you call something you cant use same var_name

procedure eval_rc5 is
get_rc5 (address, command, toogle, rc5ok)

procedure get_rc5 (byte out laddress, byte out lcommand, bit out ltoogle, bit out lrc5ok)

I dont think I say its easy but I point to what you maybe must check is you dont like to set pin high via pullup res ,
  Reply With Quote
Old 1st October 2010, 07:28 PM   #310
Leon08 is offline Leon08  Germany
Banned
 
Join Date: Sep 2010
Location: at Home
Here is what I was able to to.What do you think about this? In simulator it works, but I did not test it on hardware.
Attached Files
File Type: zip preamp_mod4_1.zip (108.4 KB, 146 views)
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
source selector / volume hum in Aikido cbutterworth Tubes / Valves 1 28th March 2007 07:34 AM
Source for volume knobs? Alois Pass Labs 4 3rd July 2005 05:12 PM
IC Controlers for Class D Power stage frozenpod1 Class D 14 17th May 2005 03:25 PM
Swichable source and volume pot. Whats the best way? sounder Chip Amps 2 22nd September 2003 06:29 PM
detented volume pots... source? Mach_Y Parts 2 1st June 2003 05:23 PM


New To Site? Need Help?

All times are GMT. The time now is 02:26 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright ©1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2