• 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 Yesterday, 16:49 Go to last post
    evoortman-388

    Pic16f18877 oread

    Thread Starter: evoortman

    Hi, On a PIC16F18877 the OREAD command doesn't seem to work. The code is working on a PIC16F1939. Both controllers use 32MHz int osc. If i...

    evoortman Yesterday, 11:13 Go to last post
    amod-29593

    Multiple functions by a single switch

    Thread Starter: amod

    Hi, How can I use multiple function by a single switch.I want to use 4 functions by a single switch.

    amod Yesterday, 17:15 Go to last post
    hadv215-2509

    FUSES for PIC18F47K20

    Thread Starter: gtv_pic

    000 Good morning I am using the PIC18F47K20 and in the help of the proton I did not locate the FUSES for said micro. Where can I locate...

    hadv215 Today, 00:22 Go to last post