Re: große Zahlen auf Display Kategorie: Programmierung (von Rocky98 - 18.02.2006 13:09) | ||
Als Antwort auf große Zahlen auf Display von rocky98 - 27.12.2005 7:04 | ||
| ||
Hi @all, ich habe einige Funktionen geschrieben mit denen man gro�e Zahlen auf dem Display 2x20 od 4x20 darstellen kann. Hier der Code für die Darstellungen von Zahlen über 2 Zeilen. function def_doublelinenums() {byte chars[8]; chars[0] = 0x01; chars[1] = 0x01; chars[2] = 0x01; chars[3] = 0x01; chars[4] = 0x01; chars[5] = 0x01; chars[6] = 0x01; chars[7] = 0x01; defineChar(0,chars); chars[0] = 0x1F; chars[1] = 0x11; chars[2] = 0x11; chars[3] = 0x11; chars[4] = 0x11; chars[5] = 0x11; chars[6] = 0x11; chars[7] = 0x11; defineChar(1,chars); chars[0] = 0x1F; chars[1] = 0x10; chars[2] = 0x10; chars[3] = 0x10; chars[4] = 0x10; chars[5] = 0x10; chars[6] = 0x10; chars[7] = 0x1F; defineChar(2,chars); chars[0] = 0x01; chars[1] = 0x01; chars[2] = 0x01; chars[3] = 0x01; chars[4] = 0x01; chars[5] = 0x01; chars[6] = 0x01; chars[7] = 0x1F; defineChar(3,chars); chars[0] = 0x1F; chars[1] = 0x11; chars[2] = 0x11; chars[3] = 0x11; chars[4] = 0x11; chars[5] = 0x11; chars[6] = 0x11; chars[7] = 0x1F; defineChar(4,chars); chars[0] = 0x11; chars[1] = 0x11; chars[2] = 0x11; chars[3] = 0x11; chars[4] = 0x11; chars[5] = 0x11; chars[6] = 0x11; chars[7] = 0x1F; defineChar(5,chars); chars[0] = 0x1F; chars[1] = 0x01; chars[2] = 0x01; chars[3] = 0x01; chars[4] = 0x01; chars[5] = 0x01; chars[6] = 0x01; chars[7] = 0x1F; defineChar(6,chars); chars[0] = 0x1F; chars[1] = 0x01; chars[2] = 0x01; chars[3] = 0x01; chars[4] = 0x01; chars[5] = 0x01; chars[6] = 0x01; chars[7] = 0x01; defineChar(7,chars); } function print_upper_num(int num) { if num == 0 {put(1);}; if num == 1 {put(0);}; if num == 2 {put(7);}; if num == 3 {put(6);}; if num == 4 {put(5);}; if num == 5 {put(2);}; if num == 6 {put(2);}; if num == 7 {put(7);}; if num == 8 {put(4);}; if num == 9 {put(4);}; } function print_lower_num(int num) { if num == 0 {put(5);}; if num == 1 {put(0);}; if num == 2 {put(2);}; if num == 3 {put(3);}; if num == 4 {put(0);}; if num == 5 {put(3);}; if num == 6 {put(5);}; if num == 7 {put(0);}; if num == 8 {put(5);}; if num == 9 {put(3);}; } function print_doublelinenum(int num,int row, int col) { goto(row,col); print_upper_num(num); goto(row+1,col); print_lower_num(num); } Einfach in pcflcd od. rblcd reinkopieren. Viel Spa� damit. Gru� Frank | ||
Antwort schreiben Antworten: |