thankyou for sharing this me and a friend were just starting to work on this ourselves.
I have been reading a lot of posts about the Lilliput not being able to 'auto switch' even though it is in the secret menu, so I decided to make a small circuit that would switch the screen to Video1 when reverse is selected and back again when out of reverse. It uses a Pic microcontroller to do the job.
At the end of this post is the assembly code for the PIC16F690. I used MPLAB IDE to program my PIC.
The relays I used were small PCB mounted relays to make the circuit nice and small. Mine ended up in an enclosure about 50mm x 40mm x 30mm.
Here is a link to the 5 volt relay I used:
http://uk.farnell.com/jsp/search/pro...sp?SKU=1175716
The circuit diagram:
How it works:
When reverse gear is selected, the 12 volt relay is energised which in turn 'grounds' input RA2. The PIC then 'sees' this and pulses the 5 volt relay on for 0.5 seconds and the off again.
When you take the vehicle out of reverse, the PIC 'sees' RA2 go 'high' again and pulses the 5 volt relay once again.
After each relay pulse, the PIC waits for 3 seconds before it checks the input on RA2 again. This pause is needed, as if you select reverse and then back to drive again quickly, the Lilliput hasn't had time to settle on its new AV input, and it doesn't react to the relay pulse.
Also, when the circuit is first powered up (when the Lilliput has power), the PIC waits for 3 seconds to allow the Lilliput to start and before it starts reading the input on RA2. This is in case you are in reverse gear when the Lilliput is powered. After 3 seconds, it starts reading the input and if you are in reverse, it will obviously change the AV input.
Hope this is helpful.
The assembly code:
;-----------------------------------------------------------------------------------------------;
; Reversinmg camera controller ;
; ---------------------------- ;
; ;
; Author: Craig Smith ;
; Date: May 2009 ;
; ;
; 4MHz internal resonator used ;
; ;
; RA2 - input via 12 volt relay (high if not in reverse, low if in reverse) ;
; RC1 - output to turn on 5 volt relay to pulse the AV button on Lilliput ;
; ;
; ;
; When the circuit is energised, there is a 3 second time delay to allow the Lilliput screen ;
; to become 'active'. If RA2 is low, that means reverse is selected and the DebounceRev sub ;
; is called, if it is low for a 256 count we must be in reverse, so RC1 is pulsed on for 0.5 ;
; secs and then off. Video 1 should now be selected on the Lilliput. 3 second pause then.. ;
; Now we wait for the input to be high and do a debounce and if the input is hight for a 256 ;
; count we are out of reverse and the 5 volt relay is pulsed again for 0.5 secs and pause ;
; for 0.5 second to change the Lilliput back to PC mode. ;
; ;
; If the last change was 'reverse', the program loops around CheckDrive until the van is out ;
; of reverse and then it loops around CheckReverse until the van is in reverse..... ;
;-----------------------------------------------------------------------------------------------;
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
cblock 0x20
Delay1 ; delay loop 1
Delay2 ; delay loop 2
Delay3 ; delay loop 2
TimeDelay ; register used to set the time delay (x 0.01 secs)
Temp ; used to hold termory values
Count ; count register
endc
org 0
goto Start ; jump to Start
;-----------------------------------------------------------------------------------------------;
; Subroutines are here at the top ;
;-----------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------;
; The Delay routine is called with a number put into the TimeDelay register. This is in ;
; multiples of 0.01 seconds ;
;-----------------------------------------------------------------------------------------------;
Delay:
movfw TimeDelay ; put the TimeDelay into W
movwf Delay3 ; put W into Delay 3
Loop1: ; After Delay2 decreses to 0, it is reset to..
movlw 0x0E ; put E into W
movwf Delay2 ; put W into Delay2
Loop2: ; After Delay1 decreses to 0, it is reset to E9h
movlw 0xF0 ; put E9 into W
movwf Delay1 ; put W into Delay1
Loop3:
decfsz Delay1 ; decrement Delay1
goto Loop3 ; jump back to Loop3
decfsz Delay2 ; decrement Delay2
goto Loop2 ; jump back to Loop2
decfsz Delay3 ; decrement Delay3
goto Loop1 ; jump back to Loop1
return
;-----------------------------------------------------------------------------------------------;
; Change State pulses the relay for 0.25 seconds and then waits for 1 second ;
;-----------------------------------------------------------------------------------------------;
ChangeState:
bsf PORTC,1 ; set RC1 to 1
movlw 0x32
movwf TimeDelay
call Delay ; 0.5 sec delay
bcf PORTC,1 ; set RC1 to 0
movlw 0xC4
movwf TimeDelay
call Delay ; 2 sec delay
movlw 0x64
movwf TimeDelay
call Delay ; 1 sec delay
return
;-----------------------------------------------------------------------------------------------;
; Main program starts here ;
;-----------------------------------------------------------------------------------------------;
Start:
bsf STATUS,RP0 ; select register page 1
movlw b'00000000' ; put 00100000 in W register
movwf TRISC ; portC all outputs
movlw b'11111111' ; put 11111111 in W
movwf TRISA ; PORTA all inputs
bsf STATUS,RP1 ; select Page 2,
bcf STATUS,RP0 ; by setting RP1 in Status register and clearing RP0
clrf ANSEL ; select Digital I/O on port C
clrf ANSELH ; " "
bcf STATUS,RP1 ; back to Register Page 0
clrf PORTA ; clear PORTA
clrf PORTC ; clear portC
StartDelay: ; 2 second delay
movlw 0xC8 ; put C8 (200) into W
movwf TimeDelay ; put W into TimeDelay
call Delay
; 1 second delay
movlw 0x64 ; put C8 (200) into W
movwf TimeDelay ; put W into TimeDelay
call Delay
CheckReverse:
btfss PORTA,2 ; see if we are in reverse
goto Reverse ; Reverse
goto CheckReverse
CheckDrive:
btfsc PORTA,2 ; see if we are in drive
goto Drive ; Drive
goto CheckDrive
Reverse:
call ChangeState ; call the change state relay sub
goto CheckDrive
Drive:
call ChangeState ; call the change state relay sub
goto CheckReverse
end
Sorry the code is so jumbled, but the forum doesn't like tabs in the text![]()
ViVE - Volkswagen In Van Entertainment:
VoomPC 2, VIA C7 2GHz
7" Lilliput
120Gb Sata drive
1GB RAM
[||||||||||] 100% - Planning
[||||||||||] 100% - Software coding
[||||||||||] 100% - Built
(Always tweaking!)
thankyou for sharing this me and a friend were just starting to work on this ourselves.
Thanks for sharing your work.A quick question ,would it be a simple matter to have the circuit pulse twice when reverse is deselected,my monitor needs two presses to get back to vga.
I only need one pulse to change into reverse and out, because in the secret menu on the Lilliput I have deactivated VIDEO2.
Here is a slight update to my PIC code. The sub 'Drive'
Drive:
; 3 second delay, becaues when the car is taken
; out of reverse, the camera is de-powered, and
; the screen takes a few seconds to steady
; before we can switch
movlw 0xC4
movwf TimeDelay
call Delay ; 2 sec delay
movlw 0x64
movwf TimeDelay
call Delay ; 1 sec delay
call ChangeState ; call the change state relay sub
goto CheckReverse
I had the problem that when the van was taken out of reverse, obviously the camera is de-powered, and the Lilliput takes a couple of seconds to adjust to the 'no-input' before it can be switched.
This way of making the Lilliput auto-select may not be the best way of doing it, but it is all that I could come up with, and it seems to work OK.
ViVE - Volkswagen In Van Entertainment:
VoomPC 2, VIA C7 2GHz
7" Lilliput
120Gb Sata drive
1GB RAM
[||||||||||] 100% - Planning
[||||||||||] 100% - Software coding
[||||||||||] 100% - Built
(Always tweaking!)
this is exactly what i needed. can you tell me where to get the pic, and how to hook it up? programming the pic isn't a problem.
Hi,
This looks as something as I would like to implement into my car also. Just one question regarding the de-power issue, canīt you connect one of the inputs on the PIC to the reverselight and then power the camera from an additional output on the PIC? this way you donīt need to wait for the "No input" screen.
Probably would have been better, but I had a hard enough job getting the cables back to where the camera is, as the reversing camera was an afterthought, and I don't like continually taking all the ceiling panels and interior out of the van.... As you can see from the finished pictures of my van
Volkswagen Transporter T5 pimping!
ViVE - Volkswagen In Van Entertainment:
VoomPC 2, VIA C7 2GHz
7" Lilliput
120Gb Sata drive
1GB RAM
[||||||||||] 100% - Planning
[||||||||||] 100% - Software coding
[||||||||||] 100% - Built
(Always tweaking!)
But maybe you could make the software in the PIC support in/out for reverse/camera![]()
How do you get to the secret menu of the lilliput to deactivate video2. I dont have the button board for my lilliput. Would anyone know where to solder gor the av select button. On the board solder would be fine, or splicing into the button board connecting cable would be better. Also Tom, if what your suggesting works, would there be a change in his code and how to wire it.
Bookmarks