- This topic has 1 reply, 2 voices, and was last updated 10 years, 7 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › 8051 microcotroller interfacing with an ultrasonic sensor[assembly]
Im in an assembly language class at NEIT, im very lost and the fellas at saturday help arent much as theyve passed this class long ago.
the lab project calls for me to sound a buzzer if the Ultrasonic sensor senses anything
so far all that it’s doing is buzzing non stop, its not a matter of sensativity or interfence, its something in my code
just need some help, really dont want to fail this class, Id appreciate any help
START:
TOP: setb P3.6 ; turn on utx
NO: jb P3.4, NO
call beep
jmp TOP
beep:
mov R1, #200
mov TMOD, #01H ;setting timer0 in 16 bit mode
AGAIN: mov TL0, #8Dh ; our low value for our period
mov TH0, #0FFh ; our hi value
Setb TR0 ; starts timer
HERE: JNB TF0, HERE ; waits for flag to set
CLR TR0 ; stops timer
CPL P0.0 ; toggles switch to create our square wave
CLR TF0 ; clears flag
DJNZ R1,Again
ret
end
ur code seems to be correct. (although i m not sure since i have left assembly language programming before 7 years)
u might be getting always low logic at P3.4. just check it out.