COUNT command in (Parallax) PBASIC/BASCOM comparison

Status
Not open for further replies.

potoole64

New Member
Does BASCOM-AVR have a command similar to the PBASIC "COUNT" command? BASCOM-AVR has a "PULSEIN" command but I'm not sure of what it does. Will "pulsin" help count incoming pulses, or give the time between incoming pulses?

From BASCOM-AVR Help
Action
Returns the number of units between two occurrences of an edge of a pulse.
What "units" does it return?
How does the 'pulsein' command work? What value does it return?


From BASCOM-AVR Help
Syntax
PULSEIN var , PINX , PIN , STATE
PINX?

Remarks: PINX A PIN register like PIND

PIND? What's that?

Help will be greatly appreciated
Pat
 
Usually "Units" refers to a period of time indicative of the micro controllers clock speed. For example, if each cycle (command) takes 1uS to execute, then 1000 units could equal 1000uS.

That said, with higher languages (such as C, Basic, Pascal), its not usually a 1:1 basis, but rather somewhere in the realms of 1:5. For this example, that would mean that 1000 units would equal 5000uS.

This is just my interpretation, I'm sure either the help file or practical testing will be the easy solution

BTW, commands such as these are usually capped by the variable type that the macro/procedure is limited too. eg, if a word then the maximum value would be 65535, and 255 for a byte
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…