Source code

News

03/20 | Created page

The hardest part of this project has been figuring out how to write the gosh-darn software to make the thing work together.

I've only gotten as far as writing the receiver portion of the code, the program sends IP address constants to the W5100 and then listens for incoming UDP packets. When it receives a packet it displays the information in the packet on the program editor terminal.

I had a couple of problems, one with my programming and one with the W5100 itself. First, my problem.

The W5100 uses a plethora of word (two-byte) variables. The Picaxe, however, only has 8 word-size registers to use. I went through a couple of iterations of the variable assignments before I finally settled on the ones in the present program. I'm curious about what I'll end up with when I write the section that transmits the data.

The second problem was hardware. At least I think it is. After reading the data from the W5100 you're supposed to set the receive read register (RX_RD) to the present value plus the number of bytes that you read from the buffer. For whatever reason the W5100 won't let me write the RX_RD register, so instead of just resetting the write location I'm forced to reset the entire W5100 and start over. It's ugly, but for now it works.

I've uploaded the code for reading UDP packets. There are a lot of symbols defined, but I think it's pretty well documented so you should be able to follow along.

Now that I have this part of the program done, next is to echo the data from the received UDP packet back to the sender. That shouldn't be too hard -- somewhere or another I have a bit of code I wrote that sends a UDP packet before I started keeping good records.

After that I need to make the send and receive subroutines work with any of the sockets, not just with socket 0. And of course I need to make it work with the SerialPower network.