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.
#include<stdio.h> #include<reg52.h> #define XBYTE ((unsigned char volatile xdata*) 0 unsigned char dummy = 0x55; bit bitValue; void main (void) { bitValue = dummy & 0x40; XBYTE[0x1234]= 0x55; return; }
This program doesnt execute. plz query this program immediately.In the memory location the acc value is 0x55.
Doesn't execute? I'd bet it doesn't even compile, and if not, take a look at the error message.
Hint: XBYTE has an error.
The Error Message is :
Suscript on non array or too many dimensions. syntex error near.
so plz sending the correct coding sir. Because this is my learning stage.
Try (I can't compile it here):
#define XBYTE (unsigned char volatile xdata*)
In your "learning stage", it is advisable that you spend some time learning, by carefully looking at your code, and by googling for hints. To specifically request an answer is not nice, and will definitely not let you learn anything.
it is advisable that you spend some time learning, NO, it is required
You are asking a question when you are not even qualified to ask
There is the most fundamental PCidiotic error in your scribbles.
You need to understand the most basic conceprt before going even the small step you ask about.
Erik
http://www.keil.com/books/8051books.asp www.8052.com/books.phtml
www.8052.com/tutorial.phtml
http://www.keil.com/support/man_c51.htm
And don't forget the so-called "bible" for the 8051:
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf
#define XBYTE ((unsigned char volatile xdata*) 0 XBYTE[0x1234] = 0x55;
two problems 1. XBYTE is defined by the compiler. Look it in the docmentation. 2. Is that a valid ANSI C statment
unsigned char volatile xdata *bytePtr; bytePtr[0x1234] = 0x55; should work