Nic Jones ([info]pfcblogshere) wrote,
  • Mood: Geek

LAN, Linux Software Sucks, Programming a PIC16F628A

Had a LAN Friday night. An old friend (from highschool) rang up and said, "We're starting in half an hour."

'Twas good to catch up. Tom had just finished and Environmental Science degree. And, upon surveying his job prospects, he's thinking of doing another degree. Robert had moved out of home into a share house. Morgan was still Morgan.

We played Warcraft III (Frozen Throne) for the first couple of hours. I'm not a huge fan of Warcraft III. I'm just not comfortable with the idea of heroes as the game uses them. The micro-managing of a hero's skill and experience seems to contrast with the strategic nature of the game. It's like you're playing two games, and they don't quite match up. So I generally got owned in Warcraft. Well, actually, half the games I played I came second, but I never won one, so I'd call that pwnage.

I pulled out my Myth III disk. Tom's eyes lit up. We would have had LANs playing the original Myth back in 98. Wow. We would have been 15. Those were headdy days. The dorf riots. The luck of getting your wights out just when the enemy is marching a squad of thrall past... Ahhh, good times.

I t had a couple of years, at least since Myth at a LAN. And I was just as out of practice, as I've only played the first five single player levels. But, oh, we got back into the swing of things quickly enough. A bit of Body Count, a bit of Last Man on the Hill, a bit of King of the Hill.

Tom and I, back in the day, were nigh on equally good. It was really a matter of who had been brushing up their skills more the previous week that would inch ahead at the LAN. At this LAN, I had a slight advantage, but good times were had all over.

Louis borrowed my Rockby catalogue at the meeting on Saturday. He's been working on metal etching processes for merchandising / committee badges. He has been using hydrofluoric acid, which is a hard substance to handle, as it tends to dissolve any container you put it in. (For example, it eats away at glass, so you can't use that) Rockby stock various photo-resist chemicals for etching the metal from PCBs. Though he thinks he'll be using paraffin wax.

I was in Dick Smith, and decided to purchase a PIC16F628A, because, well, it (and a 20MHz crystal) were about $15. The PIC microcontrollers are really common now, and I've been meaning to start playing about with them. They are basically a computer on a chip - flash memory, ALU, UART, ADC, PWM. Now I just have to figure out how to program the thing. The datasheet is 180 pages long.

It seems that programming this thing is no simple task. There seem to be some solutions, but they are more like a series of hacks that may or may not work. MacrocASM is still developing, and doesn't support some basic commands. It also only supports three programmers, one which doesn't take the 16F628, one which is prohibitively expensive (US$200) and a final one that was released in 1995, and was long ago considered insupportable. I'd have to copy the files over to an older machine to open them, too.

MacrocASM does look promising in a couple of ways, though. It's written to be extensible, and does support the PIC16F84A. (The 16F628A is an extension of the 16F84A, with more memory and two more timers.) It's also a simulator, which is pretty important. I don't know how good a simulator it is, but still.

Looking into open source territory is always a daunting thing for a long-time Mac user. I have certain (snobbish) standards. An application should have it's "OK" buttons on the right of dialog boxes. It should have "Quit" in the application named menu with the shortcut ⌘Q. Not "Exit", "End", "Close" or any number of other synonyms. Quit. There are just some rules. In a text area, if the insertion point is somewhere in the last line, but not at the end, pressing down should move the insertion point to the end of the line. There are no "Settings", there are "Preferences".

Open source software tends to play by its own rules. Well, it doesn't tend to play by any particular set of rules. Things are just all over the place. Look at something like Azureus - it's consistently one of the most active projects on Sourceforge, and is considered the torrent client to use on the Mac. But by goddess, the interface is horrid. Ugly buttons across the top, arbitrary mixes of dialogue boxes, some of which appear like this:
Free Image Hosting at www.ImageShack.us
Note the classy way the button text doesn't fit in the button, that the default button is in the wrong place, that the resize widget is strangely shaded, and the mess of selection colours in the list.


And really, Mac OS X has built in the Software Update system, which provides the exact same functionality to the system and which almost every user will have seen:
Free Image Hosting at www.ImageShack.us


And then, some Azureus dialogue boxes decide to appear like this:


