The Power Of Pullups

Posted: 08 January 2012

Categories: blog keyboard NeXT hardware

Hacking away on the PIC16F88 trying to get it to talk to the NeXT host machine, and I kept getting very long rise or fall times for the signal when twiddling the TRIS bits. I also saw some very unusual signals on the clock line. It finally occurred to me that as an open collector bus, with no keyboard attached, the lines would float without the addition of pullups. I added two 10k resistors, and lo and behold, deterministic timings! With that I was finally able to start sending data to the NeXT machine.

I never claimed to be an electrical engineer… but even so.

NeXT Timing Dilemma

Posted: 05 January 2012

Categories: blog keyboard NeXT hardware

After getting most things working on the PIC16F88 I started looking at the timing. On the NeXT side, data needs to be transmitted after the channel select signal on the clock line, and there is only a few hundred microseconds on either side to do anything. On the PS/2 keyboard/mouse side, given the relatively slow transmission speeds, reading the data takes on the order of a millisecond. Basically, unless I want to run the PIC16F88 at a high clock rate and continuously sampling pins to detect bits, and then feeding detected bits into concurrent hierarchical state machines, we’re stuck. It’s doable, but the resulting code will be dense and almost impossible to understand. I actually started to write a simple state machine to PIC assembler compiler that would generate the concurrent state machines thinking it might be a better way to go…

Ultimately, I think the cleanest solution is to have multiple PIC processors… maybe 2 PIC12F683 or somesuch, one to handle keyboard/mouse and one to handle transmission to the NeXT. I can run a serial connection between the PICs at a high enough speed that we should be able to handle receiving data in the time window available on either side of data transmission to the NeXT.

PIC Assembly

Posted: 05 January 2012

Categories: blog keyboard NeXT hardware

I started programming the PS/2 to NeXT adapter in C, which was fine. I managed to get most of the important parts prototyped, including being able to handle the PS/2 mouse and keyboard, and also sending data to the NeXT. I switched to assembly language the other day, partly to save space, and partly to make sure I have complete control over timing etc. I must say it’s refreshing… most of the programming I do is in Java, C#, PHP etc. and in most of these stacks, there’s an awful lot of ‘magic’. On the PIC, in assembly, there is no magic; it does exactly what you tell it to do, and most of the higher-level testing methodologies don’t really apply. You have to be on your game a bit, which is actually very enjoyable. Reminds me of the ‘Good Old Days’.

Older posts are available in the archive.