Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 01, 2024, 05:33:31 05:33


Login with username, password and session length


Pages: [1]
Print
Author Topic: help about pic counter  (Read 9148 times)
0 Members and 2 Guests are viewing this topic.
hamid9543
Active Member
***
Offline Offline

Posts: 124

Thank You
-Given: 80
-Receive: 7


« on: December 28, 2005, 05:00:58 17:00 »

hi
i want for each count (by opto counter)show lcd decimal count.:cool: start count=0 and end count  determine by keyboard.
for ex:input keyboard=400  counter count to 400 then stop  and show on the lcd
thanks for help:confused: :confused: Wink
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #1 on: December 28, 2005, 05:36:56 17:36 »

show us some of your code the we may be able to help you can't just expect some one to say here you go mate this is what you want
 
we need more detail that is not a lot to go on
 
wizpic
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
hamid9543
Active Member
***
Offline Offline

Posts: 124

Thank You
-Given: 80
-Receive: 7


« Reply #2 on: December 29, 2005, 11:06:15 11:06 »

hi
step 1)
i want by keyboard (14 or 16 key): for ex when i press 450 lcd show   "press key =450"
step 2)
i want micro count with external clock and show conting on the lcd
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #3 on: December 29, 2005, 11:48:00 11:48 »

look here it gives you some samples
 
http://www.protongeeks.com/index.php?option=com_content&task=view&id=62&Itemid=27
 
hope this helps
 
wizpic
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
hamid9543
Active Member
***
Offline Offline

Posts: 124

Thank You
-Given: 80
-Receive: 7


« Reply #4 on: December 29, 2005, 02:08:52 14:08 »

hi
but i want  to use  keypad (no pc keyboard).same as keypad of tellephone.
thanks for your replay
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #5 on: December 29, 2005, 02:40:16 14:40 »

That will be some coding to do that
 
what code have you got so far
 
what about this one
 
http://www.protongeeks.com/index.php?option=com_content&task=view&id=15&Itemid=28
 
that should give you starting point instead of using the serot command print it onto lcd
 
wizpic
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #6 on: December 29, 2005, 03:16:35 15:16 »

Hi

This can be easily applied using PICBasic Pro, Mikrobasic, or Proton. There are built in functions for 3/4X4 Matrix "Telephone" kepapds in Mikrobasic. Aslo the same applies to Proton using inkey command. If you want to use PICBasic Pro, visit this page, it very outstanding example in deed.

I don't see that hamid9543 has specified a specific language to start with, so I assumed basic, unless hamid9543 has some other languages on mind. Let us know what language are you using.

Good luck
« Last Edit: December 29, 2005, 03:19:10 15:19 by metal » Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #7 on: December 29, 2005, 04:02:28 16:02 »

i think that hamid9543 is trying to do is you enter 450 and it displays 450 the sample page you is like the one i give but as you said Metal it's a good example and a good starting point.
by all means it can be done but it will not be easy it all depends on what experance he has got in programming. yes we are here to help but you have got to help yourself first.
 
Metal as you said we can only assume he means basic as he has placed it under baisc forum.
 
i have asked for hamid9543 to give more detail like what PIC and LCD and stuff like that
 
wizpic
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #8 on: December 29, 2005, 04:54:11 16:54 »

Quote from: Wizpic
i think that hamid9543 is trying to do is you enter 450 and it displays 450 the sample page you is like the one i give but as you said Metal it's a good example and a good starting point.
by all means it can be done but it will not be easy it all depends on what experance he has got in programming. yes we are here to help but you have got to help yourself first.
 
Metal as you said we can only assume he means basic as he has placed it under baisc forum.
 
i have asked for hamid9543 to give more detail like what PIC and LCD and stuff like that
 
wizpic


I did not understand this "You have got to help your self first" ??
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #9 on: December 29, 2005, 06:27:34 18:27 »

