Counter pic16f84


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    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...

  2. #2
    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

  3. #3
    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

  4. #4
    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

  5. #5
    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

  6. #6
    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 : 0

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