Wired remote for Alpine


Closed Thread
Results 1 to 39 of 39

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    Hi,
    Well, at 4Mhz each instruction cycle is 1us so the smallest time possible to resolve at that speed is just that - 1us. I don't think I can come up with any way to get higher resolution without increasing the oscillator speed.

    /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

    Understand... so, maybe, I need a 20 MHz oscillator speed.
    But first - hardware test ! Best regards !

  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

    Mr.Henrik wrote the code...me just put together parts...
    BUT : even if in Proteus the signal(s) appears to be OK, the HU-JVC don't react at all !
    Maybe the "timming" need to be more accurate ?! At this point, I'm hopeless and stuck ... Any help will be appreciated !
    Hex and dns attached...
    Code:
    ;***************************************************************************
    ;*
    ;*    Test variant, using 2N3904 on output - PORTC.0
    ;*
    ;***************************************************************************
    
    @ DEVICE PIC16F684, HS_OSC, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_OFF
    DEFINE OSC 20
    include "ALLDIGITAL.pbp"
    
    TRISA= 000011                           
    PORTA= 000011
    
    PORTC= 000000
                    
    CMCON0 = 000111              ' Disable analog comparators.     
    VRCON  = 000000               ' Disable Comparator Voltage Reference
    ANSEL  = 000000               ' Set pin'S to digital
    ADCON0 = 000000               ' Set up A/D converter - OFF 
    
    Pause 1000
    
    i VAR BYTE
    j VAR BYTE
    OutBuffer VAR BYTE[8]
    BitsToSend VAR BYTE
    
    
    Main:
    if porta.0 = 0 then gosub VolUp        ' just for test
    if porta.1 = 0 then gosub VolDn        ' just for test
    
    Pause 100                 ' do it for 0.1 sec
    Goto Main
    
    
    '-----------------------------------------------------------------------
    SendPreamble:        
    ; 01110111 01110111 01010101 11
        OutBuffer[0] = 010001 ; 101110 REVERSED BECAUSE OF USING TRANSISTOR AT OUTPUT !!!
        OutBuffer[1] = 010001 ; 101110
        OutBuffer[2] = 010101 ; 101010
        OutBuffer[3] = 111100 ; 000011
       
        BitsToSend = 26
        GOSUB SendBits
    RETURN
    '-----------------------------------------------------------------------
    AGC:
    TRISC.0 = 1 ; 0
    PauseUs 8584
    TRISC.0 = 0 ; 1
    PauseUs 4292
    RETURN
    '-----------------------------------------------------------------------
    SendPostAmble:
    ' 01111111 11111111 11111111 11111111 11110111 01110111 01110101 010111
        OutBuffer[0] = 000001 ; 111110
        OutBuffer[1] = 000000 ; 111111
        OutBuffer[2] = 000000 ; 111111
        OutBuffer[3] = 000000 ; 111111
        OutBuffer[4] = 110000 ; 001111
    
        
        BitsToSend = 36
        
        GOSUB SendBits
    RETURN
    '-----------------------------------------------------------------------
    SendFinalAmble:
    ' 01111111 11111111 11111111 11111111 11111111 11111111 11111111 111111
        OutBuffer[0] = 000001 ; 111110
        OutBuffer[1] = 000000 ; 111111
        OutBuffer[2] = 000000 ; 111111
        OutBuffer[3] = 000000 ; 111111
        OutBuffer[4] = 000000 ; 111111
        OutBuffer[5] = 000000 ; 111111
        OutBuffer[6] = 000000 ; 111111
        OutBuffer[7] = 000000 ; 111111
        
        BitsToSend = 54
        
        GOSUB SendBits
    RETURN
    '-----------------------------------------------------------------------
    VolUp:
        Gosub AGC
    ;==============================    
        GOSUB SendPreAmble    ; one
        ' Volume Up
        OutBuffer[0] = 010101 ; 101010
        OutBuffer[1] = 101010 ; 010101  
        OutBuffer[2] = 111110 ; 000001
        
        BitsToSend = 17
        GOSUB SendBits
        GOSUB SendPostAmble
    ;==============================    
        gosub SendPreamble    ; two
        ' Volume Up    
        OutBuffer[0] = 010101 ; 101010
        OutBuffer[1] = 101010 ; 010101  
        OutBuffer[2] = 111110 ; 000001
        
        BitsToSend = 17
        GOSUB SendBits   
        GOSUB SendPostAmble
    ;==============================    
        gosub sendPreamble    ; three
        ' Volume Up
        OutBuffer[0] = 010101 ; 101010
        OutBuffer[1] = 101010 ; 010101  
        OutBuffer[2] = 111110 ; 000001
        
        BitsToSend = 17
        GOSUB SendBits
        GOSUB SendFinalAmble    
    RETURN            ; end command
    '-----------------------------------------------------------------------
    
    VolDn:
        Gosub AGC
    ;==============================    
        GOSUB SendPreAmble
        ' 01111010 11110101 0101
        ' Volume Down
        OutBuffer[0] = 100001 ; 011110
        OutBuffer[1] = 010000 ; 101111
        OutBuffer[2] = 110101 ; 001010
        
        BitsToSend = 20
        GOSUB SendBits
        GOSUB SendPostAmble
    ;==============================
        GOSUB SendPreAmble
        ' 01111010 11110101 0101
        ' Volume Down
        OutBuffer[0] = 100001 ; 011110
        OutBuffer[1] = 010000 ; 101111
        OutBuffer[2] = 110101 ; 001010
        
        BitsToSend = 20
        GOSUB SendBits
        GOSUB SendPostAmble
    ;==============================
        GOSUB SendPreAmble
        ' 01111010 11110101 0101
        ' Volume Down
        OutBuffer[0] = 100001 ; 011110
        OutBuffer[1] = 010000 ; 101111
        OutBuffer[2] = 110101 ; 001010
        
        BitsToSend = 20
        GOSUB SendBits
        GOSUB SendFinalAmble    
    RETURN
    '-----------------------------------------------------------------------
    SendBits:
        BitsToSend = BitsToSend - 1
        For i = 0 to BitsToSend 
            TRISC.0 = OutBuffer.0[i]
            PauseUs 536
            @ nop
            @ nop  ; for 536.5 us
        NEXT
    RETURN
    '-----------------------------------------------------------------------
    END
    Attached Files Attached Files
    Last edited by fratello; - 23rd March 2012 at 14:01.

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


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    Hi,
    Like I said earlier, with this aproach you're going to get variation in the bit to bit timing when going from preamble to data to postamble etc. You should be able to SEE this on the scope. Also verify that you actually GET 536.4us between bits (I think it'll be a bit more due to the FOR-NEXT loop) and adjust the delay to match exactly.

    What I'd try, just to see IF timing is all there is to it is to stitch a complete packet together and send it in one go. Just extend the size of the array and load it up with bits, set BitsToSend accordingly and call SendBits.

    /Henrik.

  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

    You are such a fine gentleman !!! Thanks !
    ...so You say to put the entire command in "one place" ?

    OutBuffer[0] = ....
    to
    OutBuffer[n] = ....
    and
    BitsToSend = n x 8 GOSUB SendBits
    ?!
    I have some doubt about how I understand this :
    "You really shouldn't drive the output line at 5V or 3V or any other voltage for a high output. If you want the output to be high, you do that by turning off the PIC's output driver. This way it doesn't matter what voltage the head unit uses, your hardware will always be compatible. It'll work at 5V, 3.3V, or anything.
    To do that, search the PIC manual for "Open-drain".
    For the 16-bit PIC24F series, you configure the pins as open drain by setting the bits in the ODCx register to '1's BEFORE you configure the pin as an output by writing '0's to the TRISx register."
    It's ok what I wrote in code, ie how I use PortC and TrisC ?

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    Exactly, take the complete bitstream and fill the array with that, make sure you have the correct numbers of bits and then call SendBits. Because the actuall commads seem to be of different length the n*8 may not be true, make sure to count the actual number of bits in the packet.

    Regarding the other comment....It totaly depends on the actual hardware you're using but since you indicate that you're using a transistor between the PIC and the actual unit I think you need to DRIVE that transistor base high AND low, not float it by setting TRIS - again, depends on how your hardware is done.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    Since I have no results with this code, I made this "PICKit2 IR capture tool" , from here : PIC Kit 2 IR capture tool « Spiralbrain's Blog
    The signals captured with this tool are totally different !!! I build even an IR widget for analyzing the IR signal...My conclusions : my remote, JVC RM-RK252, send a different code than that presented till now in this topic......I post the picture of all my captures, using AND an IR_Widget with IR_Scope (yes, I build this one too !)
    So : this is how the volume_up signal is ! The red part (in pdf) it's the part common for all commands ; the black part is proper command.
    Can I use Mr.Henrik examples for writting the new code ?! I have some questions : 415, 560 and 1400 are values by itselfs ...How can I put them in code ? Using something like this : "Data 560, 1400 ( this in hex ?), 560,1400,560,415,560,415, so on, so on ...." ?
    Thanks in advance for support and I apologize for my ignorance ...
    Attached Images Attached Images   
    Attached Images Attached Images

Members who have read this thread : 1

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