Question

I used ASEM51 assembler so I could assemble this given code. I have zero knowledge of Assembly Language but I have to burn this code in a micro-controller for my project model. It's a code for Ultrasonic Distance Meter. I used "M-IDE Studio for MCS-51" to simulate the code. It got one error at line (51) which stated "symbol not defined". The line which gave this error was:

cjne a,#0c0h,check_echo

I need this error to be removed so I can successfully burn this program. Please refrain yourself from commenting in the manner of "walk before you start running" because I'm not asking for getting my entire code done as I have already stated that I have no knowledge of the language and, also, the coding was found in a reference in which the coding was not aligned and hence had 40 errors, which I sorted out myself. It's just one error which is in the way. Here are the respective links for the ASM file and the reference from which I got the code.

http://www.mediafire.com/file/kp738c4gr32bgy4/ULTRSND.asm http://kitsnspares.com/admin/pdffiles/Ultrasonic%20Distance%20Meter.pdf (Last two pages)

Was it helpful?

Solution

It looks like there is a missing line break in the code - change:

 mov r2,#10
 djnz r2,$ ;wait 20 us check_echo:
 jnb p3.6,checktimeout

to:

 mov r2,#10
 djnz r2,$ ;wait 20 us
check_echo:
 jnb p3.6,checktimeout
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top