Friday, October 27, 2006

It is Ready to rock

The interface connectors on my embedded kit is now ready. I've wired them (darned, I had to hand-solder more than 30 tiny wires on a tiny board without zooming lense or microscope). I had tested the connectors, they were working OK.

First I tested the ADC connection with 10k potensiometer module. All ADCs (eight of them) could measure the analog inputs. The next one, I tested the output port, all the 8 LEDs worked. I've had a chance to test the last port (supposedly for GPIO), because it requires disabling interrupts on some of the lines and I still need to read the documentation.

I still have problem making the Real Time Clock (RTC) on board to work. I did not check the out signal coming of RTC data out, but I already verified the power connection were wired OK. There are 3 possibilites: my test program does not work, the I2C line is broken or the RTC chip is bad.

Will post again once everything works OK.

Wednesday, October 18, 2006

Digital Drug

A friend sent me about this about "Digital" drug:

As part of our dedication to being an open, transparent organization, here are the frequencies utilized in the production of the Digital Drug CD:

0.5 - 1.5 Hz - Endorphin release
0.9 Hz - Euphoric feeling
2.5 Hz - Production of endogenous opiates (pain killers, reduce anxiety)
4.0 Hz - Enkephalin release for reduced stress
10 Hz - Enhanced serotonin release. Mood elevation, arousal, stimulant
14 Hz - Awakeness, alert. Concentration on tasks
20.215 Hz - Brings about safe LSD-25 effects
30 Hz - Used for safe marijuana effects
33 Hz - Hypersensitivity, C. consciousness
38 Hz - Endorphin release
46.98 Hz - Visualization effects, when used with 62.64 & 70.47 Hz
Carriers: 90 - 110 Hz - Pleasure-producing beta-endorphin rise
111 Hz - Constant beta endorphin release

Sunday, October 15, 2006

CDMA (2)

Here is an improvement of the previous code. To simulate bit stream, I add a function to generate random number generator for each node.



#include <stdio.h>
#include <stdlib.h>

#define NUMBER_OF_SEQUENCES 8
#define IS_ORTHOGONAL 0
#define IS_NOT_ORTHOGONAL -1
#define N_NODES 4

typedef struct {
int chip[NUMBER_OF_SEQUENCES];
} ChipSeq;


void PrintChipSeq(ChipSeq *X);

int Add(ChipSeq *X, ChipSeq* Y, ChipSeq *R)
{
int i;
for (i=0; ichip[i] = X->chip[i] + Y->chip[i];
}
return 0;
}


