Counter pic16f84


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Apr 2009
    Posts
    5

    Default Counter pic16f84

    Hello all !!!
    I am new in programming,but in this moment I need help.I want make interface with pic16f84 for 8 electro mechanical counters.In main,I needs send decimal number with rs232 to PIC,and in one of them out pin,electromechanical counter must count impulses in value of sending of my PC.(for examples,I sent decimal value 10,and one counters must count 10 impulses).Is it possible and I need help.
    Yhank you for all
    Miro245

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    What kind of mechanical counter are we talking about here?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Apr 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default counter

    HI !!!
    I use electromechanical counter,and he works with 12V DC.Also I use IC driver ULN2804.Eny pinout and counter works diferents than other (If first count 10 impulses,second or ... count another number of impulses.I need help with this problem.
    Best regards
    Miro245

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I meant the part # of, this could help to find the datasheet...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jan 2009
    Location
    Ankara,TURKEY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default more information

    more information we need pls. add more explanation,

    I think pulsein command acn help you, try it or explain it completely
    Electrical & Electronic Engineering
    Undergraduate Student

  6. #6
    Join Date
    Apr 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Pic16f84

    HII !!!
    Look,my friend.I need make next :
    I must have interface with PIC16F84,and also he must connect with my PC.With any terminal program,I need to send decimal number,like 10 or 15 etc. to interface.With interface,I need 8 electrome chanical counters (he works with 12 V DC).For Examples:If I send A10 or another number,PIC must count with first counter 10 impulses.Or If I sent H10, eight counter must count 10 impulses.The A...,B...,C...,D...,E...,F...,G... anh H... is name of counter or his address.
    That is my problems and I must find solution for this interface.
    Thank you for any help
    Best reguards
    Miro245

  7. #7
    Join Date
    Jan 2009
    Location
    Ankara,TURKEY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    first you need to know how to communicate with pc using serial port, I have a laptop pc and it has no serial port so I dont know how to use serial port.

    but you can search on this foorum,there are lots of examples about it.

    you can send A10 or C10 to the pic with serial port, and the pic will select the counter according to the info that you send.

    And to understand when the counter finish count, you should find a solution.
    Does it informs you when it finish counting?
    Electrical & Electronic Engineering
    Undergraduate Student

  8. #8
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Well here's 75% of your project complete...

    http://www.picbasic.co.uk/forum/showthread.php?t=573

    The other 25% is down to you...

  9. #9
    Join Date
    Apr 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Counter pic16f84

    Yes,I have NOTEBOOK and adapter USB to RS232.You are rihgt.But,First or other counter port out work diferents than another.Any counter received yours decimal number and work counting.In second solution,if I (examples) send to first counter A10 and he started counting,and in next moment I send second A20,he must make sum nad continue counts to finish.Other works like first..
    Thank tou for yours help
    Miro245

  10. #10
    Join Date
    Apr 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Hello Melanie

    Thank you for you help.But,I have one question for you.If you send that one led blinks (examples) 15 second.He started,and in moment you send 10 plus.Is led blink countinius blinking 25 second???Is programs make sum like 15+10 seconds.???
    Thank you once gain
    Miro245

  11. #11
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Miro245, for activating your electro-mechanical device (counter) you will need to put the pic pin connected to it high for few milliseconds than low again, in doing so you will obtain one count. So the sub routine for activating counter A could be as follow:

    Code:
    Label_A:
    For A0=1 to ValueReceived
    HIGH Pin_x
    Pause 100
    LOW Pin_x
    Pause 100
    Next A0
    return
    Now let's assume you will send via RS232 a command A10 pic will receive the command and will decode it. It will read address "A", it will load 10 in the variable "ValueReceived" and it will gosub "LabelA" (since address was "A").
    Now the pic will make your electro-mechanical device counting up to ten, but since it is very slow pic will take two seconds to complete the job (100 millisecs + 100 millisecs x 10)
    You have to understand that during this two seconds you cannot send anything to your 16F84 because otherwise it will be lost, since the pic is busy to make your electromechanical device counting.
    One solution is that you wait for an answer from the pic telling you that the job has been completed and now it is still listening. To do that is pretty simple,
    at the end of the count you will activate the following code:

    Code:
    SEROUT Pin_y,baudrate,["done"]
    When your PC receive the word "done" you know that pic is available for receiving a new command, and you can send it. Now suppose you send A20
    pic will do the same work already explained above, but it will count 20 and it will take twice the time (4 seconds). Your electro-mechanical counter was recording 10 (the previous command) so at the end of the second command it will record 30 (10 + 20 "additive capability of the device).

    Pin_x and Pin_y are pic pins of your choise.

    Hope this will help you in completing your project.

    Al.
    All progress began with an idea

  12. #12
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I use IC driver ULN2804.
    I suggest you to use ULN2803 instead.

    Al.
    All progress began with an idea

  13. #13
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by miro245 View Post
    Thank you for you help.But,I have one question for you.If you send that one led blinks (examples) 15 second.He started,and in moment you send 10 plus.Is led blink countinius blinking 25 second???Is programs make sum like 15+10 seconds.???
    Thank you once gain
    Miro245
    The answers to all your questions are in the code...

    Code:
    		'
    		'	BLINK LED Command
    		'	-----------------
    	If Command=3 then
    		For CounterA=1 to Yvariable
    			Gosub LEDsON
    			Pause 200
    			Gosub LEDsOFF
    			Pause 200
    			Next CounterA
    		endif

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. Counter not counting !!!
    By lerameur in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 20th February 2009, 22:15
  3. Pic16f84 based pulse Counter
    By anzarsalam in forum General
    Replies: 5
    Last Post: - 4th August 2008, 02:50
  4. 20 Digit Virtual LED Counter
    By T.Jackson in forum Code Examples
    Replies: 9
    Last Post: - 19th November 2007, 05:02
  5. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts