Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/28/99 16:13
Read: times


 
#905 - Can somebody check this code plz.

This is my first project with microcontrollers(using Atmel AT89C52). I'm generating a pulse of 1ms to be fed to a servo. I'm using P2.1 to output the pulse. I'm using a 4MHz Crystal Oscillator. Here is how i think it can be done:


Delay: clr A
Delay1: inc A
cjne A,#29Bh, Delay1 ;29Bh = 667d { 0.75us * 667 = 0.5ms}
ret ; it takes 3*0.25us= 0.75us to ;complete the Delay1 loop

Start:
mov P2, #00h
cpl P2.1 ;set pulse high
acall Delay
acall Dealy ;keep high for 1ms
cpl P2.1 ;set pulse low
acall Delay
acall Dealy ;keep low for 1ms
cpl P2.1 ;set pulse high
acall Delay
acall Dealy ;keep high for 1ms
cpl P2.1 ;set pulse low
acall Delay
acall Dealy ;keep low for 1ms
.End

Can anybody ,please, tell me if i'm doing it right.

List of 4 messages in thread
TopicAuthorDate
Can somebody check this code plz.            01/01/70 00:00      
RE: Can somebody check this code plz.            01/01/70 00:00      
RE: Can somebody check this code plz.            01/01/70 00:00      
RE: Can somebody check this code plz.            01/01/70 00:00      

Back to Subject List