• PicŪ Basic


  • CountUntil

    A library module for use withLibrary Manager by JohnGB. This module has been written by Tim Box (Tim on PDS forum). The library module is offered on an as-is basis with no warranty as to its effectiveness, operation or reliability. Users use it at their own risk.

    Adds a new command called CountUntil

    Syntax

    Variable = CountUntil Port1, Pin1, Port2, Pin2, StopPinLevel

    Overview

    Count the number of pulses that appear on pin Until another pin equals the trigger level, and store the result in variable

    Operators

    Variable - a user-defined variable (byte word or dword).

    Port1 - a port or a byte variable or constant that represents the port address that the pulse is being counted on

    Pin1 - a pin number between 0 and 7 represented as a constant or byte that the pulse is being counted on

    Port2 - a port or a byte variable or constant that represents the port address that stops the count

    Pin2 - a pin number between 0 and 7 represented as a constant or byte that stops the count

    StopPinLevel - a constant or variable that represents the logic level to stop the counting 0 or 1

    Code:
    ' Count the pulses that occur on PORTA.0 until PORTA.1 goes high and display the results. 
        Dim WRD As Word          ' Declare a word size variable 
    
    Loop:
        Cls  
        WRD = CountUntil PORTA,0,PORTA,1,1  ' Variable WRD will contain the Count result
        Cursor 1 , 1 
        Print Dec WRD , " "      ' Display the decimal result on the LCD 
        GoTo Loop                ' Do it indefinitely
    Notes:

    The counter is incremented on the rising edge of a transition (low to high).

    The maximum value the count can obtain is 65535


    Download module

    Download: CountUntil
  • Recent Activity

    towlerg-21522

    FineLineIDE

    Thread Starter: normnet

    Coming soon a new IDE: FineLineIDE! Features include:<O:p</O:p Bracket lines linking If-Endif, For-Next etc.<O:p</O:p Tabbed explorer so...

    towlerg Today, 13:36 Go to last post
    Henk57-24049

    Compiler 3.6.1.7 issue with 16F1829 and I2C-LCD

    Thread Starter: Henk57

    Spend this afternoon with a compiler issue; no error's, but my LCD give only first line with squares, no characters, nothing. If I flash an old .hex...

    Henk57 Today, 19:31 Go to last post
    Beginner-798

    CData Table

    Thread Starter: Beginner

    Is there perhaps the possibility to extend the IDE with a 'Raw Flash' command? Currently I have the huge problem that if I want to program a web page...

    Beginner Today, 16:36 Go to last post
    Henk57-24049

    Pulse counter using COUNTER command

    Thread Starter: amod

    How I can use counter command for counting pulses on portd.3 of 16f877A.Iam making a 8 digit object counter.

    Henk57 Today, 19:43 Go to last post