Logicator COUNT function

TerryRy

Member
Logicator has a COUNT function, the result of which is assigned to a variable (A>T). As these variables are single byte (0-256) I would assume that the full 2 byte (0-65535) range available if programming in BASIC is not available. The variable assigned in Logicator would contain just the lower 8 bits of the result.

Can someone confirm this?
 

nick12ab

Senior Member
I would assume that the full 2 byte (0-65535) range available if programming in BASIC is not available. The variable assigned in Logicator would contain just the lower 8 bits of the result.

Can someone confirm this?
The manual says:
The Count command is available on certain PICAXE chips.
The Count command checks the state of the input pin and counts the number of low to high transitions within the time ‘period’.
Up to 255 transitions can be counted.
So that means you don't get the full 2 byte range. However you could use the BASIC cell if you wanted the full 2 byte range.

As these variables are single byte (0-256)
It's 0-255.
 

TerryRy

Member
I'm using the COUNT function to measure the rotational speed of a shaft. A hall effect device detects the teeth of a gear moving past and provides pulses for the 20M2 to count. I have worked out that I can set the COUNT period to a value (750mS) that will not cause the one byte variable to overflow even at the highest shaft speed.

My main purpose is to detect that the shaft has stopped when it should not have. With my arrangement I can detect a stopped shaft in a period between 750 and 1500mS. This works well for me.

I'm about to mock up the system to test the operation of the COUNT function under Logicator. As you say Nick12ab, I can always insert a block of BASIC if the function doesn't work the way we think it should.
 
Top