Sunday, January 31, 2010

Song of Storms

Great resources for the Legend of Zelda: Occarina of Time "Song of Storms" theme:

This guy posted the youTube lesson. Also many good videos of him playing:
http://www.youtube.com/watch?v=MPji9BGOHbs&feature=related

This guy's second violin version kicks ass. Also everything else by him:
http://www.youtube.com/watch?v=MTgaa6OUneY&feature=channel

A nice piano playing video:
http://www.youtube.com/watch?v=4YXwhs9WJYw

Thursday, January 21, 2010

Analog 3.3V supply:

From searching for a replacement for this stupid switching supply. So far, my own searches haven't turned up dual 5V-3.3V supplies, or small enough linear 3.3V supplies.

Here is a good 5V linear supply from mouser:
http://www.mouser.com/ProductDetail/International-Power/IHA5-12-OVP/?qs=sGAEpiMZZMu0oxGuRuNKH8MNxSrv1EW6IrFiMnkmiLI%3d
http://www.mouser.com/catalog/catalogUSD/640/2017.pdf

V-infinity will sell encapulated switchers like this one:
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=102-1571-ND

Analog 3.3V supply:

dividers in VHDL

Two nice versions of the same idea for making a divider in VHDL without doing stupid loops:

Here it is in simple, non-machine code:

http://www.missiontech.co.nz/index.php?page=read-an-article&articleId=85

Here is the same idea, implemented fully using cascades of adders/subtracters

http://www.cs.umbc.edu/portal/help/VHDL/samples/samples.shtml

And, surprisingly, here's all the source code for the above so that you don't have to do any thinking yourself:

http://www.cs.umbc.edu/~squire/download/divcas4_test.vhdl

Doing CRC

Some hints to answere the (presently unasked) question of whether the CRC algoritm being used is correct.

This page gives the background, with examples of how to compute CRC using loops (but not lookup tables), and seems to explain differences between three different CRC types, CRC-CCITT, CRC-16 and CRC-32:

http://www.netrino.com/Embedded-Systems/How-To/CRC-Calculation-C-Code

This forum page has discussions of CRC16, something called "Modbus Protocol", and "small table CRC".

http://www.cygnal.org/ubb/Forum1/HTML/002774.html

Here's the example for "small table CRC". Not sure what this means but it's neat:

http://wiki.wxwidgets.org/Development:_Small_Table_CRC

This page shows how to do a lookup-table CRC16 algorithm in the same way that the C program does it, thus at least answering the question the program. It also has a widget on top that will generate CRCs for strings on the fly, and below the CRC16 code it has a lookup-table example for CRC32. I just realized that the conding examples seem to be in VHDL:

http://www.efg2.com/Lab/Mathematics/CRC.htm

Here's some code for a CRC32 algorithm using a lookup table. The table seems to agree with the CRC32 example above:

http://www.naaccr.org/standard/crc32/crc32.c

This page talks about implementing CRC16 using 4-bit processing. Whoa.

http://www.digitalnemesis.com/info/codesamples/embeddedcrc16/

Wednesday, January 20, 2010

UDP, scripts, and NetCat

The goal was to make a shell script that would communicate to the UDP port on my Labview GSE program. I'm sure that I've done this in the past, probably using rsh and ssh but trying to search for info on that was even harder to find what I was looking for.

The end result is, give up on using a shell script and just compile something quick in C. In fact, complete examples were found on the web. On the way though, I found out a few neat things, in particular about NetCat. Eventually, I figured out how to download NetCat for windows, played with a slightly modified version of the Labview UDP server example, and got NetCat to talk to it after learning a valuable lesson about UDP ports versus TCP ports. (Gotta use the -u in netcat to get it to run in UDP mode. What's interesting is that the same socket number in TCP and UDP seem to be able to exist simultaneously! When I was stuck, I was getting a labview client and server to talk to each other over a particular UDP port while getting two copies of NetCat to talk to each other on the same port number but not to the labview, because I wasn't using -u.)

First off, the basic information about ports in Labview which made it obvious that for my application I wanted to use UDP rather than TCP:

nice overview that points the way towards using UDP ports:

http://zone.ni.com/devzone/cda/tut/p/id/4950

Forum thread reinforcing the above and pointing to examples:

http://forums.ni.com/ni/board/message?board.id=170&thread.id=465668

Another publication of the same overview in HTML:

http://zone.ni.com/reference/en-XX/help/371361E-01/lvconcepts/using_labview_with_tcp_ip_and_udp/

Some links in my struggle to dig up examples of sending UDP datagrams using a shell script:

Interesting section of AWK tutorial that mentions the /inet/ device???

http://74.125.93.132/search?q=cache:BJbtpUrLc9EJ:oreilly.com/catalog/awkprog3/chapter/ch10.html+write+to+udp+port+csh&cd=2&hl=en&ct=clnk&gl=us

