Ne mogu mnogo da ti pomognem kada je PBP u pitanju ali kod Proton+ to izgleda ovako:
Code:
Syntax
Variable = COUNTER Pin , Period
Overview
Count the number of pulses that appear on pin during period, and store the result in variable.
Operators
Variable - a user-defined variable.
Pin - a Port.Pin constant declaration i.e. PORTA.0.
Period - a constant, variable, or expression.
Example
' Count the pulses that occur on PORTA.0 within a 100ms period and displays the results.
DIM WRD as WORD ' Declare a word size variable
SYMBOL Pin = PORTA.0 ' Assign the input pin to PORTA.0
CLS
Loop:
WRD = COUNTER Pin , 100 ' Variable WRD now contains the Count
CURSOR 1 , 1
PRINT DEC WRD , " " ' Display the decimal result on the LCD
GOTO Loop ' Do it indefinitely
Notes
The resolution of period is in milliseconds (ms). It obtains its scaling from the oscillator declaration, Declare XTAL.
Counter checks the state of the pin in a concise loop, and counts the rising edge of a transition (low to high).
With a 4MHz oscillator, the pin is checked every 20us, and every 4us with a 20MHz oscillator.
From this we can determine that the highest frequency of pulses that may be counted is: -
25KHz using a 4MHz oscillator.
125KHz using a 20MHz oscillator.
Uz sve ovo, monitorisanje odradis tako sto na ulazu upotrebis grec umesto jedne diode, tada imas signal od 100 Hz. Malko matematike, produzeno vreme merenja, usrednjavanje sa metodom FIFO,...
[Ovu poruku je menjao Sepa011 dana 13.02.2010. u 23:48 GMT+1]