12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #include "display.h"
- #include "gtext.h"
- void disp_num(signed int val){
- unsigned char disp = 0, digit;
- if(val < 0){
- putchar('-');
- val = -val;
- } else {
- putchar(' ');
- }
- digit = val/10000;
- if(digit){
- putchar(digit + '0');
- disp = 1;
- } else putchar(' ');
- digit = (val/1000)%10;
- if(digit || disp){
- putchar(digit + '0');
- disp = 1;
- } else putchar(' ');
- digit = (val/100)%10;
- if(digit || disp){
- putchar(digit + '0');
- disp = 1;
- } else putchar(' ');
- digit = (val/10)%10;
- if(digit || disp){
- putchar(digit + '0');
- } else putchar(' ');
- digit = val%10;
- putchar(digit + '0');
- }
- void disp_temp(signed int temp){
- unsigned char pos = 0;
- if(temp < 0){
- putchar('-');
- pos++;
- temp = -temp;
- }
- if(temp >= 1000){
- putchar(temp/1000 + '0');
- pos++;
- }
- if(temp >= 100){
- putchar((temp/100)%10 + '0');
- pos++;
- }
- putchar((temp/10)%10 + '0');
- putchar(',');
- putchar(temp%10 + '0');
- putchar(0x7b);
- putchar('C');
- pos+=5;
- for(; pos<8; pos++) putchar(' ');
- }
|