Close

PIC16F1455 Programming

A project log for LD320EUN 32" Display for RasPI

I salvaged a LD320EUN 32" Display without any connection. The Project : make it a display monitor

stanislas-bertrandStanislas Bertrand 08/09/2015 at 23:550 Comments

Before doing the programming of the onboard PIC microcontroller, I made a LaTeX documentation of my system so I can easily refer to it and update it as I code. I change some pin assignment due to the PIC IO limitation. The RA3 is an example, the pin is input only therefore I connected it to one of my push button. The USB PIC16F1455 Breakout Board was very useful to test and debug my programming prior flashing my TV.

Schematic

BreadBoard

System State Machine

In order to perform tests during my development, I setup a test bench with my BusPirateV4. I wrote a BASIC script to easily generate my test signals. With my test system behaving as I wanted, I flashed the onboard PIC. The display can now be turned On/Off, put into standby. The control of the 5V USB power regulator allow to power up the Raspberry PI. The USB power regulator will be turn off when no signal is detected from the HDMI and the USB serial connection is not active. The USB serial connection allow to control the screen from a terminal. The USB and Display output can be over-written. The LED is also controlled and dim via the serial.

10 PRINT "Setting IO ..."
11 LET D=255
13 PRINT "HDMI    <> MOSI"
14 LET D=D&254
15 PRINT "LCD PG  <> CLK"
16 LET D=D&253
17 PRINT "LCD PWR <> MISO"
18 PRINT "USB PWR <> CS"
19 PRINT "D=";
20 PRINT D
21 SEND D
22 PSU 1
23 PRINT "Done"

30 PRINT "Menu :"
31 PRINT "1-HDMI"
32 PRINT "2-LCD PG"
34 PRINT "3-END"
35 PRINT "4-Loop Test"

50 GOSUB 3000
51 LET H=(R&1)
52 LET P=(R&2)/2
53 LET L=(R&4)/4
54 LET U=(R&8)/8
55 PRINT "HDMI    : ";H;" LCD PG  : ";P
56 PRINT "LCD PWR : ";L;" USB PWR : ";U
57 INPUT "Select",S
58 IF S=1 THEN GOTO 200
59 IF S=2 THEN GOTO 300
61 IF S=3 THEN GOTO 1000
62 IF S=4 THEN GOTO 400
63 IF S=5 THEN GOTO 500
64 GOTO 30

200 PRINT "HDMI value"
201 GOSUB 2000
202 PRINT "HDMI Set to ";V
203 LET V=V&1
204 GOSUB 3000
205 LET R=R&254
206 LET R=R|V
207 PRINT R
208 SEND R
209 GOTO 50

300 PRINT "LCD PG value"
301 GOSUB 2000
302 PRINT "LCD PG Set to ";V
303 LET V=V&1
304 LET V=V*2
305 GOSUB 3000
306 LET R=R&253
307 LET R=R|V
308 PRINT R
309 SEND R
310 GOTO 50

400 PRINT "Test PG"
401	FOR B=1 TO 10
402 LET M=253
403 LET V=2
404 GOSUB 4000
405 PRINT B;"PG (1)"
406 DELAY 5000
407 LET M=253
408 LET V=0
409 GOSUB 4000
410 PRINT B;"PG (0)"
411 DELAY 2000
412 NEXT B
413 GOTO 50

500 PRINT "Test HDMI"
501	FOR B=1 TO 10
502 LET M=254
503 LET V=1
504 GOSUB 4000
505 PRINT B;"-HDMI (1)"
506 DELAY 5000
507 LET M=254
508 LET V=0
509 GOSUB 4000
510 PRINT B;"-HDMI (0)"
511 DELAY 2000
512 NEXT B
513 GOTO 50

1000 PRINT "All Off & Input"
1001 SEND 0
1002 SEND 255
1003 PSU 0
1004 END

2000 PRINT "1-ON"
2001 PRINT "0-OFF"
2002 INPUT "Value",V
2003 RETURN

3000 LET R=RECEIVE
3001 PRINT "R : ";R
3002 RETURN

4000 LET R=RECEIVE
4001 LET R=R&M
4002 LET R=R|V
4003 SEND R
4004 RETURN

Discussions