Writing Drivers
NWCCTV
Posts: 3,629
Where would be a good place to start if I want to learn how to write drivers for various hardware devices and what piece of hardware would be an easy item to start with?
Comments
If it's for the propeller I would suggest starting with some simple hardware like the '595 chip.
I have been writing a driver for the 74HC595, 74HC4094, and 74HC4021 shift registers.
The 595 and 4094 are serial in to 8 bit parallel out, and the 4021 is 8 bit parallel in to serial out.
I'm adding a pair of instructions to Mike Greens FemtoBasic. These code snippets are written in spin: This simple example expects the there are 4 chips strung in series for a total of 32 bits;
Any combination of output or input devices can be used.
This consumes 4 Prop pins which must be in sequence.
1 = Shift Clock
1+1 = Register Clock
1+2 = Serial Bits Out
1+3 = Serial Bits In
Ok these examples are specific to FemtoBasic but the concept is sound.
Enhancements:
Allow from 1 to 4 or more chips on a set of 4 Prop pins.
I am looking for a code snippet that will be the equivalent of a "ROL", Rotate Left, spin instruction that can rotate 2 to 31 bits instead of the standard 32 bits.
Duane J
It really is a simple chip to start with. Only needs 3 signals to start with (plus power and ground of course), SER, SCK, and RCK. Download the data sheet and buy a '595 locally along with 8 hi efficiency leds and 8 180 to 220 ohm resistors. Connect the leds and resistors to the output pins of the '595, its SER, SCK, AND RCK pins to 2 free pins on the micro, ground the /G pin, put a pullup on the SRCLR pin and you are off to the races. I can post a block diagram if you want.