Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help in PIC 16F877A assembly code!!!

Status
Not open for further replies.

skoon

Newbie level 2
Joined
Nov 2, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
Help in PIC 16F877A with assembly code!!!

Ultrasonic measure distance

I was finish build the complete circuit for Ultrasonic measure distance,
but still I didn't write the code can anyone help me?????:|:|

my circuit is simeller for this:

 
Last edited:

Thanks for your helping,

I start to write the PWM code and generate 10 pulse from RC2 thats is working,
but
1.I want to generate another High signal it will be start when pulse start and stop at same time this one for detected signal?..

2. when I write the code to start counter?

can you help me??? :sad: :cry:


LIST P=16F877A
#INCLUDE P16F877A.INC

cblock 0x20 ;start of general purpose registers
PULSE_COUNT
count ;used in delay routine
count1 ;used in delay routine
temp ;temp storage
TIMEL
TIMEH
LOW_COUNT
HIGH_COUNT
LOOP_COUNT
endc

ORG 0x0000
GOTO START
ORG 0x0010

INIT_RC

CLRF PORTC
BSF STATUS,RP0
MOVLW B'00000001'
MOVWF TRISC
BCF STATUS,RP0
RETURN

SEND

MOVLW D'10'
MOVWF PULSE_COUNT
CALL PWM
RETURN

START

CALL INIT_RC
CALL INIT_PWM
CALL SEND


INIT_PWM
CLRF TIMEL
CLRF TIMEH
CLRF CCP1CON
CLRF TMR2
MOVLW D'12'
MOVWF CCPR1L
CLRF INTCON
BSF STATUS,RP0
MOVLW D'24'
MOVWF PR2
BCF TRISC,2
BCF STATUS,RP0
CLRF PIR1
MOVLW 0X0C
MOVWF CCP1CON
BSF T2CON,TMR2ON
BCF PORTC,1
RETURN

PWM

BTFSS PIR1,TMR2IF
GOTO PWM

BTFSC PORTC,2
BSF PORTC,1

BCF PIR1,TMR2IF
DECFSZ PULSE_COUNT
GOTO PWM

BCF PORTC,1
CLRF CCPR1L
CALL Delay500
MOVLW D'10'
MOVWF PULSE_COUNT
RETURN


Delay500
movlw d'3' ;delay for500us
movwf count1
Delay1 call Delay250
decfsz count1
goto Delay1
return
Delay250
movlw d'125' ;delay for250us
movwf count
goto Delay
Delay ;delay for2us
nop
nop
decfsz count, f
goto Delay
return


END
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top