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.

PIC18F4431 - IC(Input Capture Module)

Status
Not open for further replies.

fannylly

Newbie level 1
Joined
Jan 17, 2005
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
14
capture pic18f4431

For the IC (Input Capture) module, I tried to capture RC receiver signal (pulsewidth),
i.e 1.15ms to 1.85ms, and the signal repeats every 20ms (50Hz)

1. If there is any pulsewidth capture, the IC1IF will be set, am I right?
2. And the value of the TMR5 will be latched into CAP1BUF register, am I right?

Below is my short code to capture the pulsewidth; (CAP mod: 0111, capture every rising to falling edge)

ORG 0X20
MAIN MOVLB 0X0F ;SELECT BANK 15
MOVLW B'01010001' ;TIMER 5 PRESCALER 1:4
MOVWF T5CON
MOVLW 0X00
MOVWF INTCON ;disable all interupt
MOVLW 0X02
MOVWF IPR3 ;IC1 HIGH PRIORITY
BSF TRISA,2 ;SET CAP1 AS INPUT
BCF PIR3,IC1IF ;CLEAR INTERRUPT FLAG
MOVLW 0X00
MOVWF CAP1CON
MOVLW B'00000111' ;SELECT MODE,every rising to falling edge
MOVWF CAP1CON

;TEST WHETHER ANY VALUE HAS BEEN CAPTURED
LOOP BTFSS PIR3,IC1IF ;VALUE CAPTURED?
GOTO $-2

MOVLW 0X00
MOVWF TRISC
BSF PORTC,4

END

1. Why there is no change at the IC1IF bit?
2. Is there anything I missed to configure that make my program not working?


For your information, the high signal RC signal to the CAP1 is 5V and low is 0V

Note: I confirm the input signal to CAP1 is correct because I check the signal on the oscilloscope. I manage to capture the RC receiver pulsewidth using CCP module, from that I then generate PWM using the ‘Power Control PWM module’.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top