2007-04-29

PIC-PG2C

PIC-PG2C is a simple JDM serial FLASH programmer. It runs directly off the serial port, requiring no external power source. There is some concern it will not work with low power serial ports, such as those found on laptops. I am happy to report however that it works on an IBM Thinkpad T20.





Cheers,

Steve

2007-04-28

For those playing at home


It seems some friends of mine keep track of me through my blog... which seems weird in a way, but OK :-) So for those ppl, I currently have chicken pox but is otherwise well.





Cheers,

Steve

2007-04-14

Writing fitting functions for lmfit

lmfit expects
fitting functions with prototypes in the form:




double
function_name(double, double *);





For example:




double
sin_fit(double t, double * p)


{


return p[0] + p[1] * sin ( 2 * M_PI * ( p[2] * t + p[3]));


}





Note that while "font:12px Courier, mono;">lm_minimize takes a
pointer to an array of parameters, it may not always pass
that pointer to the fitting function. Because of this
passing fixed parameters to the fitting function using the
3rd argument will yield incorrect results. For example, the
following code is wrong:




double
wrong_fit(double t, double *p)


{


return p[0]*p[0] + p[1];


}




....




double p[2];




p[0] = 1;


p[1] = magic_number;




...




lm_minimize(..., 1, p, ..., ..., ...., ...);




Here the fitting function "font:12px Courier, mono;">wrong_fit relies on a
fixed parameter "font:12px Courier, mono;">p[1] which it expects to
contain the value "font:12px Courier, mono;">magic_number. However it
will be passed such a "font:12px Courier, mono;">p that only "font:12px Courier, mono;">p[0] has a valid value
and p[1] is
undefined. This will lead to incorrect operation.




To work around this, you can use global variables, as
follows:




double magic =
magic_number;




...




double right_fit(double t, double * p)


{


return p[0]*p[0] + magic;


}




....




double p = 1;




...




lm_minimize(..., 1, &p, ..., ..., ..., ...);





Cheers,

Steve

2007-04-06

PIC Programming under Linux with KIT81

To get KIT81 and its variants working under linux, you need picprg, and configure it as follows:









PinPolarity
Vpp-
Vdd-
Clock+
Data out+
Data in+


The following screen shot shows what the configuration screen should look like:







Cheers,

Steve

asciigrams

asciigram: n.

A relative of the emoticon, an asciigram is an upright diagram of a gesture or body language construct using ascii characters.



Currently the following are somewhat popular:






\o/hands in the air
\o>salute
<o>hands behind/above head, surrender



Cheers,
Steve

Defending Others

Any people that would beat or kill you for insulting someone are not enlightened, cultural superiors. They simple zealous lunatics.


Cheers,
Steve

2007-04-02

CAT

Emacs and Vi are too bloated. If you must use a utility to compose text files in unix, there is a perfectly usable and full featured word processor right there in /bin on every POSIX compliant system.

I speak of the Computer Aided Text processor

It has a few command line options depending on whether you want your lines numbered, reduce unnecessary whitespace, and other conveniences. Each line is fully editable until you commit it by hitting the enter key. If something happens while you're typing it, not to worry: it autosaves after each line of text. Just use the -a (append) option when you run it again to finish the file.

You only need to remember one control sequence. Unlike those wannabe window managers like emacs and vi with their scores of non-mnemonic commands. When you're done typing in cat, hit ctrl-d (for done, of course) and that's it.


Cheers,
Steve