librerija za cetvero segmentni displej
Displej.cpp
- Committer:
- IsusKrist
- Date:
- 2022-05-04
- Revision:
- 0:9c0145823064
File content as of revision 0:9c0145823064:
#include "Displej.h" BusOut LSegment(D11,D10,D9,D8,D7,D6,D5,D4); BusOut QSegment(D15,D14,D13,D12); char SegConvert(int broj,int znamenka) { int c[2]; char SegByte=0x00; if(broj>9){ for(int i=0;i<2;i++){ c[i]=broj%10; broj/=10; } }else{ c[znamenka]=znamenka==1?0:broj; } switch(c[znamenka]) { case 0 : SegByte = 0xC0;break; case 1 : SegByte = 0xF9;break; case 2 : SegByte = 0xA4;break; case 3 : SegByte = 0xB0;break; case 4 : SegByte = 0x99;break; case 5 : SegByte = 0x92;break; case 6 : SegByte = 0x82;break; case 7 : SegByte = 0xF8;break; case 8 : SegByte = 0x80;break; case 9 : SegByte = 0x90;break; case -1 : SegByte = 0x7F;break; } return SegByte; }