• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Count and repeat.

Status
Not open for further replies.

AtomSoft

Well-Known Member
Hey all i know i have been gone for a while but ive been busy. I need a small amount of help. I want to create a device that can copy button presses and the exact time you press them and then the time it takes in between presses.

So if i press

BUTTON1 then wait 1 sec and press BUTTON2 then 500mS later i press BUTTON1 again.

The actual buttons dont matter just the timing. How can i gather the time it takes in a usable format so that i can repeat it?

If i have 1 button and:

press then delay for 200mS
Press then delay for 1sec

The delays are most important. Not exact timing like if im over or under a 100mS its still ok.

Should i set a delay for every 100mS and see if the button is pressed then count how long it is until the next button press?

Its kinda like playing a piano. I will later on enter the exact buttons to press but i need to collect the delay times for the buttons. If i can gather the delays i can enter the key for each delay later.

But i will have different Sets of unknown length. Like different songs.

Can someone please at least give me some pointers. Remember i dont really think i need a timer as it doesnt have to be down to the mS more like at least no more than a 500mS difference from original.
 

AtomSoft

Well-Known Member
by the way these can be 2 devices if need be. Like one to collect data aka delays and store it either to internal or external memory.

The other device can be a simple device where i will pic which set to load and then load the data and have it play out the buttons.

When collecting data a format like

10,2,3,5

would be nice. The numbers would be 1 = 100mS and so the 10 would be 1 second becuase 10 * 100mS = 1000mS aka 1 Second.

Now if i can manual edit the data or have it add the button from input to it so it would be like:

10,1,2,3,3,4,5,7

so it is acutally
1 second delay then press button 1
200mS delay then press button 3
etc...

You get it?
 

ericgibbs

Well-Known Member
Most Helpful Member
hi atom, Happy Easter.:)

Is this timing going to be MCU based or will logic do the job.?
 

AtomSoft

Well-Known Member
logic. It will be USER input like i will present the user with certain tones and they will press a assortment of buttons labeled from one to ten. 1 being low and ten being high now the point is to see how fast they can decide which note is high or low and rate it by pressing buttons as fast as they can. Also on visual items on a tv will flash and they have to press a button to match it. depepnds how fast the user is.
 

ericgibbs

Well-Known Member
Most Helpful Member
logic. It will be USER input like i will present the user with certain tones and they will press a assortment of buttons labeled from one to ten. 1 being low and ten being high now the point is to see how fast they can decide which note is high or low and rate it by pressing buttons as fast as they can. Also on visual items on a tv will flash and they have to press a button to match it. depepnds how fast the user is.
hi,
I was thinking in terms of a static ram ic, say 2 , 8 * 16k, an address counter clocking at 1msec. The counter would also drive a numeric display.

The pushed button would clock a high into say D0 while pressed, there could be upto 10 buttons, each writing to a different data line.
 

ericgibbs

Well-Known Member
Most Helpful Member
can you explain further?
hi,

Basically:
When you press a tone button it starts a 1msec clock into a counter.
The counter output pins are the address lines to static ram chips.
[and a numeric display].
The tone button writes a '1'bit into say D0.

The user button #1, when pressed writes a '1' into say D1.
You now have a precise stored time interval mark.
The difference between the tone '1' in D0 and the user '1' in D1.
You allocate the other D2 thru D11 to buttons #2 thru #10.

At the end of the game the tone markers are in D0 and all the user buttons are in D1 thru D11, spaced out according to the clocking rate [1ms] and the tome it took the user to press their button.

You can then step the counter from address zero and reading the display you can note the time difference in mSec from the tone mark/s and any of the user buttons markers.
 

AtomSoft

Well-Known Member
ok i did some thinking and there will be a max of 5 buttons for input. would it be possible to use a complete port like PORTB and just

value = PORB & 0b00011111
 

AtomSoft

Well-Known Member
wow that was so confusing maybe i should re-read it a few times. I guess ive been out of the game for a while lol.

I might plan on using a SD card for storage. But reading and writing to it RAW aka NO File System this way i can create a small header where i can allocate around 1 MB for each set. I can get a nice 32MB card from DipMicro for cheap:

32M TransFlash w/ SD adapter - dipmicro electronics

This way i can store 32 sets on it. Each with a nice amount of memory specially for it.

Ok the total time can be upto 6 minutes of data for each set. So if i do a check or collect data from a interrupt and round up or down the millisecond to the nearest 100 then i should be ok. Remember exact time isnt needed just no more than a 500mS difference.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top