Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SegDisplay.cpp@0:691f916fe587, 2021-05-02 (annotated)
- Committer:
- ssunara
- Date:
- Sun May 02 16:25:11 2021 +0000
- Revision:
- 0:691f916fe587
Semafor s odbrojavanjem trajanja signalizacije.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ssunara | 0:691f916fe587 | 1 | #include "SegDisplay.h" |
ssunara | 0:691f916fe587 | 2 | BusOut Seg1(PB_4,PB_10,PA_8,PA_9,PC_7,PB_6,PA_7,PB_9); // A,B,C,D,E,F,G,DP |
ssunara | 0:691f916fe587 | 3 | void SegInit(void) |
ssunara | 0:691f916fe587 | 4 | { |
ssunara | 0:691f916fe587 | 5 | Seg1=SegConvert(0); //Inicijalizacija |
ssunara | 0:691f916fe587 | 6 | } |
ssunara | 0:691f916fe587 | 7 | char SegConvert(int SegValue) //funkcija za konverziju int varijable u niz bitova za ispis na 7 seg displayu |
ssunara | 0:691f916fe587 | 8 | { |
ssunara | 0:691f916fe587 | 9 | char SegByte=0x00; |
ssunara | 0:691f916fe587 | 10 | switch (SegValue) { //DP G F E D C B A |
ssunara | 0:691f916fe587 | 11 | case 0 : |
ssunara | 0:691f916fe587 | 12 | SegByte = 0x3F; |
ssunara | 0:691f916fe587 | 13 | break; // 0 0 1 1 1 1 1 1 binary |
ssunara | 0:691f916fe587 | 14 | case 1 : |
ssunara | 0:691f916fe587 | 15 | SegByte = 0x06; |
ssunara | 0:691f916fe587 | 16 | break; // 0 0 0 0 0 1 1 0 binary |
ssunara | 0:691f916fe587 | 17 | case 2 : |
ssunara | 0:691f916fe587 | 18 | SegByte = 0x5B; |
ssunara | 0:691f916fe587 | 19 | break; // 0 1 0 1 1 0 1 1 binary |
ssunara | 0:691f916fe587 | 20 | case 3 : |
ssunara | 0:691f916fe587 | 21 | SegByte = 0x4F; |
ssunara | 0:691f916fe587 | 22 | break; // 0 1 0 0 1 1 1 1 binary |
ssunara | 0:691f916fe587 | 23 | case 4 : |
ssunara | 0:691f916fe587 | 24 | SegByte = 0x66; |
ssunara | 0:691f916fe587 | 25 | break; // 0 1 1 0 0 1 1 0 binary |
ssunara | 0:691f916fe587 | 26 | case 5 : |
ssunara | 0:691f916fe587 | 27 | SegByte = 0x6D; |
ssunara | 0:691f916fe587 | 28 | break; // 0 1 1 0 1 1 0 1 binary |
ssunara | 0:691f916fe587 | 29 | case 6 : |
ssunara | 0:691f916fe587 | 30 | SegByte = 0x7D; |
ssunara | 0:691f916fe587 | 31 | break; // 0 1 1 1 1 1 0 1 binary |
ssunara | 0:691f916fe587 | 32 | case 7 : |
ssunara | 0:691f916fe587 | 33 | SegByte = 0x07; |
ssunara | 0:691f916fe587 | 34 | break; // 0 0 0 0 0 1 1 1 binary |
ssunara | 0:691f916fe587 | 35 | case 8 : |
ssunara | 0:691f916fe587 | 36 | SegByte = 0x7F; |
ssunara | 0:691f916fe587 | 37 | break; // 0 1 1 1 1 1 1 1 binary |
ssunara | 0:691f916fe587 | 38 | case 9 : |
ssunara | 0:691f916fe587 | 39 | SegByte = 0x6F; |
ssunara | 0:691f916fe587 | 40 | break; // 0 1 1 0 1 1 1 1 binary |
ssunara | 0:691f916fe587 | 41 | case 10 : |
ssunara | 0:691f916fe587 | 42 | SegByte = 0x80; |
ssunara | 0:691f916fe587 | 43 | break; // 1 0 0 0 0 0 0 0 binary |
ssunara | 0:691f916fe587 | 44 | } |
ssunara | 0:691f916fe587 | 45 | return SegByte; |
ssunara | 0:691f916fe587 | 46 | } |