Do you wonder how to do vector operation in Delphi? No, of course, :). We could go like this. function tform1.adv(a,b:real):real; begin adv:=a+b; end; The problem is the return is real, which is single value only. We want a and b as vector. Wait... How we define vector in Delphi? I don't know. I used to treat a vector in Delphi as array. So I coded it like this var a,b:array[0..1]of real; So far I had no problem. Lately, I am going crazy with overuse functions in Delphi, and trying operating vectors using function too. But if I write the code like this function tform1.adv(a,b:array[0..1]of real):real; begin adv:=a[0]+b[0]; {a[1]+b[1]?} end; It will only return one value. So I improvised by modify it

Here we are. The code below is a part of (unfinished) array of JK flip-flop that draw the output on stringgrid. The problem is, we want to change input (J and K) at  the runtime which is easy if the code is not flexible (just add several button), but as we can see, the code is flexible so there is big no no for the manually added button. So we want to click the corresponding cell and the value changed (in this case toggled, 1 to 0 or otherwise). Here the code

This code's updated version from flexible one (whic is by itself is updated version from this) :) . It has added feature so we could reset the counter if it reach a certain denary (decimal, it is :) ) and preset it to certain denary. To be able to do that we have to convert the denary to binary and distribute it among Q[0] to Q[n-1].

(Untuk mempercepat waktu load di laman Digital) Digital in Delphi Berikut adalah kode counter normal 3 bit. (Kode terbaru untuk counter dengan procedure rekursif dan jumlah bit yang fleksibel dapat dilihat di sini)

It's not flexible one.

Here we go... I plan to coding it in a way that it has flexibility in term of function. So I create two variable ft and ff, represent time domain and frequency domain function as two dimensional array, with the first index as 'function name' so it can be (in future) ft[0,i] as rect(x), ft[1,i] as cos(x) and so on.

Yup, recursive procedure (not recursive function, :) ). I use it to create a simulation about digital asynchronous binary n-bit counter, complete with the denary representation. n-bit means it's very flexible, you can change n and its output (stringgrid, thats it) automatically adjust itself, :) Here's the code

I like pineapple, apple too, uhm, guava yeah, red watermelon, yellow watermelon and mango. 

Yeah, I could eat them all day long. I still can stand it; even there's no any rice to eat, provided I have access to that heavenly fruits, :)

I urge you to eat that too, one at a time.

Want to edit Pages document 'on the fly' but don't have a Pages on iPhone? It's OK. Copy the content of your Page document by select all -> copy, then paste to Note app on OS X. Wait a moment, it will sync with the Note app on iPhone, complete with the formatting and the images, :)
Archive
Label
Popular Posts
Popular Posts
Loading