Can you help me with algorithm sir?
Hello again,
Well, it starts with a hardware circuit using XOR gates. The logic statements for these gates are then entered into the uC in the required code. When the program is run, it simulates the logic gates and outputs a random number.
The required connections for the logic gates can be found on the web. I would have to look it up to determine the code but if you care to do this then go ahead and try first. If you have problems i'll do a search and see what i can find.
The logic is pretty simple though because the XOR gate is not hard to write out in Boolean logic or even more simple computer code as i'll show with this small pseudo code block...
rem For inputs a and b and output c we have:
c=xor(a,b)
Or when we dont have the xor function available:
c=0
if a=1 and b=0 then c=1
elsif a=0 and b=1 then c=1
end if
Or alternately:
c=0
if (a=1 and b=0) or (a=0 and b=1) then c=1
Or in boolean logic (where '*' indicates logic AND and the apostrophe represents the NOT function):
c=a*b'+a'*b
unless of course you have a built in XOR logic function (shown by an 'x' here):
c=a x b
So the idea is to find the hardware connection you prefer (depending on how many 'gates' you want to use and the max speed) and then write out the logic statements, then program it into the uC chip or into memory of some kind.