Nadzor opterećenja
https://os.mbed.com/media/uploads/nikolarp/shema_fb_thumb.jpg
SegDisplay.cpp
- Committer:
- nikolarp
- Date:
- 2021-04-05
- Revision:
- 0:b6c8e3914720
File content as of revision 0:b6c8e3914720:
#include "SegDisplay.h" BusOut Seg1(D8,D9,D10,D12,D13,D14,D15); // A,B,C,D,E,F,G void SegInit(void) { Seg1=SegConvert(0); //inicijalizacija } char SegConvert(int SegValue) //funkcija za konverziju char varijable u niz bitova za ispis na 7 seg displayu { char SegByte=0x00; switch (SegValue) { //DP G F E D C B A case 0 : SegByte = 0x3F; break; // 0 0 1 1 1 1 1 1 binary case 1 : SegByte = 0x06; break; // 0 0 0 0 0 1 1 0 binary case 2 : SegByte = 0x5B; break; // 0 1 0 1 1 0 1 1 binary case 3 : SegByte = 0x4F; break; // 0 1 0 0 1 1 1 1 binary case 4 : SegByte = 0x66; break; // 0 1 1 0 0 1 1 0 binary case 5 : SegByte = 0x6D; break; // 0 1 1 0 1 1 0 1 binary case 6 : SegByte = 0x7D; break; // 0 1 1 1 1 1 0 1 binary case 7 : SegByte = 0x07; break; // 0 0 0 0 0 1 1 1 binary case 8 : SegByte = 0x7F; break; // 0 1 1 1 1 1 1 1 binary case 9 : SegByte = 0x6F; break; // 0 1 1 0 1 1 1 1 binary } return SegByte; }