I have never understood why Americans want to govern the world. As far as law, and American can be prosecuted for a crime overseas where it may not be a crime. I find this the same as the Taliban having a trial for a woman back in Afganistan who recently went to New York and walked the streets alone.
I saw this about giving up citizenship due to tax liabilities and I completely understand. The answer is simplicity. If you want people to follow the law, remove complexity. "Fair" is relative, because what is fair for one is not fair for others. How about firing 95% of the IRS and having a 15% flat tax? No reason to flee if everyone is the same.
Here is the US Constitution and the Amendments, which I have read. I see no provisions for anything that would not treat citizens equally.
Perhaps it is time to completely through out every law and start over. The Japanese did it at WWII and it seems to have worked, but the Japanese were completely defeated.
Perhaps with debt, complexity, and some skewed desire for "fairness", the USA should declare defeat and start from scratch with the laws.
One note about the US Constitution is that I believe it to be a superior document due to flexibility; whereas, the EU Constitution is just...confusing.
Friday, May 18, 2012
Thursday, May 17, 2012
Makefile and defines with a value.
Have you ever wanted to change some code without changing the code? I did this in the Makefile. I did this with a define from the compiler command line. A subset of the Makefiles follows:
<makefile>
# this is the top of the Makefile. I put switches here.
# comment out PRODVER if you want the original
PRODVER := MODIFIED
#MODIFIED Threshold for lower bounds
MODIFIED_THRESHOLD :=30000
#...
CFLAGS = -Wall -mlong-calls -ffunction-sections
ifeq ($(PRODVER),MODIFIED)
CFLAGS += -DMODIFIED=$(MODIFIED_THRESHOLD)
endif
CFLAGS += $(OPTIMIZATION) $(INCLUDES)
</makefile>
The Makefile makes the same thing as:
#define MODIFIED 30000
but it does it as -DMODIFIED=30000 when the line is passed to gcc.
I want to set the minimum value of bounds
The C code looks like this:
<main.c>
/*This is the modification the code based on code from the makefile*/
#ifdef MODIFIED //this is defined in the Makefile
if(bounds < MODIFIED) //for our current Makefile, this will become (bounds<30000)
{
bounds=MODIFIED; //this sets the minimum value to be whatever is in the makefile.
} //this line turns into bounds=30000;
#endif
</main.c>
Thursday, May 10, 2012
Entropy
Entropy is the energy in a system. If you want to add energy to an existing system, you must increase it from an external source. I modeled employment as entropy at one point, which I liked. This audio link is basically about entropy and employment. If you cannot add external energy, you cannot increase the entropy of the system. http://itunes.apple.com/us/podcast/job-killers-03.29.12/id330304186?i=112448960 I just wish someone would call it entropy. :/
Saturday, April 28, 2012
Sunday, April 15, 2012
KiCad has requirements before having a pick and place output file.
In order to export pad position in Kicad, you supposedly use the export footprint locations to the "modules position file". There is a catch. I exported my modules and the file was empty! I figured out later that one needs to include the "Normal+Insert" option in the KiCad libraries files. I had to go back later and edit every single one by hand on my board, but it was faster than redoing the board.
So, if you find that your module file is empty, edit the part to include "normal+insert", and retry the manufacturing export for pick 'n place and see if it helps you.
(PS: notice the "attributs" tag, hehe.)
So, if you find that your module file is empty, edit the part to include "normal+insert", and retry the manufacturing export for pick 'n place and see if it helps you.
(PS: notice the "attributs" tag, hehe.)
Friday, March 16, 2012
AT91SAM7S and 24 bit SPI transfer.
Most 16-bit DACs take a 24-bit word. After fighting with the PDC to get DMA working, I settled on a simpler solution. The following is an example of writing 24-bits to the SPI bus with an AT91SAM7S256.
unsigned int spi_24bit(unsigned int dacval)
{
AT91PS_SPI pSPI = AT91C_BASE_SPI;
//set SPI pins
static unsigned int perphA=
((unsigned int) AT91C_PA11_NPCS0 ) |
((unsigned int) AT91C_PA13_MOSI ) |
((unsigned int) AT91C_PA31_NPCS1 ) |
((unsigned int) AT91C_PA12_MISO ) |
((unsigned int) AT91C_PA14_SPCK ); // Peripheral A
static unsigned int perphB= (unsigned int) AT91C_PA30_NPCS2 ;
AT91C_BASE_PIOA->PIO_ASR = perphA; //set the SPI pins to the peripheral functions
AT91C_BASE_PIOA->PIO_BSR = perphB; //set SPI port B pins.
AT91C_BASE_PIOA->PIO_PDR = (perphA|perphB); //disable GPIO from changing SPI pins.
AT91C_BASE_PMC->PMC_PCER = ((unsigned int) 1 << AT91C_ID_SPI); //enable SPI clock
AT91C_BASE_SPI -> SPI_CR = AT91C_SPI_SWRST;//Reset the SPI
/*THIS IS A BIGGIE
The SWRST bit clears the MR register to defaults!
This means that you need to re-enable master mode after you use the CR reset.
*/
AT91C_BASE_SPI -> SPI_MR = 0x00000003; //master and variable select
AT91C_BASE_SPI -> SPI_CR = AT91C_SPI_LASTXFER|AT91C_SPI_SPIEN;//enable SPI
AT91C_BASE_SPI -> SPI_CSR[1]=0x00000808; //keep CS low until new xfer.
unsigned int databyte1=0;
unsigned int databyte2=0;
unsigned int databyte3=0;
databyte1 = databyte1 | 0x000D0000; // 0D selects CS1
databyte2 = (dacval & 0x0000ff00);
databyte2 = databyte2 >>8;
databyte2 = databyte2 | 0x000D0000;
databyte3 = dacval & 0x000000ff;
databyte3 = databyte3 | 0x010D0000; //toggle last transfer line.
pSPI -> SPI_TDR = databyte1;
while(!((pSPI -> SPI_SR)&0x00000002))
{ ;; //wait for the data to be sent out}
pSPI -> SPI_TDR = databyte2;
while(!((pSPI -> SPI_SR)&0x00000002))
{ ;; //wait for the data to be sent out}
pSPI -> SPI_TDR = databyte3;
while(!((pSPI -> SPI_SR)&0x00000002))
{;; //wait for the data to be sent out}
return(dacval);
}
Sunday, March 11, 2012
Subscribe to:
Posts (Atom)
