We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
sir , My simple program is LCD display using CX 51 is given below. In the program compiling peroid no other errors and warning are occured. But the obj file for those program stored in the microconroller 80c51 chip they dont work it.what is the problem. plz give a solution any one sir.
#include<stdio.h> #include<reg52.h> #include<intrins.h> #include<string.h> #include<absacc.h> // sfr P1 = 0x90; // sfr P3 = 0xB0; sbit P3_2 = P3^2; sbit P3_3 = P3^3; sbit P3_4 = P3^4; lcd_init(); lcd_command(); lcd_ready(); lcd_display(); void main() { SCON = 0x52; /* SCON */ /* setup serial port control */ TMOD = 0x20; /* TMOD */ /* hardware (2400 BAUD @12MHZ) */ TCON = 0x69; /* TCON */ TH1 = 0xf3; /* TH1 */ lcd_init(); lcd_command(); lcd_ready(); lcd_display(); } lcd_init() { ACC = 0x3c; lcd_command(); ACC = 0x0e; lcd_command(); ACC = 0x06; lcd_command(); ACC = 0x01; lcd_command(); ACC = 0x87; lcd_command(); ACC = 'P'; lcd_display(); ACC = 'r'; lcd_display(); ACC = 'e'; lcd_display(); ACC = 's'; lcd_display(); ACC = 's'; lcd_display(); ACC = ' '; lcd_display(); ACC = 'A'; lcd_display(); ACC = 'n'; lcd_display(); ACC = 'y'; lcd_display(); ACC = ' '; lcd_display(); ACC = 'K'; lcd_display(); ACC = 'e'; lcd_display(); ACC = 'y'; lcd_display(); ACC = '.'; lcd_display(); } lcd_command () { lcd_ready(); P1 = ACC; P3_2 =0; P3_3 =0; P3_4 =1; P3_4 = 0; return ; } lcd_ready() { P3_4 = 0; P2 = 0xff; P3_2 =0; P3_3 =1; } lcd_display() { lcd_ready(); P1 = ACC; P3_2 =1; P3_3 =0; P3_4 =1; P3_4 =0; return ; }
Are you the same Ranjith kumar Kandasamy as in this thread: http://www.keil.com/forum/docs/thread9861.asp
If so, you don't appear to have done your basic study yet.
You appear to be trying to pass a parameter to a function by loading its value into ACC:
ACC = 0x3c; lcd_command(); ACC = 0x0e; lcd_command(); ACC = 0x06; lcd_command(); etc...
This will most certainly not work - this is not the way to pass parameters in 'C'!!
You really need to get a 'C' textbook and study the fundamental concepts of the language! It will probably be easiest of you learn the 'C' language on a PC first; once you have grasped the basics of the language on the PC, then you can move on to applying it to microcontrollers.
In addition to the books already cited in http://www.keil.com/forum/docs/thread9861.asp The ACCU (Association of C & C++ Users) also has a whole load of book reviews - including a section on embedded:
brian.accu.org/.../
It would help if you used a more descriptive title for your post than "plz query".