- #1
Ian_Brooks
- 129
- 0
Homework Statement
I'm very new to embedded design and wanted to develop a micro controller code that
*takes 3 inputs from 3 push buttons
- hundreds, tens, ones respectively
* displays the output on 3 7segment displays
* outputs a fixed binary number to another microcontroller / or perhaps use it for another aspect inside the microcontroller.
Homework Equations
None that I know of.
I'll most likely program it in C and use the ctoasm function to convert it into assembly
The Attempt at a Solution
This is the design I'm hoping for.
http://img228.imageshack.us/img228/9088/sampledesigndv7.gif [Broken]
rough pseudo code for now
Code:
int hundreds, tens, ones;
boolean set = 0; // when pressed the final value is calculated and stored
boolean input1 = 0;
boolean input2 = 0;
boolean input3 = 0;
while (set != 1) {
if (input1 == 1){
BCDOUT_1(hundreds++);
}
else if (input2 == 1){
BCDOUT_2(tens++);
}
else if (input3 == 1){
BCDOUT_3(ones++);
}
}//end while - loop ends when set = 1
finalVal = (100*hundreds) + (10*tens) + ones;
things to include:
i'll have to #define the push button addresses
in the main code I'll have to define the output ports as
byte *output_port = (byte *) display; //or something or rather
could someone help - or atleast point me in the right direction
Last edited by a moderator: