• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC16F883 need code for counting people

mbarazeen

Member
Hi
I am new to PIC programming, i am using MikroC PRO, i tried simple codes for LED blinking. of cause i am in the learning process. I have few PIC16F883 with me.
But i need support to write a code for me. My son will do a project for his school and the task is to count the people when they enter a room.
I have no issue in hardware side, understanding outputs and multiplexing etc,

There will be two sensors at the entrance S1 & S2 connected to the inputs of PIC
one input PB for resetting the counter to zero
if interrupt goes in sequence, S1 first then the counter will increment by one, if S2 first then it will countdown. Max delay time 5s.


outputs
a 7 segment display 2 digits, common cathode. (roll overs after 99, but not necessarily. if pic is having enough outputs then the coding can be for 4 digits)
one out put to switch on room light if counter is non zero.

ignore all exceptional situations, such a s negative count etc.

If you are sending the code please specify the pins. C code also will be fine, i prefer a working hex file, so that i can directly download to the PIC from pickit-3.
oscillator frequency 8 Mhz.

appreciate your supports

thanks
Razeen
 

MaxHeadRoom78

Well-Known Member
Hi
I am new to PIC programming, i am using MikroC PRO, i am in the learning process.
But i need support to write a code for me. i prefer a working hex file, so that i can directly download to the PIC from pickit-3.
Razeen
Be a job working with a HEX file if you really want to learn programming!!
Max.
 

mbarazeen

Member
Be a job working with a HEX file if you really want to learn programming!!
Max.
due to limited time, i requested final one. it may take months for me to accomplish this task by learning, his project is to be submitted next week.
i can still do this by using basic logic gates, thought of go with PIC instead.
 

Pommie

Well-Known Member
Most Helpful Member
If the sensors are close enough that they both get covered by a person then google rotary encoders, there's lots of example code.

Mike.
 

gophert

Well-Known Member
Most Helpful Member
If the sensors are close enough that they both get covered by a person then google rotary encoders, there's lots of example code.

Mike.
Not a problem if they are both covered. The only problem is which order they get covered/uncovered.
 

Latest threads

EE World Online Articles

Loading

 
Top