These are some of the worst; they slide in from the right of the screen (somebody's idea of "cool", obviously"), sit at the bottom right of the screen, muck up the menu bar are oddly shaped and shaded, and the buttons, as you can see, are just out of this world. I have no idea what the programmer in question was on.

The Azureus interface is broken all over. The tabs are something I have never seen before, their close buttons are on the wrong side (which, I suppose is better than Firefox, which doesn't even associate the close button with the tab its closing, instead putting it on the right side of the screen but at the end of the tab bar) Somebody has obviously decided that bevelling is cool, as they have multiple levels of bevel. Each download exists in it own tab, which then has another set of tabs that look completely different to the first set. (This time in the middle, instead of on the left.) They are slightly more Mac OS-like, but suffer from the discolouration the buttons seem to.
Free Image Hosting at www.ImageShack.us


I don't think I could ever finish writing about what's wrong with the Preferences pane:
Free Image Hosting at www.ImageShack.us


First, it's a tab, not a pane. It introduces a tiny "Save" hidden down the bottom left - "Save" or "Apply", by the way, are extremely rarely seen on the Mac in this context. When you change a setting, it is changed. There's no redundant applying of settings. Scroll bars (which don't, by the way, work with the scroll wheel on any mouse) and huge empty spaces. Come on, people, how hard would it be to put some of these options next to each other instead of below the last?

And this is Azureus. As I said, one of the most used and updated open source projects. Azureus is a paradigm of usability compared to some. The idea of looking into open source programmes for PIC development not specifically written for the Mac is a scary thought. Do I really want to fight with software designed by Electrical Engineers like Pikdev?

And then there's the problem of programming hardware. Most cheap programmers plug into the parallel port of a PC. I don't think any Mac has ever had a parallel port. Some use serial connections. I'm a little surprised that this seems less popular than the parallel port - the devices are programmed by sending them serial data. The parallel port programmers use a hack of a driver to send serial data out a single in on the parallel port.

I'd like to program the chips from my PowerBook. Which means USB. There are a couple of USB programmers. Dontronics carries a few, and they're Australian. But the range they carry are Tony Nixon's kits, and they're not just USB to Serial converters - the USB interface has its own series of commands. There is this page, which offers a version 0.1 of some OS X compatible software to run it. The page claims to be 2005, which gives me some hope. But $89 for the programmer hardware is a bit much. I was thinking about buying World of Warcraft, after all.

The term "FTDI serial driver" keeps coming up in different contexts, and I'm not sure what it means. I think it might be an implementation of the generic driver for a USB to Serial converter. But I've never had to bother with this sort of thing. My USB to Serial convert worked out of the box on OS X. I've just read the FTDI website, but it's full of terms like "easiest route to migration" and "turnkey product services."

Yeah, I'm pretty sure the FTDI chips are just really common USB to serial converter chips. The drivers are free, and present a normal serial interface to the operating system. They'll show up for Mac OS X through the usual frameworks, and as the UNIX device "/dev/tty.usbserial-somethingorother"

So, MacrocASM could be used to write, compile and simulate whatever code I like. But I'll first have to figure out how to extend it to cope with the 16F628A. This is a task that I don't think will be hard, but it doesn't look trivial, either:
Free Image Hosting at www.ImageShack.us


I could use XCode to write the code, as I'm pretty sure there would be a way to get XCode to produce object files for the PIC. This may take quite a bit of stuffing about. But that wouldn't simulate the PIC for me.

It might be possible to extend MacrocASM to get it to talk to that $89 programmer directly, instead of having to take the compiled object file from MacrocASM and use that version 0.1 programmer, but that certainly won't be trivial:
Free Image Hosting at www.ImageShack.us


It's a series of hacks that might work. I could try a linux program and the USB to serial converter, build my own programmer hardware. I could lay down $89 for a USB programmer that should probably work and then expend a lot of effort trying to get an elegant solution (but risking that MacrocASM never makes it out of pre-release). Microchip (the company that make the PIC chips) really suck for not providing a decent development platform for their product. They make their money when you use the chip in a product, and therefore order thousands. But for that to happen, you've got to get engineers using your product. Microchip should provide a decent IDE for their chips for free. Shame on them for not.

I do have a good knowledge of C. Learning Objective C was one of the things that I was going to do these holidays (or at least make a start on learning), but I spent most of my time on the DDR pad instead. I have a book. I might drag it around Uni, as I have lots of time this semester.

Speaking of Uni, I start again tomorrow. Ridesharing with Eleanor means 9:00 start. I should probably get some sleep then. I wanted more holidays. I was just getting into it.

Jamie Cullum - These Are The Days
Tags: lan, microchip, myth iii, pic16f628a

  • Post a new comment

    Error

    Your IP address will be recorded 

  • 1 comments

[info]arran4

December 16 2006, 23:31:20 UTC 5 years ago

Ahh Myth, when it was instores I dismissed it as I didn't play computer games, now as I am wasting a fair bit of my time _not_ programming like I used to but infact watching anime, having online social interaction (esocial?) and staring into space/playing games. I am more interested in getting it..... Is there a collectors edition or somewhere I could leech the lot? :P


Anyway. I don't think the all GUI issues are Azs fault, of course they could try some weird hack to work around the Java implementations faults, or perhaps what you are seeing are the left overs of an attempt to give Mac users a more native feel.. Unsuccessfully, or perhaps you just have local settings which differ from the programmers. :P

Anyway as for the sliding messages, I _hate_ those. I have them too under linux. (Az is the defacto client for linux if you want features or plugins, such as a scheduler, which is the only feature I want atm.) However, the Popups cover my "system tray" which prevents me from opening az or seeing the time. To make matters worse, the buttons on the popups don't seem to receive input, but seem to absorb the input never-the-less. Which means I can't open Az to close it. However it doesn't register as a normal window, so when I am using a window manager capable of ctrl+alt+esc, I can't kill it. Ugg.

Why can't Java just use Qt rather then trying a WxWidgets with GTK+ and what they call native on the other systems. And Az for that matter, can't KISS at all.
Create an Account
Forgot your login or password?
Facebook Twitter More login options
English • Español • Deutsch • Русский…