I'm going through some code and found this line:
volatile char LCD_DATA @ 0x200;
I know it's naming a char LCD_DATA but I'm not familiar with the @ symbol.
I'm going through some code and found this line:
volatile char LCD_DATA @ 0x200;
I know it's naming a char LCD_DATA but I'm not familiar with the @ symbol.
Me neither. Does it compile?
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
@ is used in various programming languages although there is not a consistent theme to its usage. For example:
In C#, it denotes "verbatim strings", where no characters are escaped and two double-quote characters represent a single double-quote. As a prefix it also allows keywords to be used as identifiers.
In Java, it is used to denote annotations, a kind of metadata, since version 5.0
In modal logic, specifically when representing possible worlds, @ is sometimes used as a logical symbol to denote the actual world (the world we are 'at').
In Pascal, @ is the "address of" operator (it tells the location at which a variable is found).
In Perl, @ prefixes variables which contain arrays.
In PHP, it is used just before an expression to make the interpreter suppress errors that would be generated from that expression.
In Python 2.4 and up, it is used to decorate a function (wrap the function in another one at creation time).
In Ruby, @ prefixes instance variables, and @@ prefixes class variables.
In Scala, it is used to denote annotations (as in Java), and also to bind names to subpatterns in pattern-matching expressions.
In ML, it denotes list concatenation.
In Clipper, it is used to denote position on the screen. For example: @1,1 SAY "HELLO" to show the word "HELLO" in line 1, row 1.
I could not find its any relation with C Programming Language.
Some embedded compilers use that notation to locate a variable at a specific address.
In this case, your LCD_DATA variable will be located at address 0X200
So when you do
LCD_DATA = 'A';
say, you may see an 'A' on your LCD.
Read the docs for your LCD to find out more.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I'll post up some more code of how it's used"
This is being used with MC68HC812A4 CPU.Code://Module LM6733 // Epson 1330/1335 LCD Display Controller Port Addresses volatile char LCD_DATA @ 0x200; /*lcd data address*/ volatile char LCD_CMD @ 0x201; /*lcd CMD address*/ while(LCD_DATA & 0x40) ; \ LCD_CMD=(unsigned char)cmd; \ _asm("bclr _PORTE,128"); } while(LCD_DATA & 0x40) ; \ LCD_DATA=(unsigned char)data; \ _asm("bclr _PORTE,128"); }