Wired remote for Alpine


Closed Thread
Results 1 to 39 of 39

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    Still beta-testing ...
    I wonder...It's one way to obtain EXACTLY 536.5 us ?!?

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


    Did you find this post helpful? Yes | No

    Default Re: Wired remote for Alpine

    Depends.... What's you oscillator speed? At 20Mhz an instruction cycles is 200ns so, in theory, doing something like
    Code:
    PauseUs 536
    @ NOP
    @ NOP
    should get you pretty close (536.4us). If the timing is that critical then it's probably not going to work the way I wrote it since there will be "gaps" between the preamble, command, postamble etc. You'd need to build the complete message in a larger array and then send it but that gets a bit complicated due to the variation in length of the commands (they won't line up at even byte boundries).

    /Henrik.

  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

    Thank You for support !
    The oscillator is 4 MHz...

  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,
    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.

  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

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

  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

    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.

  7. #7
    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.

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