Some progress 26/1/08
Three days, and I'm still going strong! :-).
Spent a wee bit of time to finish testing the 5V rs232 testing network, which I will use for prototyping the software. This makes up layer 1 of the OSI model for testing complete, being the physical link. The next step is the data link layer, for which I have to dust off my 'C' programming which I've not done for a while, as the Linux PC end will be coded in C.
Fig 1.Testing up till this point the data has just been echoing ASCII characters back to a terminal program. Initially from a parallax Basic Stamp II at 2400 baud, and then using the PIC16F870 at 2400, then 19200 which is my target baud rate.
Fig 2.Figure 2 shows the test setup so far, PC interface coming in the bottom, MAX232 RS232 driver on the board connected to the serial cable. Basic stamp on the right, PIC16F870 on the left. Figure 1 is a rough sketch of how the test serial bus works electrically.
You could actually use this type of bus quite reliably in a small scale application with short wire runs between the PC and slaves, maybe five or six meters.
Once it's all working I'll shift it to 2-wire RS485 so I can run the units up to 1000m away from the PC.
All of the code on the PIC/Device is in in assembler, and I'm using MPASM for the coding there.
On the PIC end I've done the code for the basic receiving and transmitting of serial data, which is a no-brainer as it has a UART built in. I've also go the 5khz 'tick' which will be the basis of the real time functions for the device such as checking for serial frame timeouts, pulsing outputs etc.
The tick is achieved via the timer1 interrupt on the PIC. Running at 20Mhz the chip does 5Mips, allowing for 1000 instructions to be executed, give or take, between interrupts which will not pose any problems.
I need the tick function working at this early stage so I can establish the basic functionality of my Data link layer.