Like quite a few people I've been interested in using microprocessors for model railway control for some time (since before I started work in 1983 as I recall). A few years ago I became interested in the PIC but it wasn't until late 1997 I actually got hold of some hardware (a few PICs and the ITU programmer) and then the winter of 1999 finally saw some code coming to light.
My intention was to make the system as cheap as possible, this means no line driver chips. If possible it will be 5 volt PIC to PIC interfaces.The first devices I've played with are 4 MHz 16C84 chips and after several late nights I settled on a half duplex 4K8 asynchronous serial interface. The network stations will be daisy chained such that each acts as a booster relay avoiding long signalling runs. Using half duplex allows a single data line to be used between stations (Bods), however to connect to a PC's RS232 port a devices at one end of the chain needs to be a slight variant (the Boffin).
Unsurprisingly I got diverted and ended up playing with ideas for sequencing signals and PWM speed control. Whilst becoming frustrated trying to define a protocol for the network, in order to debug my applications, it occurred to me that all I needed initially was a little monitor program with a simple terminal interface. Hence this page, here I'm posting the code so far.
First I needed something to shift the bits in and out, asyn_srl.inc
Then something to manage the link, bod_link.inc .
With a working link it's on to the monitor itself, pic_mntr.inc .
Lastly a test program for the monitor, bfn_mntr.asm (and it's MP-LAB project, bfn_mntr.pjt ).
User documentation for the monitor program hasn't got very far (well I use it and I wrote it so I know what it does) however for the curious here's a cryptic list of the commands supported.
If you're wondering why the bulk of the code is in include files, it's easier than firing up the linker and allows the code to be easily re-used with different processor cores. I might one day get round to producing some some documentation, maybe. I've recently started using a 16C715 (I startedwith a 16C84) and hence added a command to the monitor program to read an A/D channel. Whilst working on this I realised the original EEPROM write software wasn't interrupt safe, it is now.
After getting the Boffin talking to the PC the next step is to daisychain on to the Bods, bod_mntr.asm (and it's project, bod_mntr.pjt ).
It's always been my intention to use a proper 16 bit CRC for the bodnet protocol and although I haven't even strated on this I have unearthed some bits and pieces on the subject that others might find useful or interesting.
With the monitor out of the way it was time to return to the idea of a data network. As a simple start I decided to go for a simple wiresender / receiver setup.
This comes in two parts, the transmitter wiresndr.asm (and it's project, wiresndr.pjt ) and the receiver wirercvr.asm (and it's project, wirercvr.pjt ). Since first posting I've realised there's a flaw in my logic on the transmitter side. This means the system won't work properly with more than two transmitters, I'll look at this some time.