High End Pre with PIC 16F876A


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Apr 2008
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Attached is the PIC of populated Project PCB.
    I have decided to put the button at RB6 and debounce it, so that it could change between inputs.
    I have already posted the whole code along schematics.
    Appreciate if someone could suggest improvements in the code or better mark area where code should be changed.
    Attached Images Attached Images  

  2. #2
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Snippett of my own.

    I also use a 2803 for relay control but use a PGA2320 for volume control. This is very much a work in progress but here is a snippett of code I use to change inputs and outputs. My switches however are a webpage done with a Siteplayer.
    Code:
    switches:
          INTCON.7 = 0
          SerOut2 PORTC.6,SPbaud, [$00, $C7, $1E]       
          SerIn2 PORTC.7,SPbaud, 100, mainloop, [power,ipod,computer,mute,bookshelf,subwoofer,volup,voldown]'
          INTCON.7 = 1
          checkswitches = 0
          if power = 1 then 
               high relay6
               high relay5
               INTCON.7 = 0
               write 1, power
               INTCON.7 = 1
               gosub dostuff
               else 
               low relay6
               low relay5
               INTCON.7 = 0
               write 1, power
               INTCON.7 = 1
               endif
        return    
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
             'subroutine 
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    dostuff:
          mydata.0 = 0
          mydata.1 = ipod
          mydata.2 = computer
          mydata.3 = mute
          mydata.4 = bookshelf
          mydata.5 = subwoofer
          mydata.6 = volup
          mydata.7 = voldown
          select case mydata
                
                case 18
                     low relay1    'relays for speaker output
                     low relay2    'relays for speaker output
                     low relay7    'relays for Audio In
                     low relay8    'relays for Audio In
                
                case 20
                     low relay1   'relays for speaker output
                     low relay2   'relays for speaker output
                     high relay7    'relays for Audio In
                     high relay8    'relays for Audio In
                     
                
                case 34
                     high relay1    'relays for speaker output
                     high relay2    'relays for speaker output
                     low relay7   'relays for Audio In
                     low relay8   'relays for Audio In
                case 36
                     high relay1   'relays for speaker output
                     high relay2   'relays for speaker output
                     high relay7   'relays for Audio In
                     high relay8   'relays for Audio In
                case 82,84,98,100
                     volup = 0
                     INTCON.7 = 0
                     SerOut2 PORTC.6, 84, [$00,$81,$24,volup]
                     INTCON.7 = 1
                     gosub Increasegain
                     gosub Post_Gain
                     
                case 146,148,162,164         
                     voldown = 0
                     INTCON.7 = 0
                     SerOut2 PORTC.6, 84, [$00,$81,$25,voldown]
                     INTCON.7 = 1
                     gosub Decreasegain
                     gosub Post_Gain
                     
                end select
                INTCON.7 = 0
                write 2, ipod
                write 3, computer
                write 4, mute
                write 5, bookshelf
                write 6, subwoofer
                INTCON.7 = 1 
                return
    Done somewhat like yours. Hope this helps..
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

  3. #3
    Join Date
    Apr 2008
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Rojodu:
    Thanks man for the help I think this code sample will be all that i need.
    Here is my updated version of preamp I call it V1.3.
    I guess this code will be enough.
    Check_sel
    If sel=0 then debounce_sel
    return
    debounce_sel:
    pauseus 200
    If sel=0 then check_sel
    relay=realy+1
    if relay=4 the relay=0
    return
    Abidr
    Attached Files Attached Files
    Last edited by abidr; - 30th April 2008 at 08:17.

  4. #4
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Your welcome.

    Glad you found it helpfull. Check out this thread for more reading and some pictures of my PGA and amp setup.

    http://www.picbasic.co.uk/forum/showthread.php?t=7717
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

  5. #5
    Join Date
    Apr 2008
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Ok guys:
    Code completed sucessfuly, just needed a few tweaks here and there, it has compiled sucessfully and burnt to 16F876A well, now its testing (which I ll do over the weekend).
    Once completed I ll post my results here.
    Abidr

Similar Threads

  1. 16F883 and Problems with HIGH statement
    By aaanekre in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th October 2009, 01:09
  2. PIC keeps resetting when executing subroutine
    By jbirnsch in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 27th August 2009, 07:03
  3. Using Sleep
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th August 2008, 04:05
  4. need help simulating PS/2 mouse
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th December 2007, 21:49
  5. Pic suggestion for high precision voltage measure
    By d1camero in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 10th April 2004, 06:22

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