building a microprocessor - time delay

Thread Starter

dottie

Joined Jul 23, 2011
2
Hi,
a year ago i thought it would be awesome to build myself a microprocessor out of discrete 74HC parts (I had no idea what it would be like). ATM I have a working ALU and memory unit, but I'm kinda stuck at a "SLEEP" instruction. I plan on adding a 8x8 LED array to my microprocessor, so I can play pong or something like that :)

So I bought 8 SIPO shift registers and connected the LEDs. So to draw a complete "scene" (64 bits) it takes me 8 steps ... But here's the problem: I need to draw the scene, then wait for some time to get user input and then redraw. I figured it would be best to check for input, then sleep for some time and do that over and over, before redrawing the scene.

I actually need some component, that stays on HIGH (5V) and when I trigger it, it would go LOW (0V) for some time and then back on HIGH again.

I think the best would be to use some sort of binary counter, but I decided to ask the wiser :)

Thanks !
 

kubeek

Joined Sep 20, 2005
5,796
If your procesor has conditional statements, then just make a while loop and count to some number before the program continues.
 

Thread Starter

dottie

Joined Jul 23, 2011
2
Yeah, that was my first thought, but I only have 8bit addressing, so 255 instrucitons is probably not enought to make 1 sec delay. I mean it is, but it would probably take up all the space left for the program itself.

PS: take jsem cech :)
 

kubeek

Joined Sep 20, 2005
5,796
What is your clock frequency?
For example a triple-nested loop that can make a delay of up to 256^3 ticks should take cca 8-10 instructions.
 

kubeek

Joined Sep 20, 2005
5,796
Here is a loop example in pseudocode, it should take 8 instructions to do the counting:

Rich (BB code):
X=200
Y=210
Z=220

a:
decrease X
if X!=0 jmp a
X=200

decrease Y
if Y!=0 jmp a
Y=210

decrease Z
if Z!=0 jmp a

this will take 200*210*220=9,240,000 ticks to get here, which should be
more than enough even if your processor runs at 10MHz which I doubt
 
Top