KBIN has sloooow response?

RogerTango

Senior Member
Im running a 20X2 at the factory freq, FWICT it is 4mhz. The KBIN is supposed to 'revert' to 4mhz anyway, to read keyboard sigs.

Anyway, I *finally* got some code and wires working together.

The only "problem" (question?) is, it takes about 500 miliseconds from keypress to display on serial terminal window (F8) the result.

Is this typical, for it to take so long??


BTW, I noticed the 3 LEDs on the keyboard will blink once to, I assume, to indicate the keypress was registered and it is ready to accept another keypress. (If you press another key before the blink, it does not register)

Feedback or comments welcome... I had hoped for something a bit more "spiffy"..

Thanks,
Andrew
 

westaust55

Moderator
While the KBIN command requires the PICAXE to revert to the default speed for the KBIN it will revert to a higher speed after the KBIN command (unnecessary but you could also issue the SETFREQ command after the KBIN command) to increase the speed again which will make calcs, actions/decisions and data transfer to the PC faster.

From PICAXE Manual 1 page 90
Note that M2, X1 and X2 parts automatically switch to internal 4MHz operation to process these commands, so the external frequency
can be higher.
If you post your program code folks here can look at it and see if there are ways to improve the speed.
 
Last edited:

Andrew Cowan

Senior Member
Why the LEDs flash and how to control them:
Code:
kbled (keyled)
Syntax:
kbled mask
- Mask is a variable/constant which specifies the LEDs to use.
Function:
Set/clear the keyboard LEDs
Information:
This command is used to control the LEDs on a computer keyboard (connected
directly to the PICAXE - not the keyboard used whilst programming). The mask
value sets the operation of the LEDs.
Mask is used as follows:
Bit 0 - Scroll Lock (1=on, 0=off)
Bit 1 - Num Lock (1=on, 0=off)
Bit 2 - Caps Lock (1=on, 0=off)
Bit 3-6 - Not Used
Bit 7 - Disable Flash (1=no flash, 0=flash)
On reset mask is set to 0, and so all three LEDs will flash when the ‘keyin’
command detects a new key hit. This provides the user with feedback that the key
press has been detected by the PICAXE. This flashing can be disabled by setting
bit 7 of mask high. In this case the condition of the three LEDs can be manually
controlled by setting/clearing bits 2-0.
Effect of Increased Clock Speed:
This command will only function at 4MHz.
 

RogerTango

Senior Member
West, Ill post my code a little later, the Picaxe 'puter is not the same Im on.

Cowen, Thanks for the additional information, that was very helpful.

Andrew
 
Top