Dear Sir, This is my coding. I want to write it in C language. I'm a very begginer. How can i write DB "DWIN" instruction in C language. Please Guide me. thank you for your help.
ORG 1FFCH DB "DWIN" START: MOV DPTR,#0044H MOVX A,@DPTR JNZ START INC DPL MOVX A,@DPTR JNZ START MOV A,#LOW(500) MOVX @DPTR,A DEC DPL MOV A,#HIGH(500) MOVX @DPTR,A MOV DPTR,#0042H MOVX A,@DPTR XRL A,#01H MOVX @DPTR,A LJMP START
Thanks & Regards, Saravanaeswaran.M
Wrong approach.
There isn't any 1:1 relationship between C and assembler, so don't try to translate individual assembler statements.
Figure out exactly what the assembler code does, and then figure out what C constructs you would need to get a similar result.
Dear Per Westermark,
Thank you for your reply and advice. Sir, in program DB "DWIN" is must. How can i write it in C language.
Sorry, you haven't convinced me that what you think is a must really is a must.
Dear Per Westermark, Sorry sir, i'm a fresher. i understand that. Thank you for your reply.
Thanks & Regard, Saravanaeswaran.M
Have you tried to describe what the assembler code does? And the meaning of the hard-coded addresses? The assembler code isn't exactly well documented...
Dear Per Westermark, Sir, we have one module(DCT100). That program is example coding of that module. i need to develop that. That example code is running correctly with that module.
Where does this requirement come from?
Note that the 'C' code posted will not assure this...
Dear Tit, {etcetera etcetera}
That's brightened up the start of my day. Thanks.
"Note that the 'C' code posted will not assure this..."
Exactly - C isn't designed with the intention that it should be possible for the developer to place a magic marker first in the binary using C.
If needed, this is normally done by linking the binary 4 bytes into the memory range, and then use some post-processing step to merge marker + generated binary.
Dear Each Eastercross, Sorry sir, First i will study all these and i will ask you if any doubts. Kindly thanks to all for great guidance and help
See the list of restrictions that apply to absolute variables located using the _at_ keyword...
I stand corrected.
Since the OPs got a (basic) understanding of assembly language, he could just stick to having his DB; but in an assembly module. Now that undoubtedly works.
Really?
I'm in a glass is half full mood today.
I guess we are back in the silly attempt to learn C with an embedded micro.
LEARN C ON THE PC, then start with the micros.
Erik