comparison code_part1/OSTC_code_asm_part1/dump_screen.asm @ 330:447390289f47 ScreenDump

NEW screen_dump serial command (l)
author JeanDo
date Tue, 10 May 2011 03:18:20 +0200
parents
children 469f4861c7c1
comparison
equal deleted inserted replaced
329:1adcfb4b4c27 330:447390289f47
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 -------------------
55 mullw 0 ; PRODH:L <- 0
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
79 movwf PRODH
80 dump_screen_1:
81 btg LED_red ; LEDactivity toggle
82
83 movlw .240 ; 240 lines
84 movwf PRODL
85
86 dump_screen_2:
87 setf TRISD ; PortD as input.
88
89 rcall PLED_DataRead ; read first pixel-low byte
90 movwf TXREG ; send
91 call rs232_wait_tx ; wait for UART
92
93 rcall PLED_DataRead ; read first pixel-high byte
94 movwf TXREG ; send
95 call rs232_wait_tx ; wait for UART
96
97 rcall PLED_DataRead ; read second pixel-low byte
98 movwf TXREG ; send
99 call rs232_wait_tx ; wait for UART
100
101 rcall PLED_DataRead ; read second pixel-high byte
102 movwf TXREG ; send
103 call rs232_wait_tx ; wait for UART
104
105 clrf TRISD ; Back to normal (PortD as output)
106
107 decfsz PRODL,F
108 bra dump_screen_2
109
110 AA_CMD_WRITE 0x22 ; Sync high/low byte, again.
111
112 decfsz PRODH,F
113 bra dump_screen_1
114
115 AA_CMD_WRITE 0x00 ; NOP, to stop Address Update Counter
116 return
117