ddad
Dependencies: mbed
Fork of class_7segment_serial by
main.cpp@2:120a14d6f055, 2017-06-06 (annotated)
- Committer:
- mijimy
- Date:
- Tue Jun 06 10:00:51 2017 +0000
- Revision:
- 2:120a14d6f055
- Parent:
- 1:65d57cc8cb22
sdsfsgdf
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mijimy | 0:8cf7ed60c892 | 1 | #include "mbed.h" |
mijimy | 2:120a14d6f055 | 2 | #include "HostIO.h" |
mijimy | 2:120a14d6f055 | 3 | #include "SegDisp.h" |
mijimy | 0:8cf7ed60c892 | 4 | Serial pc(USBTX, USBRX); |
mijimy | 0:8cf7ed60c892 | 5 | BusOut Seg1(PC_9,PC_8,PB_8,PC_6,PB_9,PC_5,PA_5,PA_12);// A,B,C,D,E,F,G,DP |
mijimy | 0:8cf7ed60c892 | 6 | BusOut Seg2(PA_8,PB_1,PB_10,PB_15,PB_4,PB_14,PB_5,PB_13);// A,B,C,D,E,F,G,DP |
mijimy | 0:8cf7ed60c892 | 7 | char data1, data2; // variable declarations |
mijimy | 0:8cf7ed60c892 | 8 | |
mijimy | 0:8cf7ed60c892 | 9 | int main() |
mijimy | 0:8cf7ed60c892 | 10 | { // main program |
mijimy | 0:8cf7ed60c892 | 11 | SegInit(); // call function to initialise the 7-seg displays |
mijimy | 0:8cf7ed60c892 | 12 | HostInit(); // call function to initialise the host terminal |
mijimy | 0:8cf7ed60c892 | 13 | while (1) |
mijimy | 0:8cf7ed60c892 | 14 | { // infinite loop |
mijimy | 0:8cf7ed60c892 | 15 | data2 = GetKeyInput(); // call function to get 1st key press |
mijimy | 1:65d57cc8cb22 | 16 | Seg1=SegConvert(data2); // call function to convert and output |
mijimy | 0:8cf7ed60c892 | 17 | data1 = GetKeyInput(); // call function to get 2nd key press |
mijimy | 1:65d57cc8cb22 | 18 | Seg2=SegConvert(data1); // call function to convert and output |
mijimy | 0:8cf7ed60c892 | 19 | pc.printf(" "); // display spaces between 2 digit numbers |
mijimy | 0:8cf7ed60c892 | 20 | } |
mijimy | 0:8cf7ed60c892 | 21 | } |