Wired remote for Alpine


Closed Thread
Results 1 to 39 of 39

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,627


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    Hi,

    Here's an idea:
    Code:
    '****************************************************************
    '*  Name    : Fratello_Alpine.PBP                               *
    '*  Author  : Henrik Olsson                                     *
    '*  Notice  :                                                   *
    '*          :                                                   *
    '*  Date    : 2012-01-31                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    
    ' CONFIGs and hardware setup, ADCON, CMCON, TRIS whatever not shown here.
    
    '------------------------------------------------------------------------
    StartH CON %11010111        ' High 8 bits of start frame
    StartM CON %11011011        ' Middle 8 nits of start frame
    StartL CON %10101011        ' Low 8 bits of start frame
    '------------------------------------------------------------------------
    VolUpH CON %11011011        ' High 8 bits of command
    VolUpM CON %11010110        ' Middle 8 nits of command
    VolUpL CON %11010101        ' Low bit of command + 7bits END of frame
    '------------------------------------------------------------------------
    VolDnH CON %01101101        ' High 8 bits of command
    VolDnM CON %11110110        ' Middle 8 nits of command
    VolDnL CON %11010101        ' Low bit of command + 7bits END of frame 
    '------------------------------------------------------------------------
    ByteArray VAR BYTE[6]       ' 6 bytes = 48bits
    BitCount  VAR BYTE          ' Index variable for above array
    i         VAR BYTE          ' General purpose
    '------------------------------------------------------------------------
    ' Initialise the first three bytes of the array, these are static.
    ByteArray[0] = StartH 
    ByteArray[1] = StartM
    ByteArray[2] = StartL
        
    Pause 1000
    HSEROUT["Program start",13]
    
    
    Main:
        For i = 0 to 20
            GOSUB VolumeUp
            Pause 300
        NEXT
        
        FOR i = 0 TO 20
            GOSUB VolumeDn
            Pause 300
        NEXT
        
        Goto Main
        
    END
    '------------------------------------------------------------------------
    
    '------------------------------------------------------------------------
    ' Subroutines follows:
    '------------------------------------------------------------------------    
    VolumeUp:
        ' Set non static part of array to current command.
        ByteArray[3] = VolUpH
        ByteArray[4] = VolUpM
        ByteArray[5] = VolUpL
        GOSUB SendIt
    RETURN
    '------------------------------------------------------------------------
    VolumeDn:
        ByteArray[3] = VolDnH
        ByteArray[4] = VolDnM
        ByteArray[5] = VolDnL
        GOSUB SendIt
    RETURN
    '------------------------------------------------------------------------   
    SendIt:
        FOR BitCount = 0 to 47
            If ByteArray.0[BitCount] = 1 THEN
                GOSUB One
            ELSE
                GOSUB Zero
            ENDIF
        NEXT
    RETURN
    '------------------------------------------------------------------------
    One:
        PORTB.7 = 1
        PAUSEUS 500
        PORTB.7 = 0
        PAUSEUS 500
    RETURN
    '------------------------------------------------------------------------
    Zero:
        PortB.7 = 0
        PAUSEUS 1000
    RETURN
    /Henrik.

  2. #2
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    WOW !!! What fast and GREAT answer !!!
    Thank YOU so much ! I will try this and post feed-back !

  3. #3
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    One little queries : In "SendIt:" which is the command to send (to portb.7) the data from ByteArray[n] (n=3;4;5) ? I miss something ? Thanks !

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,627


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    Hi,
    Not sure I understand what you mean....
    Send it iterates thru the bytearray bit by bit. For each bit it GOSUBS either One or Zero based on if the bit is 1 or 0. It's in the routines One and Zero that the actual port is written.

    With that said, the code is untested so I may have missed something.

  5. #5
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    I understand...Thanks !
    Next step : need confirmation if works correct (just VolumeUp & VolumeDn at this moment) !
    In attach : code and Proteus simulation.
    Attached Images Attached Images  
    Attached Files Attached Files

  6. #6
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    Please, take a look at this two pictures ..."original" vs. testing ...
    In "our" case, after commander begins ("an 8ms pulse at +5V and then 4.5ms at 0V"), we have 11101011110...instead 1101011111 ...
    Attached Images Attached Images   
    Last edited by fratello; - 1st February 2012 at 13:35.

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