330
|
1 ;=============================================================================
|
|
2 ;
|
|
3 ; File dump_screen.asm
|
|
4 ;
|
|
5 ; Dump screen contains to the serial interface.
|
|
6 ;
|
|
7 ; This program is free software: you can redistribute it and/or modify
|
|
8 ; it under the terms of the GNU General Public License as published by
|
|
9 ; the Free Software Foundation, either version 3 of the License, or
|
|
10 ; (at your option) any later version.
|
|
11 ;
|
|
12 ; This program is distributed in the hope that it will be useful,
|
|
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 ; GNU General Public License for more details.
|
|
16 ;
|
|
17 ; You should have received a copy of the GNU General Public License
|
|
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19 ;
|
|
20 ; Copyright (c) 2011, JD Gascuel.
|
|
21 ;=============================================================================
|
|
22 ; HISTORY
|
|
23 ; 2011-05-08 : [jDG] Creation.
|
|
24 ;
|
|
25 ; BUGS :
|
|
26 ; * ...
|
|
27 ;=============================================================================
|
|
28
|
|
29 ; Manage interface to the OSTC platform:
|
|
30 dump_screen:
|
|
31 bcf uart_dump_screen ; clear flag!
|
|
32
|
|
33 movlw 'l'
|
|
34 movwf TXREG ; Send command echo.
|
|
35 bsf no_sensor_int ; No Sensor Interrupt
|
|
36 bcf PIE1,RCIE ; no interrupt for UART
|
|
37 bcf PIR1,RCIF ; clear flag
|
|
38 bsf LED_blue ; LEDusb ON
|
|
39 call rs232_wait_tx ; wait for UART
|
|
40
|
|
41 call dump_screen_0
|
|
42
|
|
43 bcf no_sensor_int ; Restore Sensor Interrupt
|
|
44 bcf LED_blue ; Clear led
|
|
45 bcf LED_red ; Clear led
|
|
46 bsf PIE1,RCIE ; Interrupt for RS232
|
|
47 return
|
|
48
|
|
49 ;=============================================================================
|
|
50 ; Dump screen contains to the UART
|
|
51
|
|
52 dump_screen_0:
|
|
53
|
|
54 ;---- Send OLED box command for the full screen window -------------------
|
331
|
55 mullw 0 ; PRODH:L <- 0
|
330
|
56
|
|
57 AA_CMD_WRITE 0x35 ; VerticalStartAddress HIGH:LOW
|
|
58 AA_DATA_WRITE_PROD ; 00:00
|
|
59
|
|
60 AA_CMD_WRITE 0x36 ; VerticalEndAddress HIGH:LOW
|
|
61 AA_DATA_WRITE 0x01
|
|
62 AA_DATA_WRITE 0x3F
|
|
63
|
|
64 AA_CMD_WRITE 0x37 ; HorizontalAddress START:END
|
|
65 AA_DATA_WRITE 0x00
|
|
66 AA_DATA_WRITE 0xEF
|
|
67
|
|
68 AA_CMD_WRITE 0x20 ; Start Address Horizontal (.0 - .239)
|
|
69 AA_DATA_WRITE_PROD ; 00:00
|
|
70
|
|
71 AA_CMD_WRITE 0x21 ; Start Address Vertical (.0 - .319)
|
|
72 AA_DATA_WRITE_PROD ; 00:00
|
|
73
|
|
74 AA_CMD_WRITE 0x22 ; Start reading.
|
|
75 rcall PLED_DataRead ; Dummy pixel to skip.
|
|
76 rcall PLED_DataRead ; Dummy pixel to skip.
|
|
77
|
|
78 movlw .160 ; 160x2 columns
|
331
|
79 movwf uart1_temp
|
330
|
80 dump_screen_1:
|
|
81 btg LED_red ; LEDactivity toggle
|
|
82
|
331
|
83 AA_CMD_WRITE 0x22 ; Re-sync data.
|
|
84
|
330
|
85 movlw .240 ; 240 lines
|
331
|
86 movwf uart2_temp
|
|
87
|
|
88 setf TRISD ; PortD as input.
|
|
89 clrf PORTD
|
330
|
90
|
|
91 dump_screen_2:
|
|
92
|
|
93 rcall PLED_DataRead ; read first pixel-low byte
|
|
94 movwf TXREG ; send
|
|
95 call rs232_wait_tx ; wait for UART
|
331
|
96
|
330
|
97 rcall PLED_DataRead ; read first pixel-high byte
|
|
98 movwf TXREG ; send
|
331
|
99 call rs232_wait_tx ; wait for UART
|
|
100
|
330
|
101 rcall PLED_DataRead ; read second pixel-low byte
|
|
102 movwf TXREG ; send
|
331
|
103 call rs232_wait_tx ; wait for UART
|
330
|
104
|
|
105 rcall PLED_DataRead ; read second pixel-high byte
|
|
106 movwf TXREG ; send
|
331
|
107 call rs232_wait_tx ; wait for UART
|
|
108
|
|
109
|
|
110 decfsz uart2_temp,F
|
|
111 bra dump_screen_2
|
330
|
112
|
|
113 clrf TRISD ; Back to normal (PortD as output)
|
|
114
|
331
|
115 decfsz uart1_temp,F
|
|
116 bra dump_screen_1
|
330
|
117
|
|
118 AA_CMD_WRITE 0x00 ; NOP, to stop Address Update Counter
|
|
119 return
|
|
120
|