The problem with what Ian said is your wanting - and + and = keys key+48 not going to work.
You need change the part I showed you char act_key[] = {0,1,4,7,11,2,5,8,10,3,6,9,12} ;
To some thing like this with the keys you want
char act_key[] ={ '1','2','3','4','5','6','7','8', '9','0','-','+', '='};
The problem with what Ian said is your wanting - and + and = keys key+48 not going to work.
You need change the part I showed you char act_key[] = {0,1,4,7,11,2,5,8,10,3,6,9,12} ;
To some thing like this with the keys you want
char act_key[] ={ '1','2','3','4','5','6','7','8', '9','0','-','+', '='};
Well i looked at keil i don't like it I just tried SDCC It looks way better your problem is you don't no how to use printf .
And you just like me don't no enough about how to make a array
You probably be better off with a array of your keys in dec 0 to 9 then use pointer for + - * / =
Mike probably no the best way in C him and Ian
Your input is in ascii which should work if your keil handles C right I've ported a bunch of code from sdcc to xc8 on the pic . SO i would think keil would work with Mikes and Ian code I've used it on a pic with just port changes and the sbit problem but I found that xc8 can use sbit to set bits too.
Code works well on the sdcc But I have worked on keil yet. I think I should not change the compiler for one program So, I want this code to work on keil. I am trying to figure out where the mistake is happening
Code works well on the sdcc But I have worked on keil yet. I think I should not change the compiler for one program So, I want this code to work on keil. I am trying to figure out where the mistake is happening
What I don't get... You work with Proteus.... Proteus can integrate SDCC.. Then you can use the debug file to single step through the code... Why don't you just stick with SDCC... Its a better compiler but without the libraries..
What I don't get... You work with Proteus.... Proteus can integrate SDCC.. Then you can use the debug file to single step through the code... Why don't you just stick with SDCC... Its a better compiler but without the libraries..
He needs to for get keil and learn C them libraries are nice but there a learning to and then you have problems when you need to make your own code.
That has been a big problem for me.
I have installed sdcc
C:\Users\Parth\Desktop>sdcc -v
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.6.0 #9615 (MINGW64)
published under GNU General Public License (GPL)
I am just trying with led blink code. LED is blinking but how to debug code
C:
/* Main.c file generated by New Project wizard
*
* Created: Sun Feb 11 2018
* Processor: AT89C51
* Compiler: SDCC for 8051
*/
#include <mcs51reg.h>
#define LED_ON 1 /* LED ON */
#define LED_OFF 0 /* LED OFF */
/* LED connected to port P1 of pin 0 */
#define LED P1_0
/* This is delay function */
void Delay (unsigned int n)
{
unsigned int i;
for (i = 0; i <n; i++);
{
}
}
void main(void)
{
LED = LED_OFF; /* LED OFF */
while (1)
{
LED = LED_ON; /* Turn ON LED */
Delay(37000); /* Wait 40 ms */
LED = LED_OFF; /* turn off LED */
Delay(18500); /* wait 20ms */
}
}
What I do.... Press the second Icon... And the first line of code "LED = LED_OFF;" will be highlighted... then press F10 to step and F11 to step into..
If you do not see code, then you haven't unchecked the "Embed files" icon in project properties..
If you want floating debug windows ( So you can see the schematic ) close the VSM code window before running.. Then resize the code window and variable window to suit!!
What I do.... View attachment 110921 Press the second Icon... And the first line of code "LED = LED_OFF;" will be highlighted... then press F10 to step and F11 to step into..
Each time you press F10 the code will step through... The variable window shows every register and their contents.. As things are changed, you can see it the code behaves as it should... If you close the source code window and then press step ( second button ) all the code and variable windows can be moved about so you can see the code and the schematic whilst stepping through.