A really awesome tutorial on setting up simple socket servers and clients, with an emphasis on TCP and enabling the socket service in inetd. After a few examples of cocking some things together with shell scripts and testing them with telnet to get the basic ideas down, it dives into C examples for examples that are more capable.

http://www.troubleshooters.com/codecorn/sockets/

Check out Q9 in this faq which just has you write to /dev/tcp. I wonder if there's a /dev/udp?

http://kornshell.com/doc/faq.html

finally, an example of using the sockets functions. Seems to be talking about using csh?

http://bytes.com/topic/php/answers/6883-sending-binary-data-via-udp

Links about Netcat:

The thread that pointed me to netcat:

http://74.125.93.132/search?q=cache:5vVKux-MP74J:www.unix.com/shell-programming-scripting/74802-script-send-something-via-udp-intercept-other-end.html+shell+script+udp+port&cd=3&hl=en&ct=clnk&gl=us

An example page for netcat. Also has an example that reminded me that I used to use rsh and ssh to do stuff like this:

http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/

A somewhat questionable tutorial, in that the emphasis seems to be on hacking other peoples' systems using netcat:

http://www.ol-service.com/sikurezza/doc/netcat_eng2.pdf

Another pointer to netcat, which also has a really nebulous hint about using rsh:

http://www.unix.com/unix-advanced-expert-users/38449-send-message-another-system.html

Getting netcat for windows. There wasn't a handy gnuwin page, but as usual there are plenty of people who have done all the work for me:

Here's the home page for netcat:

http://netcat.sourceforge.net/download.php

A security forum provides a link to the one popular windows port for netcat. Note that the comments are freaking hilarious, yet disturbingly helpful from my own pathetically lost starting point:

http://www.securityfocus.com/cgi-bin/index.cgi?c=toolcomments&op=display_comments&ToolID=139&expand_all=true&mode=threaded

The wikipedia page was unexpectedly helpful, and also provided the link to Jon Craton's blog.

http://en.wikipedia.org/wiki/Netcat

Jon Craton's blog. Oddly his examples are all about hacking as well. However, he led me to the Rodney Beede version:

http://joncraton.org/blog/netcat-for-windows

The Rodney Beede download of netcat, which has the -e option removed, and consequently is not blocked by Windows:

http://www.rodneybeede.com/Compile_Netcat_on_Windows_using_MinGW.html

Compared to what I was able to find about shell script options, tutorials for C coding were plentiful and complete:

I could always read the man page:

http://linux.die.net/man/7/socket

A really beautiful tutorial on programming sockets in C:

http://gnosis.cx/publish/programming/sockets.html

The example UDP C client code handed to me on a plate:

http://www.linuxhowtos.org/C_C++/socket.htm

I barely knew ya.

Anybody seen me?

http://www.notebookcheck.net/Review-Dell-Latitude-D830-Notebook.4305.0.html

The 830 seemed to vary from the 630 on account of screen size?

Parts and Pins for Molex connectors

For the V-infinity supply, the part numbers are:

3-position shell with ramp: 09-50-3031
4-position shell with ramp: 09-50-3041
sockets: 08-50-0106
all can be bought from Mouser

How the part numbers for the Lambda supply were found:

1. The shell that was in the supply from a previous user had the following number on it: MXJ 5199
2. Google searches got hits on both MXJ and 5199. The google hits for the 5199 were for datasheets for compatible sockets on Molex's website. Oddly, the pins seem to also be compatible for the "SPOX" connector line which seems to have no resemblance to the header and socket type connector that I was trying to find information about. Handy link to the page that had the link to the 5199 sockets. The header shown looks just like the one on the supply: http://www.molex.com/datasheets/pdf/0010311038_PCB_HEADERS.pdf
3. There is a molex 5199 series document which seems to list specs for the pins: http://www.molex.com/pdm_docs/ps/PS-5199-001.pdf
4. Eventually I traced from the pins to the shell drawing pdf, which even showed the raised 5199 markings. This gave me the Molex part number which is 10-63-3044:
http://www.molex.com/pdm_docs/sd/010633044_sd.pdf
Note that the three part number is called an "EDP. NO." number while the 5199 is called an "ENG. NO.". The EDP number is the one that appears in distributors' lists.
5. Note that this connector is neat because pin 1 is offset from the others by a half a pitch of dead space in the shell.
6. There was confusion of the meaning of number of "circuits". It seems to mean the number of pins aside from pin 1?
7. The shell's EDP number was found at MOUSER but is not available.
8. The molex page for 5199 shows the sockets under "use with", options are 5225 and 5194. The links for these bump me to lists of series with 10-digit numbers with no dashes but which seem to be EDP numbers.
9. Plugging all the socket EDP numbers, with dashes put in at the 4-2-4 intervals similar to other MOLEX part numbers at MOUSER got hits for all, but only a few were in stock:
08-70-1031 is a part number for a bag of 5000
08-70-1030 is individual sockets of the same type
10. Note that the socket drawing from molex is at:
http://www.molex.com/pdm_docs/sd/008701030_sd.pdf