View previous topic :: View next topic |
Author |
Message |
enyam.agbodjavou
Joined: 29 Mar 2016 Posts: 1
|
Making a calculator in proteus and ccs |
Posted: Tue Mar 29, 2016 5:25 am |
|
|
hi people,
I am making a simple calculator. I am not using the keypad but the buttons.
The code below is how I take input from the buttons,
num1 is an array of 4.
if(input(PIN_C1)==1)
{
if(press==0)
{
printf(lcd_putc,"\f");
}
printf(lcd_putc,"8");
Delay_ms(500);
press=press+1;
num1[press=press+1]=8;
}
I did the same for all the other numbers. but when I enter 45+2 for example, it only takes the first digit and add it to the 2 so it will do 4 + 2 and the answer will be 6 instead of 46!
Please help |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9177 Location: Greensville,Ontario
|
|
Posted: Tue Mar 29, 2016 5:34 am |
|
|
as you're a first time poster.....
some comments..
1) Please read top sticky called PIC101.
2) Proteus is busted, can't be fixed, no one here can be bothered with it.
3) Post a COMPLETE program, using the 'code[]' button. We must know PIC type, compiler version, etc. to properly help you
4) Confirm you are using real hardware. There is a HUGE difference to what Proteus allows versus the Real World.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
signorenza
Joined: 30 Mar 2016 Posts: 1
|
The key to a sucessful PIC design-is to follow data sheet |
Posted: Wed Mar 30, 2016 4:52 am |
|
|
u need to download my sample c code --here-- |
|
![](templates/subSilver/images/spacer.gif) |
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Wed Mar 30, 2016 5:34 pm |
|
|
Gee - that sounds like an invitation too good to be true ![Rolling Eyes](images/smiles/icon_rolleyes.gif) _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
![](templates/subSilver/images/spacer.gif) |
|