Showing posts with label microcontroller. Show all posts
Showing posts with label microcontroller. Show all posts

Monday, December 26, 2011

Notes/wish list/TODO's...

... for me.
Some of these projects will be posted here in some weeks or months - i hope.

Finished projects:
  • uploading the executable and source of "bool_solver 2"
  • "The (dirty) 7zip password cracker" with exe and source
  • brute forcing [code snippet]

Unfinished projects:
  • Presentation of the project "Dieselpunk PC"
  • Some words about the Open Logic Sniffer
  • Creating a VBS (Video Baseband Signal) with an 8051 (+ Open Logic Sniffer)

Future projects:
  • Reverse engineering the Canon EF protocol with the Open Logic Sniffer

Creating random numbers on a µC [code snippet]

This is a small C function, to feed srand() with a random seed. I wrote it some weeks ago just to test if it would be possible to get random seeds with an 8051 microcontroller without additional hardware. And yes, it is possible. I was using an AT89C51ED, but the code should work with every 8051 compatible microcontroller.
How does it work and why? I took a closer look in the data sheet of the µC and i saw that some bits and bytes in the special function registers (SFRs) are not initialized with "1" or "0". Some bits were marked with "x" and those are the interesting ones. The value of those bits can be "0" or "1" after power up - their initial value is random. All i had to do was to iterate over all those SFR-bytes and XOR them. I am sure generations of 8051 coders have had the same idea, but i did not study all available information regarding 8051 and random numbers.
Just call the function like that "srand(getRandom());", and you will have a new random seed, after each power up of the microcontroller. (A normal µC reset will not give you a new random seed!)

unsigned char getRandom( void )
{
     unsigned char *random;
     unsigned char k;
     unsigned char value;
    random = 0x80; //Starting address of the SFRs
    for (k=0; k <= 127; k++) //iterate over the 128 bytes of the SFRs:
        value ^= random[k]; //XOR the values
    return value; //return the random seed
}

Tuesday, December 28, 2010

UART toy - additional comments...

I forgot to mention, that the Linux program must be executed as root. Otherwise it will not work, because it needs low level access to the serial port.
And the program must be compiled with optimization turned on.

The correct preprocessor command for GCC under Linux is "__linux__" - with two underscores and in small letters.

All commands in the instruction set are stated as ASCII characters. The return values and the parameters are in hex.


If someone got the circuit to work with Windows XP, please inform me. ;)

Sunday, May 30, 2010

Processor artwork

Because i had a lot of processors and microcontrollers laying around, i made some "artwork" out of the stuff.
I bought a piece of ESD foam and sticked and glued all the stuff onto it.

Partlist:

Microprocessors:
  • Harris 80C286, 16 MHz
  • Cyrix 80387 math. co-processor clone, 33 MHz
  • Intel 80386DX, 33 MHz
  • Intel Pentium 1, 166 MHz
  • Cyrix Media GXm, 266 MHz
  • AMD K6-III, 400 MHz
  • AMD K6 2, 500 MHz
 Microcontrollers:
  • NEC 8085AHC
  • Siemens 80C537, 16 MHz
  • Atmel Atmega 8, 16 MHz
The two silver pieces in the middle of the foam are hard disk magnets, holding the foam on the magnet board.
An AMD 600 MHz Athlon slot a was to heavy to be glued on the foam. ;)