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.

Pulse reading from other ports.

Status
Not open for further replies.

corpuralx

Junior Member level 3
Joined
Oct 12, 2013
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
253
Hi, Good Day! This is my first post. I made a circuit which read pulses from a coinslot with the help of interrupts using pic16f877a 4mhz, im currently using rb0/portb.f0 to read the pulses, count them, and display in portd the number of pulses.

My question is, would it be possible if i change the port of reading pulses from rb0/portb.f0 to any ports like ra0-ra5 or rc0-rc7 or maybe re0-re2? would it still read the pulses? if so, does i need to add special codes/program in the mikroc? thanks

Thank you very much.
 

Well port B is the only port with that interrupt capability on it (if i recall, if you read the datasheet it would tell you). So it wouldn't be automatically triggered like it is currently so depending on what your system is doing this can be an issue. Without the interrupt you would have to manually read and process. The problem is that the pulse is usually so fast that you would miss the trigger to start your sample.
What you would have to do:
1.) Somehow read that there is a pulse (or periodically sample the signal)
2.) Run a loop to store a set number of samples
3.) Convert the samples to values of pulses
4.) Pulses/time to give you a frequency
5.) Convert frequency to RPM
 

I'm guessing you want to do this because you have seen a circuit for something that makes use of port-b?
If that's the case perhaps you could also give some info on that and we might find it easier for you
to place that on another port.
Whilst I'd normally advise against polling solutions - if your coin counting isn't very fast it should be ok
to do it that way and move the control -but again depending on what else is happening
No matter what you change you will have to re-program anyway.
 

Thank you very much, I was actually planning on putting my 7seg display on portb, but since, only portb.rb0 can read the pulses, would it be possible to make porta as an output instead, to display the 7seg display pulses? THanks
 

Well - there is no shortage of ports on that chip - you might conside port D if using a 40pin version
but depending on your 7segment hardware I dont see any reason you couldn't do it most anywhere
but be careful of RA4.
I havn't used a 16F877 for some time - I'd try to avoid port C and A for personal preference though
(port c for example carries rs232 and thats always handy I find even in simple designs)
 

Thanks for the reply and help. I managed to solve the problem a long time ago, but of course, I greatly appreciate your help. Thank you very much. :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top