int DotProduct(ChipSeq *X, ChipSeq *Y, ChipSeq *Res)
{
ChipSeq temp;
int i;

if (!X || !Y)
return -1;

for(i=0; ichip[i] = X->chip[i] * Y->chip[i];
return 0;
}

void InitChip(ChipSeq *A, int initVal)
{
int i;

for(i=0; ichip[i] = initVal;
}


int CheckOrthogonality(ChipSeq *X, ChipSeq *Y)
{
int i;
int sum = 0;

for (i=0; ichip[i] * Y->chip[i];

if (sum/NUMBER_OF_SEQUENCES == 0)
return IS_ORTHOGONAL; // it is orthogonal
else
return IS_NOT_ORTHOGONAL;
}


int RecoverBit(ChipSeq *S, ChipSeq *SenderSeq)
{
int i;
int sum=0;

for(i=0; ichip[i] * SenderSeq->chip[i];

return (sum/NUMBER_OF_SEQUENCES <= 0 ? 0 : 1); } int Negative(ChipSeq *A, ChipSeq *Comp) { int i; for(i=0; ichip[i] = -(A->chip[i]);
}


void PrintChipSeq(ChipSeq *X)
{
int i;

printf("[ ");
for (i=0; ichip[i]);
printf("]");
}

void CopySeq(ChipSeq* src, ChipSeq* dest)
{
if (src && dest)
memcpy(dest, src, sizeof(ChipSeq));
}


void ConvertToBipolar(ChipSeq *A, ChipSeq *Bip)
{
int i;

for(i=0; ichip[i] == 1)
Bip->chip[i] = 1;
if (A->chip[i] == 0)
Bip->chip[i] = -1;
}
}


void Send(int n, int bit[], ChipSeq node[], ChipSeq *S)
{
ChipSeq bp[N_NODES], temp;
int i,j;

if (n>N_NODES) return;
for(i=0; i if (bit[i]==1)
CopySeq(&node[i], &bp[i]);
else
Negative(&node[i], &bp[i]);
}
memset(S, 0, sizeof(ChipSeq));
for(i=0; i Add(S, &bp[i], S);
}
}


int GenerateRandom(void)
{
return random() % 2;
}


int main(int argc, char *argv[])
{
int i,j;
ChipSeq node[4] = { {{0, 0, 0, 1, 1, 0, 1, 1}},
{{0, 0, 1, 0, 1, 1, 1, 0}},
{{0, 1, 0, 1, 1, 1, 0, 0}},
{{0, 1, 0, 0, 0, 0, 1, 0}}
};
ChipSeq temp, b[N_NODES], s;
int bit[N_NODES];
time_t t;

for(i=0; i printf("Node[%u] = ", i);
PrintChipSeq(&node[i]);
printf("\n");
ConvertToBipolar(&node[i], &b[i]);
printf("Bipolar(node[%u]) = ", i);
PrintChipSeq(&b[i]);
printf("\n");
}

for (i=0; i for(j=i+1; j if (CheckOrthogonality(&b[i], &b[j])==IS_ORTHOGONAL)
printf("Node[%u] & node[%u] is orthogonal\n", i, j);
else {
printf("Node[%u] & node[%u] is NOT orthogonal\n", i, j);
exit(0);
}
}
}

time(&t);
srandom(t);
for (i=0; i<100; i++) {
bit[0] = GenerateRandom();
bit[1] = GenerateRandom();
bit[2] = GenerateRandom();
bit[3] = GenerateRandom();
printf("Send: A=%u B=%u C=%u D=%u\n", bit[0], bit[1], bit[2], bit[3]);
Send(N_NODES, bit, b, &s);
printf("S = !A + !B + !C + !D = ");
PrintChipSeq(&s);
printf("\n");

printf("Recover bit from A: S*A\n");
printf("Bit sent from A was: %d\n", RecoverBit(&s, &b[0]));
printf("\n");

printf("Recover bit from B: S*B\n");
printf("Bit sent from B was: %d\n", RecoverBit(&s, &b[1]));
printf("\n");

printf("Recover bit from C: S*C\n");
printf("Bit sent from C was: %d\n", RecoverBit(&s, &b[2]));
printf("\n");

printf("Recover bit from D: S*D\n");
printf("Bit sent from D was: %d\n", RecoverBit(&s, &b[3]));
printf("\n");
}
}

CDMA

I developed this simulation just for fun and only in a few minutes:


#include
#include


#define NUMBER_OF_SEQUENCES 8
#define IS_ORTHOGONAL 0
#define IS_NOT_ORTHOGONAL -1



typedef struct {
int chip[NUMBER_OF_SEQUENCES];
} ChipSeq;


int Add(ChipSeq *X, ChipSeq* Y, ChipSeq *R)
{
int i;

for (i=0; i
chip[i] = X->chip[i] + Y->chip[i];

return 0;
}


int DotProduct(ChipSeq *X, ChipSeq *Y, ChipSeq *Res)
{
ChipSeq temp;
int i;

if (!X || !Y)
return -1;

for(i=0; i
chip[i] = X->chip[i] * Y->chip[i];
return 0;
}

void InitChip(ChipSeq *A, int initVal)
{
int i;

for(i=0; i
chip[i] = initVal;
}


int CheckOrthogonality(ChipSeq *X, ChipSeq *Y)
{
int i;
int sum = 0;

for (i=0; i
chip[i] * Y->chip[i];

if (sum/NUMBER_OF_SEQUENCES == 0)
return IS_ORTHOGONAL; // it is orthogonal
else
return IS_NOT_ORTHOGONAL;
}


int RecoverBit(ChipSeq *S, ChipSeq *SenderSeq)
{
int i;
int sum=0;

for(i=0; i
chip[i] * SenderSeq->chip[i];

return sum/NUMBER_OF_SEQUENCES;
}


int Negative(ChipSeq *A, ChipSeq *Comp)
{
int i;
for(i=0; i
chip[i] = -(A->chip[i]);
}


void PrintChipSeq(ChipSeq *X)
{
int i;

printf("[ ");
for (i=0; i
chip[i]);
printf("]");
}

void CopySeq(ChipSeq* src, ChipSeq* dest)
{
memcpy(&dest, &src, sizeof(ChipSeq));
}


void ConvertToBipolar(ChipSeq *A, ChipSeq *Bip)
{
int i;

for(i=0; i
chip[i] == 1)
Bip->chip[i] = 1;
if (A->chip[i] == 0)
Bip->chip[i] = -1;
}
}


int main(int argc, char *argv[])
{
ChipSeq A = { {0, 0, 0, 1, 1, 0, 1, 1}};
ChipSeq B = { {0, 0, 1, 0, 1, 1, 1, 0}};
ChipSeq C = { {0, 1, 0, 1, 1, 1, 0, 0}};
ChipSeq D = { {0, 1, 0, 0, 0, 0, 1, 0}};
ChipSeq temp, ba, bb, bc, bd, ca, cb, cc, cd, sum;

printf("A = ");
PrintChipSeq(&A);
printf("\n");
ConvertToBipolar(&A, &ba);
printf("Bipolar(A) = ");
PrintChipSeq(&ba);
printf("\n");

printf("B = ");
PrintChipSeq(&B);
printf("\n");
ConvertToBipolar(&B, &bb);

printf("C = ");
PrintChipSeq(&C);
printf("\n");
ConvertToBipolar(&C, &bc);

printf("D = ");
PrintChipSeq(&D);
printf("\n");
ConvertToBipolar(&C, &bd);

// A + B + C sends 0 bits
Negative(&ba, &ca);
printf("!A = "); PrintChipSeq(&ca); printf("\n");
Negative(&bb, &cb);
printf("!B = "); PrintChipSeq(&cb); printf("\n");
Negative(&bc, &cc);
printf("!C = "); PrintChipSeq(&cc); printf("\n");

// now add
Add(&ca, &cb, &temp);

Add(&temp, &cc, ∑);
printf("S = !A + !B + !C = ");
PrintChipSeq(∑);
printf("\n");

printf("Recover bit from A: S*A\n");
printf("Bit sent from A was: %d\n", RecoverBit(∑, &A));
printf("\n");

printf("Recover bit from B: S*B\n");
printf("Bit sent from B was: %d\n", RecoverBit(∑, &B));
printf("\n");

printf("Recover bit from C: S*C\n");
printf("Bit sent from C was: %d\n", RecoverBit(∑, &C));
printf("\n");

}

Sunday, October 1, 2006

25 Ultimate PC Tools

System Cleaner: CCleaner at www.ccleaner.com
Disk Space Analyzer: WinDirStat at windirstat.sourceforge.net
File Shredder at www.handybits.com/shredder
Firewall: ZoneAlarm at www.zonelabs.com
Anti-Spyware: A-Squared at www.emsisoft.com/en/software/free/
Anti Virus: AVG Free Edition at free.grisoft.com
Rootkit Scanner: Blacklight at www.f-secure.com/blacklight
Anti-Malware: HijackThis at www.merijn.org
System Profiler: Blearc Advisor at www.belarc.com/free.download.html
Fan Controller: SpeedFan at www.almico.com/speedfan.php
File Monitor: Unlocker at ccollomb.free.fr/unlocker
USB Boot Management at tinyurl.com/kaytz
File Management: ExplorerXP at www.explorerxp.com
File Encryption: TrueCrypt at www.truecrypt.org
Notebook Power Management at www.pbus-167.com/nhc/nhc.htm
Windows Installer Manager: nLite at www.nliteos.com
System Recovery: BartPE at www.nu2.nu/pebuilder
Spam Filter: SpamPal www.spampal.org
LCD Maintenance: UDPixel at udpix.free.fr
Clipboard Recorder: www.lw-works.com

Saturday, September 30, 2006

Who says Google is Everything?

I always use Google to search all topics that I get interested. But it is so dissapointing that Google cannot list my personal webpage which I run at home. I did register my page manually using Google webmaster tool. I then used Yahoo to search, and you know what? it could find it!