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.

Detecting high speed square pulses using a PIC 16F84A

Status
Not open for further replies.

PLANK

Newbie level 3
Joined
May 19, 2010
Messages
3
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
RSA
Activity points
1,306
Greetings

Please assist with the following :

At the moment, my program can detect square pulses via an opto-coupler input without a problem.

I monitor the input of Port B on a cyclic basis and as soon as I detect a high, I await an "end of pulse" status before registering a legitimate pulse.

New high speed square pulses and decreased pulse intervals are evident to such an extent that the current program is unable to detect the 2nd, 3rd , 4th pulses ...only the 1st one.

What routine would work independant of actual pulse width / pulse intervals ?
 

Seems like a job for charge time measurement unit, since 16F84A got none... Use high frequency oscillator and timer on fastest count up rate. Im sure you can find some performance by optimizing program code and maybe rechecking external electronics on input.
 

Thanks.

Input hardware all o.k - I can visually observe the multiple pulses coming in via LED .

Its the code optomisation which I need assistance with.
 

Hi Plank!

How should I create a program in asssembly such that when an input pin receives a pulse, the LED blinks 5 times and after that it goes back again on looping on the input pin and waits for another pulse to come?

Thanks a lot!
 

Its the code optomisation which I need assistance with.

it would be quite difficult to optimize your code if we don't know what your code is.
 

Input PIN activates - LED blinks 5 times

Assuming your Input pin is PORTA,1 & your LED is connected to PORTB,0 & Timer routine generates a delay of 1 second, then a simplified code sample is applicable as follows :

START
btfsc PORTA,1 ; Check Input Pin ?
goto START ; Input Pin not active , check again
bsf PORTB,0 ; Set LED Output on
call Timer ; Timer routine ie 1 second
bcf PORTB,0 ; Set LED Output off
call Timer
bsf PORTB,0
call Timer
bcf PORTB,0
call Timer
bsf PORTB,0
call Timer
bcf PORTB,0
call Timer
bsf PORTB,0
call Timer
bcf PORTB,0
call Timer
bsf PORTB,0
call Timer
bcf PORTB,0
goto START
 
Hi PLANK,

Thanks a lot for this. I've decided to stop the project before because I got busy on my work. Now I'd like to cpntinue this. Thanks for your reply. I'll try the code. I'll inform you as soon as I've made the entire circuit and tested the program.

*** bless!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top