Basicly Metal hamid9543 is not fourth coming with a lot of information i think he is basicly hoping that some one will write the complete code and give it him on a plate. where as i come from some things don't quite work like that. the fun is all about learning. so basicliy the saying i'm willing to help any one who is willing to help them selfs it's a saying us brits use.
 
 
wizpic
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
tasosstr
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 95
-Receive: 14


« Reply #10 on: December 29, 2005, 10:13:29 22:13 »

Hello and from me,

For press 450 in proton you can make (in Proton +)

Device 18F452
XTAL = 4
   
Dim Key As Byte, i As Byte, KeyFinal As String * 8

Main:
     Key = InKey
     Key = LookUp Key,[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

           Select Case Key
                   Case 0
                       KeyFinal = KeyFinal + "0"
                       GoSub PrintKeyFinal
                  Case 1
                       KeyFinal = KeyFinal + "1"
                       GoSub PrintKeyFinal
                   Case 2
                       KeyFinal = KeyFinal + "2"
                       GoSub PrintKeyFinal
                   Case 3
                       KeyFinal = KeyFinal + "3"
                       GoSub PrintKeyFinal
                   Case 4
                       KeyFinal = KeyFinal + "4"
                       GoSub PrintKeyFinal
                   Case 5
                       KeyFinal = KeyFinal + "5"
                       GoSub PrintKeyFinal
                   Case 6
                       KeyFinal = KeyFinal + "6"
                        GoSub PrintKeyFinal
                   Case 7
                       KeyFinal = KeyFinal + "7"
                        GoSub PrintKeyFinal
                   Case 8
                       KeyFinal = KeyFinal + "8"
                        GoSub PrintKeyFinal
                   Case 9
                       KeyFinal = KeyFinal + "9"
                        GoSub PrintKeyFinal
                   Case 10
                      If KeyFinal = "" Then
                         Cls
                         Print At 1,1,"Nothing Selected"
                         DelayMS 1000:Cls
                         GoTo Main
                      EndIf
EndSelect

Goto Main

PrintKeyFinal:
    Cls
    Print At 1,1,"Pin Selected ",KeyFinal
    DelayMS 300
Return




Try that and tell me if you have any quastion...

For Count you use the Command PulsIn

Best Regards,
Tasosstr
Logged
tasosstr
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 95
-Receive: 14


« Reply #11 on: December 29, 2005, 10:19:15 22:19 »

The sample from Proton+ for Counter


Syntax
Variable  = PULSIN Pin , State

Overview

Change the specified pin to input and  measure an input pulse.

Operators


    • Variable - a user defined variable of type bit, byte, byte array, word, word array, dword or float.[/size][/font]
    • Pin - a Port.Pin constant that  specifies the I/O pin to use.
    • State - a constant (0 or 1) or name  HIGH - LOW that specifies which edge must occur before beginning the  measurement.
    Example

    DIM VAR1 as BYTE
    Loop:
     VAR1 = PULSIN  
    PORTB.0 , 1  ' Measure a pulse on pin 0 of PORTB.
    PRINT Dec VAR1 ,
    " "       ' Display the reading
    GOTO Loop    
                ' Repeat the process.  

    Notes

    Pulsin
    acts as a fast clock that  is triggered by a change in state (0 or 1) on the specified pin. When the state  on the pin changes to the state specified, the clock starts counting. When the  state on the pin changes again, the clock stops. If the state of the pin doesn't  change (even if it is already in the state specified in the Pulsin  instruction), the clock won't trigger. Pulsin waits a maximum of  0.65535 seconds for a trigger, then returns with 0 in variable. The  variable can be either a word
    or a byte . If the variable is  a word, the value returned by Pulsin can range from 1 to 65535 units.  
     
    The units are dependant on the frequency of the crystal used. If a 4MHz  crystal is used, then each unit is 10us, while a 20MHz crystal produces a unit  length of 2us.
     
    If the variable is a byte and the crystal is 4MHz, the  value returned can range from 1 to 255 units of 10µs. Internally, Pulsin  always uses a 16-bit timer. When your program specifies a byte, Pulsin  stores the lower 8 bits of the internal counter into it. Pulse widths longer  than 2550µs will give false, low readings with a byte variable. For example, a  2560µs pulse returns a reading of 256 with a word variable and 0 with a byte  variable.

    See  Also COUNTER
    PULSOUT
    Logged
    hamid9543
    Active Member
    ***
    Offline Offline

    Posts: 124

    Thank You
    -Given: 80
    -Receive: 7


    « Reply #12 on: December 30, 2005, 07:21:03 07:21 »

    thanks thanks thanks
    plaese excusme ! i am amator in pic program
    i using pic basic pro and hardware is 16f876

    metal  i visit your link but micro code studio  not compil  this program( 4 error).
    i explain about my project by example:
     
    example1)      i  press   "5"   then    "3"    then    "3"    then   "#"    lcd show      press key is    "533"
    example 2)     i press     "2"  then    "1"    then    "#"                     lcd show       press key  is    "21"

     
    step 2)when show lcd what key pressed counter count  to pressed key please read below example:
    i press 320  on key pad :  lcd shown  press key is   "320" and   then   counter  count to  "320"
    (clock for counter  make by opto counter in external pic)


    tasosster i using pic basic pro no proton thanks for your help
    Logged
    Wizpic
    Global Moderator
    Hero Member
    *****
    Offline Offline

    Posts: 1200

    Thank You
    -Given: 550
    -Receive: 409



    « Reply #13 on: December 30, 2005, 09:27:31 09:27 »

    hamid9543
    i understand more now what your teying to do
     
    is this a timer you want to create?
     
    i have code for timer where you use a pot(dial) to set time and then press btuuon and it times down it can be set to time up is this the type of thing you are trying to do ?
     
    wizpic
    Logged

    When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
    hamid9543
    Active Member
    ***
    Offline Offline

    Posts: 124

    Thank You
    -Given: 80
    -Receive: 7


    « Reply #14 on: December 30, 2005, 08:04:31 20:04 »

    hi metal
    i explain this project again for you ,clearly
    i try to design project that:
    step 1)    lcd shows the number  that i press in keypad(for example: 412  or  21   or  9  or  etc...)
    step 2)    and then timer count from  "0"   until  this number
    step 3)    and  then output become  high(output is led)
     mention::: the clock  for timer provid by external source ( for  example  : optocounter)
    Logged
    metal
    Global Moderator
    Hero Member
    *****
    Offline Offline

    Posts: 2420

    Thank You
    -Given: 862
    -Receive: 678


    Top Topic Starter


    « Reply #15 on: December 31, 2005, 10:24:35 22:24 »

    Hamid,

    No need to explain any thing for me, or other members. As Wizpic said, help is given to those who are willing to help their selves first, unfortunately, wizpic didn't know how to say it the right way, he might be suffering with the right english syntax !!

    Any way, instead of asking others to serve you a code on a plate, you better start reading about registers of the PIC MCU you are using, and try to know what each one does, no need to read about PCLATH, start from status register, as this will help you find out how registers control the operation of PIC a Little bit.

    Another thing, read the manual of the compiler you are using, that very important for your first project with PIC MCUs.

    Of course, as soon as I see the first portion of your OWN code, I will be happy to giude you, as well as other members here on the forum.

    MetaL
    Logged
    hamid9543
    Active Member
    ***
    Offline Offline

    Posts: 124

    Thank You
    -Given: 80
    -Receive: 7


    « Reply #16 on: January 01, 2006, 10:54:22 10:54 »

    thanks metal
    you guide me very much
    Logged
    Pages: [1]
    Print
    Jump to:  


    DISCLAIMER
    WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
    USE CONTACT US TO REPORT ILLEGAL FILES
    ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

    ... Copyright © 2003-2999 Sonsivri.to ...
    Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC