📄 plot.lst
字号:
1 .file "plot.c"
2 __SREG__ = 0x3f
3 __SP_H__ = 0x3e
4 __SP_L__ = 0x3d
5 __CCP__ = 0x34
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .global __do_copy_data
9 .global __do_clear_bss
11 .text
12 .Ltext0:
116 .global plot_test
118 plot_test:
1:io/plot.c **** /*
2:io/plot.c **** ,-----------------------------------------------------------------------------------------.
3:io/plot.c **** | io/plot
4:io/plot.c **** |-----------------------------------------------------------------------------------------
5:io/plot.c **** | this file implements a very basic bmp generator
6:io/plot.c **** | - plot temperature graph as a black and white BMP
7:io/plot.c **** |
8:io/plot.c **** | Author : Simon Schulz / avr{AT}auctionant.de
9:io/plot.c **** |
10:io/plot.c **** |
11:io/plot.c **** |
12:io/plot.c **** |-----------------------------------------------------------------------------------------
13:io/plot.c **** | License:
14:io/plot.c **** | This program is free software; you can redistribute it and/or modify it under
15:io/plot.c **** | the terms of the GNU General Public License as published by the Free Software
16:io/plot.c **** | Foundation; either version 2 of the License, or (at your option) any later
17:io/plot.c **** | version.
18:io/plot.c **** | This program is distributed in the hope that it will be useful, but
19:io/plot.c **** |
20:io/plot.c **** | WITHOUT ANY WARRANTY;
21:io/plot.c **** |
22:io/plot.c **** | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
23:io/plot.c **** | PURPOSE. See the GNU General Public License for more details.
24:io/plot.c **** |
25:io/plot.c **** | You should have received a copy of the GNU General Public License along with
26:io/plot.c **** | this program; if not, write to the Free Software Foundation, Inc., 51
27:io/plot.c **** | Franklin St, Fifth Floor, Boston, MA 02110, USA
28:io/plot.c **** |
29:io/plot.c **** | http://www.gnu.de/gpl-ger.html
30:io/plot.c **** `-----------------------------------------------------------------------------------------*/
31:io/plot.c **** #include "plot.h"
32:io/plot.c ****
33:io/plot.c **** //ACTIVATE DEBUG by editing this file:
34:io/plot.c **** #include "debug.h"
35:io/plot.c ****
36:io/plot.c **** #define PLOT_BMP_HEADER_LENGTH 62
37:io/plot.c **** //bmp data must be a multiple of 16 ?! -> maybe add padding !
38:io/plot.c **** #define PLOT_BMP_WIDTH 264
39:io/plot.c **** //264 pixel -> 33 byte ! must be divided by 4 -> use 36 byte -> use 288px !
40:io/plot.c **** #define PLOT_BMP_LINE_WIDTH 288
41:io/plot.c **** #define PLOT_BMP_HEIGHT 136
42:io/plot.c **** //288 -> 36 bytes -> 36/4 = 9 -> OK!
43:io/plot.c **** #define PLOT_BMP_FILESIZE (PLOT_BMP_LINE_WIDTH/8)*(PLOT_BMP_HEIGHT)+62
44:io/plot.c ****
45:io/plot.c **** PROGMEM unsigned char PLOT_BMP_HEAD [] = {
46:io/plot.c **** 0x42, 0x4D, 0x5E, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //10
47:io/plot.c **** 0x3E, 0x00, 0x00, 0x00, //first image data at pos 0x3E -> at byte 62
48:io/plot.c **** 0x28, 0x00, 0x00, 0x00, //header size (infoheader only!!) -> 40 bytes
49:io/plot.c **** lo8(PLOT_BMP_WIDTH), hi8(PLOT_BMP_WIDTH), 0x00, 0x00, //width <lo,hi,0,0>
50:io/plot.c **** lo8(PLOT_BMP_HEIGHT), hi8(PLOT_BMP_HEIGHT), 0x00, 0x00, //height <lo,hi,0,0>
51:io/plot.c **** 0x01, 0x00, //1color plane
52:io/plot.c **** 0x01, 0x00, //1bit
53:io/plot.c **** 0x00, 0x00, 0x00, 0x00, //no compression
54:io/plot.c **** lo8(PLOT_BMP_FILESIZE), hi8(PLOT_BMP_FILESIZE), 0x00, 0x00, //imagesize in bytes: -> 0x1320 = 4896
55:io/plot.c **** 0x10, 0x0B, 0x00, 0x00, //x pixels per meter
56:io/plot.c **** 0x10, 0x0B, 0x00, 0x00, //y pixels per meter
57:io/plot.c **** 0x02, 0x00, 0x00, 0x00, //2 colors (B/W)
58:io/plot.c **** 0x02, 0x00, 0x00, 0x00, //2 important colors
59:io/plot.c ****
60:io/plot.c **** 0xFF, //background B
61:io/plot.c **** 0xFF, //background G
62:io/plot.c **** 0xFF, //background R
63:io/plot.c **** 0x00,
64:io/plot.c **** 0xFF, //foreground B
65:io/plot.c **** 0x00, //foreground G
66:io/plot.c **** 0x00, //foreground R
67:io/plot.c **** 0x00 //62
68:io/plot.c **** };
69:io/plot.c ****
70:io/plot.c **** PROGMEM unsigned char PLOT_BMP_LEGEND[] = {
71:io/plot.c **** //0x00, 0x00, 0x00,
72:io/plot.c **** //0x00, 0x00, 0x01,
73:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
74:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
75:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
76:io/plot.c **** 0x00, 0x00, 0x01, 0x03, 0xC3, 0x81, 0x02, 0x04, 0x41, 0xE1, 0x04, 0x47,
77:io/plot.c **** 0x00, 0x84, 0x41, 0x00, 0x44, 0x41, 0x02, 0x46, 0x41, 0x01, 0x83, 0x81,
78:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
79:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
80:io/plot.c **** 0x01, 0xC3, 0x81, 0x00, 0x84, 0x41, 0x70, 0x84, 0x47, 0x00, 0x84, 0x41,
81:io/plot.c **** 0x00, 0x84, 0x41, 0x01, 0x86, 0x41, 0x00, 0x83, 0x81, 0x00, 0x00, 0x01,
82:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
83:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x03, 0x81,
84:io/plot.c **** 0x00, 0x04, 0x41, 0x00, 0x04, 0x47, 0x00, 0x04, 0x41, 0x00, 0x04, 0x41,
85:io/plot.c **** 0x00, 0x06, 0x41, 0x00, 0x03, 0x81, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
86:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
87:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0xC3, 0x81, 0x00, 0x84, 0x41,
88:io/plot.c **** 0x00, 0x84, 0x47, 0x00, 0x84, 0x41, 0x00, 0x84, 0x41, 0x01, 0x86, 0x41,
89:io/plot.c **** 0x00, 0x83, 0x81, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
90:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
91:io/plot.c **** 0x00, 0x00, 0x01, 0x03, 0xC3, 0x81, 0x02, 0x04, 0x41, 0x01, 0x04, 0x47,
92:io/plot.c **** 0x00, 0x84, 0x41, 0x00, 0x44, 0x41, 0x02, 0x46, 0x41, 0x01, 0x83, 0x81,
93:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
94:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
95:io/plot.c **** 0x03, 0x83, 0x81, 0x02, 0x44, 0x41, 0x00, 0x44, 0x47, 0x00, 0xC4, 0x41,
96:io/plot.c **** 0x01, 0x84, 0x41, 0x00, 0x46, 0x41, 0x03, 0x83, 0x81, 0x00, 0x00, 0x01,
97:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
98:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x43, 0x81,
99:io/plot.c **** 0x00, 0x44, 0x41, 0x03, 0xE4, 0x47, 0x01, 0x44, 0x41, 0x01, 0x44, 0x41,
100:io/plot.c **** 0x00, 0xC6, 0x41, 0x00, 0x43, 0x81, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
101:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
102:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x03, 0xC3, 0x81, 0x02, 0x64, 0x41,
103:io/plot.c **** 0x00, 0x24, 0x47, 0x02, 0x24, 0x41, 0x03, 0xC4, 0x41, 0x02, 0x06, 0x41,
104:io/plot.c **** 0x03, 0xC3, 0x81, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
105:io/plot.c **** 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x1C, 0x01, 0x00, 0x20, 0x01,
106:io/plot.c **** 0x00, 0x20, 0x01, 0x02, 0x10, 0x01, 0x05, 0x0C, 0x01, 0x02, 0x00, 0x01,
107:io/plot.c **** 0x00, 0x00, 0x01
108:io/plot.c **** };
109:io/plot.c ****
110:io/plot.c **** void plot_test(){
119 BB1
120 .LM0:
121 .LFBB1:
122 /* prologue: function */
123 /* frame size = 0 */
124 /* epilogue start */
111:io/plot.c **** t x=0; x<288; x++)
112:io/plot.c **** // eeprom_write_byte(&logger_temp_today[x], 130-x/4+80.0*sin((3.14*x)/30.0)/3.14);// 70+(x)%60);
113:io/plot.c **** //plot_generate_bmp(&temp[0]);
114:io/plot.c **** }
125 n 68,0,114,.LM1-.LFBB1
126 .LM1:
127 0000 0895 ret
129 .Lscope1:
136 .global plot_generate_bmp
138 plot_generate_bmp:
115:io/plot.c **** igned int plot_generate_bmp(unsigned char *buffer, unsigned int datapos, unsigned int len, unsigned
116:io/plot.c **** unsigned int x;
139 16,.LM2-.LFBB2
140 .LM2:
141 .LFBB2:
142 0002 2F92 push r2
143 0004 3F92 push r3
144 0006 4F92 push r4
145 0008 5F92 push r5
146 000a 6F92 push r6
147 000c 7F92 push r7
148 000e 8F92 push r8
149 0010 9F92 push r9
150 0012 AF92 push r10
151 0014 BF92 push r11
152 0016 CF92 push r12
153 0018 DF92 push r13
154 001a EF92 push r14
155 001c FF92 push r15
156 001e 0F93 push r16
157 0020 1F93 push r17
158 0022 DF93 push r29
159 0024 CF93 push r28
160 0026 00D0 rcall .
161 0028 00D0 rcall .
162 002a 00D0 rcall .
163 002c CDB7 in r28,__SP_L__
164 002e DEB7 in r29,__SP_H__
165 /* prologue: function */
166 /* frame size = 6 */
167 0030 3C01 movw r6,r24
168 0032 7A01 movw r14,r20
169 0034 202E mov r2,r16
171 .LM3:
172 0036 DC01 movw r26,r24
173 0038 A60F add r26,r22
174 003a B71F adc r27,r23
175 003c E0E0 ldi r30,lo8(PLOT_BMP_HEAD)
176 003e F0E0 ldi r31,hi8(PLOT_BMP_HEAD)
177 0040 00C0 rjmp .L4
178 .L6:
179 .LBB10:
117:io/plot.c **** nsigned char y;
118:io/plot.c **** unsigned char out;
119:io/plot.c **** unsigned char eedata;
120:io/plot.c **** unsigned char hour_counter;
121:io/plot.c **** unsigned char eedata_old;
122:io/plot.c **** int yee;
123:io/plot.c **** unsigned char eepos;
124:io/plot.c **** unsigned char b;
125:io/plot.c ****
126:io/plot.c **** eedata = (32<<1);
127:io/plot.c **** eedata_old = (32<<1);
128:io/plot.c ****
129:io/plot.c **** //step1: send bmp header (if requested)
130:io/plot.c **** PGM_P header_ptr = PLOT_BMP_HEAD;
131:io/plot.c ****
132:io/plot.c **** for(x=streampos; x<PLOT_BMP_HEADER_LENGTH; x++){
133:io/plot.c **** buffer[datapos++] = pgm_read_byte(header_ptr++);
134:io/plot.c **** streampos++;
180 P */
181 ; 134 "io/plot.c" 1
182 lpm r24, Z
183
184 0042 8491 ; 0 "" 2
185 /* #NOAPP */
186 .LBE10:
187 st X+,r24
189 0044 8D93 .LM5:
135:io/plot.c **** re data allowed
136:io/plot.c **** if (len == 0)
190 r14,__zero_reg__
191 sbc r15,__zero_reg__
193 0048 E108 .LM6:
194 004a F108 cp r14,__zero_reg__
137:io/plot.c **** LOT_BMP_HEAD;
138:io/plot.c ****
195 r15,__zero_reg__
196 brne .+2
197 004c E114 rjmp .L5
198 004e F104 .LBB11:
200 0052 00C0 .LM7:
201 adiw r30,1
202 .LBE11:
203 subi r22,lo8(-(1))
204 0054 3196 sbci r23,hi8(-(1))
206 0056 6F5F .LM8:
207 0058 7F4F subi r18,lo8(-(1))
208 sbci r19,hi8(-(1))
209 .L4:
211 005c 3F4F .LM9:
212 cpi r18,62
213 cpc r19,__zero_reg__
214 brlo .L6
216 0060 3105 .LM10:
217 0062 00F0 subi r18,lo8(-(-62))
139:io/plot.c **** har eedata_old;
140:io/plot.c **** int yee;
141:io/plot.c **** unsigned char eepos;
142:io/plot.c **** unsigned char b;
143:io/plot.c ****
144:io/plot.c **** eedata = (32<<1);
218 movw r24,r22
219 adiw r24,1
220 0064 2E53 movw r30,r6
221 0066 3040 add r30,r22
222 0068 CB01 adc r31,r23
224 006c F301 .LM11:
225 006e E60F ldi r20,lo8(-1)
226 0070 F71F rjmp .L7
145:io/plot.c **** a_old = (32<<1);
146:io/plot.c ****
147:io/plot.c **** //step1: send bmp header (if requested)
148:io/plot.c **** PGM_P header_ptr = PLOT_BMP_HEAD;
149:io/plot.c ****
150:io/plot.c **** for(x=streampos; x<PLOT_BMP_HEADER_LENGTH; x++){
151:io/plot.c **** buffer[datapos++] = pgm_read_byte(header_ptr++);
152:io/plot.c **** streampos++;
153:io/plot.c **** len--;
227 tabn 68,0,150,.LM12-.LFBB2
228 .LM12:
229 0072 4FEF cpi r18,3
230 0074 00C0 cpc r19,__zero_reg__
231 brsh .L8
233 .LM13:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -