Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
112 | mikeljo | 1 | |
2 | #include <avr/io.h> |
||
3 | #include <inttypes.h> |
||
4 | #include <stdlib.h> |
||
5 | #include <avr/pgmspace.h> |
||
6 | |||
7 | #include "main.h" |
||
8 | #include "base64.h" |
||
9 | #include "lcd.h" |
||
10 | #include "rs232.h" |
||
11 | |||
12 | // Insgesamt 32 Werte können angezeigt werden |
||
13 | // jeweils 8 Stück werden gleichzeitg angezeigt |
||
14 | // Auswahl über Tasten |
||
15 | |||
16 | uint8_t displ_page; |
||
17 | |||
18 | |||
19 | void displ_get_text(uint8_t number) |
||
20 | { |
||
21 | uint8_t text[17]; |
||
22 | uint8_t i; |
||
23 | |||
24 | p_buffer[0] = '#'; |
||
25 | p_buffer[1] = 'a'; |
||
26 | p_buffer[2] = 'a'; |
||
27 | p_buffer[3] = number; |
||
28 | p_buffer[4] = 0; |
||
29 | p_buffer[5] = 0; |
||
30 | base64_send(6); |
||
31 | |||
32 | do |
||
33 | { |
||
34 | get_message(); |
||
35 | } |
||
36 | while (r_buffer[1] != 'A'); |
||
37 | |||
38 | for (i=0;i<16;i++) |
||
39 | text[i] = p_buffer[i]; |
||
40 | text[16] = 0x00; |
||
41 | lcd_print_at(0,(number & 0x07),text,0); |
||
42 | |||
43 | } |
||
44 | |||
45 | void displ_values(void) |
||
46 | { |
||
47 | uint8_t displ_page, i; |
||
48 | int16_t value; |
||
49 | uint8_t text[17]; |
||
50 | |||
51 | displ_page = 0; // Page 0..3 (4 Pages zu je 8 Werte) |
||
52 | lcd_cls(); // LCD löschen |
||
53 | |||
54 | do |
||
55 | { |
||
56 | for (i=0;i<8;i++) // Texte lesen und anzeigen |
||
57 | displ_get_text(i+displ_page*8); |
||
58 | |||
59 | do |
||
60 | { |
||
61 | get_message(); |
||
62 | if(r_buffer[1] == 'D') |
||
63 | { |
||
64 | for (i=0;i<8;i++) |
||
65 | { |
||
66 | value = p_buffer[i*2+displ_page*16+2] + 256*p_buffer[i*2+displ_page*16+3]; |
||
67 | itoa(value,text,10); |
||
68 | lcd_print_atp(14,i,PSTR(" "),0); |
||
69 | lcd_print_at(14,i,text,0); |
||
70 | } |
||
71 | } |
||
72 | } |
||
73 | while (key == 0x00); |
||
74 | if (key == 0x01) |
||
75 | displ_page++; |
||
76 | if (key == 0x02) |
||
77 | displ_page--; |
||
78 | |||
79 | displ_page &= 0x03; |
||
80 | } |
||
81 | while(key != 0x08); |
||
82 | } |
||
83 |