PICAXE40X2 Nixie Clock

Dicky Mint

Senior Member
Hi, I'm in the process of designing a PICAXE40X2, Nixie Tube clock.

Instead of driving the Nixie Tubes with a dedicated IC, I am using the CD4028 BCD to decimal converter and utilising high voltage SMD transistors.

I am planning on multiplexing the display which involves switching the high voltage anode of the Nixie Tubes, as well as pulling cathodes to earth.

I am not familiar with the RTC module I'm wanting to use so have designed a small test circuit PCB to experiment with this and an OLED, using I2C commands.

Looking forward to hearing what you think about the practicality of my proposed method.



Senior Member
I think it's very practicable !.

RTCs, OLEDs, I2C etc are all easily handled by PICAXE, especially the X2 versions.

However, my plan would be to get the high voltage Nixie circuits and multiplexing working first, as this is the most critical part of the project.

There are plenty designs on line for Nixie driver circuits, it should be easy to use one as a guide.

Adding RTC and OLED later will be simple.



Dicky Mint

Senior Member
OK cool.

I've produced a 'proof of concept' to drive the Nixie's, admittedly with a couple of CD4017's but it works as designed.

So that's the HV side out of the way, except switching the Anode, which I didn't test!

I think I'll test the multiplexing on the first prototype of the clock, which is probably not ideal but its all a work in progress, learning as I go.

If its designed well it 'should' work well, leaving room for a couple of bugs and fixes.

I've designed a PCB for the Nixie Tubes, their driving CD4028's and the interface wiring.

And another one for the second layer, the PICAXE40X2 and its associated connectors.

They're designed to mate together.

A crash course on the I2C protocol would be useful.

As would one on interfacing a RTC, specifically the DS1302 module with a PICAXE, specifically the PICAXE40X2!

Don't know about the availability of those?

So I'm trying to do it my own way, after scanning quite a few other designs I decided on my approach.

I'm thinking the hard part will be the conversion of the data from the RTC to the format required by the Nixie board?

And of course the multiplexing?



Technical Support
Staff member
A crash course on the I2C protocol would be useful.

As would one on interfacing a RTC, specifically the DS1302 module with a PICAXE, specifically the PICAXE40X2!
That should be fairly easy and you don't really need to know much about I2C.

Don't know about the availability of those?
That's always a difficult one to answer in current times. It should be easy enough to use any RTC chip which is available. So mostly a matter of scoring retailers to see what they have in stock.

I'm thinking the hard part will be the conversion of the data from the RTC to the format required by the Nixie board?
Extracting the decimal digits for time and date is easy enough and then it's converting those digits to whatever format is needed to drive the Nixies which should be, you guessed it, easy enough, especially if using a BCD driver; you may not need even to convert the digit data.

And of course the multiplexing?
Again should be easy enough.

So a whole lot of "easy enough" there, or at least certainly doable with help if you need it. It is probably best to settle on an RTC chip or module to use, and provide a circuit diagram showing how the Nixie drivers are connected.

Dicky Mint

Senior Member
Hi Hippy,

Well that was a pleasant experience perhaps can do, can do, can do or perhaps could do, could do, could do?

I could provide the schematic but as you know its on a strictly need-to-know basis and I don't need to know so can't provide it!

I could provide the PCB design though.

I can imagine the field-day your going to have with my data bus arrangements?

I had limited space and was running on hope that crosstalk between data lines would be at an acceptable level, i.e. below the acceptable threshold!

I appeal to the generosity of PICAXEITES with a wealth more experience than I to give me more feedback.

Rick Capture of Nixie Clock PCB 01.PNG


Can I suggest you use the DS3232 RTC, Its ultra accurate and stable only losing seconds a year unless of course your updating via a network each day. Easily integrated via IC2...


Technical Support
Staff member
I can imagine the field-day your going to have with my data bus arrangements?
Looks okay. You can probably multiples using something lie below. You would need to change the pins and polarities to suit what you have -
#Picaxe 20X2

Symbol DATA_A_PIN     = pinC.0 : Symbol DATA_A_DIR = dirC.0
Symbol DATA_B_PIN     = pinC.1 : Symbol DATA_B_DIR = dirC.1
Symbol DATA_C_PIN     = pinC.2 : Symbol DATA_C_DIR = dirC.2
Symbol DATA_D_PIN     = pinC.3 : Symbol DATA_D_DIR = dirC.3

Symbol STROBE_DIGIT_1 = B.0
Symbol STROBE_DIGIT_2 = B.1
Symbol STROBE_DIGIT_3 = B.2
Symbol STROBE_DIGIT_4 = B.3
Symbol STROBE_DIGIT_5 = B.4
Symbol STROBE_DIGIT_6 = B.5

Symbol reserveB0      = b0

Symbol DATA_A_BIT     = bit0
Symbol DATA_B_BIT     = bit1
Symbol DATA_C_BIT     = bit2
Symbol DATA_D_BIT     = bit3

Symbol digit1         = b11
Symbol digit2         = b12
Symbol digit3         = b13
Symbol digit4         = b14
Symbol digit5         = b15
Symbol digit6         = b16

#Macro OutDigit(STROBE, digit)
  b0 = digit
  High  STROBE
  Pause 10
  Low   STROBE
  Pause 1

  DATA_A_DIR = 1
  DATA_B_DIR = 1
  DATA_C_DIR = 1
  DATA_D_DIR = 1

  digit1 = 1
  digit2 = 2
  digit3 = 3
  digit4 = 4
  digit5 = 5
  digit6 = 6

    OutDigit( STROBE_DIGIT_1, digit1 )
    OutDigit( STROBE_DIGIT_2, digit2 )
    OutDigit( STROBE_DIGIT_3, digit3 )
    OutDigit( STROBE_DIGIT_4, digit4 )
    OutDigit( STROBE_DIGIT_5, digit5 )
    OutDigit( STROBE_DIGIT_6, digit6 )
One thing I might suggest is increasing the spacing between pairs of digits on your PCB. One thing I have found using 7-seg displays is "111321" is a lot less easily interpreted than "11 13 21".

Dicky Mint

Senior Member
Thanks John,

I did have a look at that RTC module and I think I've got one hanging around, but it has slightly different pin-outs so I couldn't just substitute it in my PCBs.

Thinking about it though it wouldn't be a major job to change the wiring...

I'll have a think?

Hippy...There seems to be an awful lot of code for me to 'crunch' there it might take me a few days to digest it?

Thank you though you're help is very much appreciated.

As for spacing the digits, yup I agree a really good idea but I've already chosen the enclosure and its tight as it is, so perhaps I could add alphanumeric labels above the relative pairs of digits on the front of the case?

I was worried about the data bus on my PCB. I pulled a number out of my hat and guessed that the consecutive bus lines would possibly exhibit an additional 10pF in capacitance. I don't know if that's even ballpark, or if it would make much difference anyway at suitable multiplexing frequencies?

Looking forward to trawling the code you provided.


Dicky Mint

Senior Member
Hi Hippy,

I've looked through your code and I'm kinda confused.

There are concepts which I am not at all familiar with!

Like the #Macro, I haven't used the dir command before and neither have I used the STROBE command, nor the do/loop.

That said perhaps you could help me turn my idea into real code?

The Idea

1. Set the RTC time with my PICAXE08M2 project board, I mentioned earlier.
2. Read RTC on PICAXE40X2 (C.3 (CL) and C.4 (DA))
3. Send packet 1 with BCD number for first seconds digit
4. Pause a while
41/2. Increment 'on/off' on Nixie board i.e. select second seconds digit
5. Read RTC on C.3 and C.4 for BCD number for 2nd seconds digit
6. Send packet 2 in BCD to Nixie board
Remember D.5 - D.0 are one output only
7. Read RTC into PICAXE40X2 (C.3 & C.4)
8. Send packet 3 with BCD number to 3rd digit (1st minute digit)
9. Repeat
BCD is B.0 to B.3 (A>B.0, B.>B.1, C>B.2, D>B.3)

I'm thinking what I need above all else is a description of how to read the RTC clock module and what format that's in?

I think the rest I could, maybe, cobble together?



Technical Support
Staff member
Hippy...There seems to be an awful lot of code for me to 'crunch' there it might take me a few days to digest it?
Most of it is just to make things easier to change if your hardware doesn't easily suit the code or you end up with a crossed wire. It's much easier to change code than have to resolder things, though one can always do that towards the end of a project once one knows it works.

The key is "#Macro OutDigit". That takes a digit value 0-9 and converts its bits to go on the right lines for the BCD-to-10 driver. Then it strobes the 'anode enable' line to make that digit light. Pauses for persistence of vision to kick in, turns off, waits a little to ensure it has, then on to the next.

Using "dirX.Y" and "pinX.Y" allows direct setting of a pin level, rather than a slower "If bit set Then High Else Low" construct.

The "MultiplexLoop" Just repeats that cycle for all digits, values and and associated strobes.

"Test" just pre-loads some digit values so it should show "123456".

I wouldn't worry about reading or setting the RTC for now, just get things working with a "123456", then "098765" or similar to ensure all digits are fine.

It's best to get the multiplex concept working first, ensure it does, before adding more. With multiplexing it can sometimes be hard to keep it working without flickering or glitching, so best to get that sorted, work out what timing and constraints we have before deciding on the best way to read RTC.

Dicky Mint

Senior Member
Hi Still trying to sus out your code Hippy.

Another aside though, I'm using optoisolators to switch the high voltage anodes for multiplexing but I'm having doubts about them?

I'm wondering if I would be better off using a PNP driven by a NPN transistor for each digit?

This would take up more space but I think I could squeeze them in!

The optoisolator is the TLP627 and I'm worried about using it as a high side switch?

Thanks in advance


Dicky Mint

Senior Member
I'm sorry Hippy but I'm just not up to understanding your code!

Perhaps you could talk me through the use of the DIR command I just don't seem to get it?

In fact if you could talk me through all of it that would help?

I've tried googling it but without joy.

Sorry to bother you but I think I need a little guidance?



Technical Support
Staff member
Perhaps you could talk me through the use of the DIR command I just don't seem to get it?
Setting "dirX.Y" simply sets the X.Y pin as input or output -

"dirC.0 = 1" is the same as "OUTPUT C.0"
"dirC.0 = 0" is the same as "INPUT C.0"

Dicky Mint

Senior Member
Hi Folks, I've been kinda busy so it's been a while since I've posted.

I've put together my clock running a test program but unfortuneately it doesn't seem to work.

I've run some tests and I'm thinking I may have incorrect resistor values for my highside, high voltage, NPN/PNP switch?

I've drawn a schematic of the switch and attached it as I haven't any useful schematic drawing software atm.

I would be greatful for any input regarding this circuit and its values?

I can't remember where I got the resistor values from but I think I may have usefd 'iterative estimation'.


Senior Member

If that supply voltage is 130 volts, then you should probably (at least) swap over the upper 10k and 100k resistors. As shown, with the NPN switched on, the power in the 10k resistor will be about V2 / R = 16900 / 10 k = 1.69 Watts ! A typical CR25 (e.g. 250 mW) carbon film resistor isn't likely to last very long at that power. There's also the risk that the NPN will dissipate a transient 850 mW whilst it is switching, and check its SOAR (Safe Operating Area Rating) at 85v / 8.5mA (and as appropriate for the PNP). Perhaps also better to change the lower 100k (base-emitter) down to around 10k (not critical), or both (lower resistors) somewhat lower (down to ~1k).

Cheers, Alan.
Last edited:

Dicky Mint

Senior Member
Thanks Alan,

I missed an important bit out of my schematic a diode and a 15k resistor

These are shown in the updared schematic, attached.

I'm thinking that, that will change the situation somewhat?

Do you think that maybe I should replace all four resistors with 1k0 1/4 Watt resistors?

Rick Capture of npn-pnp switch 02.PNG


Senior Member

So is there a separate 15k and diode for each Anode driver (or is there only one Anode/Nixie Tube)?

How much anode current are you expecting (and at what voltage) and what is the power rating of the 15k resistor? Potentially, you still appear to have dissipations in the (middle) 10k and the 15k of up to over half a Watt each.

If you change the middle 10k to a lower value then you risk increasing the dissipation in the 15k to over a Watt, or perhaps destroying one of the transistors and/or stopping the circuit working at all (depending on the characteristics of the Nixie Tube) !

Cheers, Alan.

Dicky Mint

Senior Member

Well its a clock with six tubes but I'm planning to light just one nixie at a time and multiplexing.

This circuit is the one that selects each tube anode to light that specific tube, so only one 15k resistor.

My 15k resistor is a 2W one for head-room.

The high voltage is set at about 130V (give or take)

I've tested the cathode switches and they work fine its just the anode switches that I can't get working.

I'm expecting an absolute max of ten milliamps but aiming for two milliamps.

I'm sorry but I don't understand how to calculate the resistor values!

Any further assistance would be welcome!


Dicky Mint

Senior Member
ok I'm going back to the drawing board...

I'm going to build the circuit on breadboard, just as I should have done in the first place, and do some exhaustive testing.

It's not going to be pretty but it should be thorough?

Any encouragement would be greatfully received.



Technical Support
Staff member
I can't help with Nixies having never done anything with them but there do seem to be a number of projects out there where people who do seem to know what they are doing have worked through the issues. Those are the resources I would be ploughing through if I were thinking of doing it. For example -



Senior Member

Resistor calculations basically require Ohm's Law which defines a Resistance value (R) from the Voltage (V) applied across and Current (I) which flows through the Resistor. To avoid using lots of zeros, it's useful for us to employ "consistent units", for example of Volts , milliAmps and kOhms. The normal formula is R = V / I , which can be re-arranged as V = I * R or I = V / R , depending on which value we're trying to calculate. Similarly, the power (rating) P is given by multiplying the Voltage by the Current i.e. P = V * I (with a "consistent unit" of milliWatts) , which can again be arranged in alternative forms as P = I2 * R or P = V2 / R .

I've never actually used a Nixie Tube, but I believe they have similar characteristics to a Neon Lamp, i.e. as described by Wikipedia:

"Each cathode can be made to glow in the characteristic neon red-orange color by applying about 170 volts DC at a few milliamperes between a cathode and the anode. The current limiting is normally implemented as an anode resistor of a few tens of thousands of ohms. Nixies exhibit negative resistance and will maintain their glow at typically 20 V to 30 V below the strike voltage. "

So if we assume that your 130 volts is sufficient to "strike" the tube, then the Anode voltage should fall to about 100 volts and the current in the (PNP's) emitter resistor will be I = V / R = 30 /15k = 2 mA. That current exits the PNP through two terminals, the Base and the Collector (to the Anode) and as the transistor is being used as a switch (in this case), then E, B and C will all be at about 100 volts (above "Earth"). Thus the current in the base resistor (if 10k) would be 100 / 10k = 10 mA, but that is more than is available through the emitter, so we have a problem. :(

Another way to consider it is that the PNP Base-Emitter junction is a forward biassed diode (which drops about 600 mV) so we have a potential divider of 15k + 10k across the (130v) supply rail. Thus the transistor terminals are at about 130v * 10k / (15k + 10k) = 52 volts, which is highly unlikely to be sufficient to allow the Nixie Anode/Digit to strike.

So it looks to me as if the "middle" resistor needs to be at least 100k. That will pull approximately 1 mA through the PNP base (turning it on) but leaves only another ~1 mA to flow from the emitter through the collector to the Anode. Probably a higher resistance would be better, or alternatively, the 15k emitter resistor needs to be reduced to say 10k, even for an Anode current of 2 mA. Note that if several anodes are all connected to the same 15k resistor via one or more diodes (which appear to serve no useful purpose) then once any Anode is struck, then there will be insufficient voltage to activate any other digit. Therefore any illuminated digit must be switched off, before another digit can be lit.

Addendum: Whilst using a "common" 15k resistor may give some economy of component numbers, personally I would have used a configuration more like that shown in the link from hippy, i.e. a separate "Anode" (current limiting) resistor in each collector of the PNPs and a Base current-limiting resistor of up to 400k. That will still give a base current of around 300 uA, easily sufficient for a collector current of up to a few mA.

Cheers, Alan.
Last edited:

Dicky Mint

Senior Member
OK I've read and internally digested what you have said.

It all seems fine and thank you for your assistance?

I will make a test set up on breadboard to test the circuit, attached.

I'll not use the resistor in the PNP's collector as it would require a faitly major change in the PCB.

Although in subsequent iterations of the PCB I will do so.

I appreciate the assistance and the time put in on my behalf

Thank you again

Rick Capture of npn-pnp switch 03.PNG

Dicky Mint

Senior Member

Two major flaws that require a PCB redesign.

The anode driver above and the schoolboy error of not double checking the ABCD inputs to the CD4028.

I read ABCD when the datasheet clearly say ADCB!

Still can't quite believe it.

Are there any other major or minor things to upgrade or correct that you can see?

When the BCD input is 0000 I've put the Nixie Tube output to 1, then 0001 to 2, 0010 to 3 etc.

Is this the best configuration for converting the DS3231 RTC output to Nixie Tube digits?

If not it may require another major PCB upgrade.

Thank you for your time and effort in advance!

Rick Capture of corrected clock 01.PNGCapture of corrected clock 02 close up.PNGCapture of corrected clock 03 close up.PNGCapture of corrected clock 04 close up.PNGCapture of PICAXE40X2 PCB 01.PNG


Senior Member

Nice PCBs, and one of the great advantages of microcontroller-based circuits is that often it's possible to "patch" the data-signal connections in the main control program, either to correct for mistakes, or even intentionally, to simplify the connection paths of an original layout. For example, two pins B and D could be swapped with a lookup table like the following:
     A B C D    A D C B
 0   0 0 0 0    0 0 0 0   =   0
 1   0 0 0 1    0 1 0 0   =   4
 2   0 0 1 0    0 0 1 0   =   2
 3   0 0 1 1    0 1 1 0   =   6
 4   0 1 0 0    0 0 0 1   =   1
 5   0 1 0 1    0 1 0 1   =   5
 6   0 1 1 0    0 0 1 1   =   3
 7   0 1 1 1    0 1 1 1   =   7
 8   1 0 0 0    1 0 0 0   =   8
 9   1 0 0 1    1 1 0 0   =  12
10   1 0 1 0    1 0 1 0   =  10
11   1 0 1 1    1 1 1 0   =  14
12   1 1 0 0    1 0 0 1   =   9
13   1 1 0 1    1 1 0 1   =  13
14   1 1 1 0    1 0 1 1   =  11
15   1 1 1 1    1 1 1 1   =  15
Thus, a "pin swap" of a nibble in a variable byte b1 can be achieved with a lookup command such as:
LOOKUP b1 , ( 0 , 4 , 2 , 6 , 1 , 5 , 3 , 7 , 8 , 12 , 10 , 14 , 9 , 13 , 11 , 15 ) , b1

or more quickly using an EEPROM {or TABLE} READ construction such as:
symbol hour_base = 32      ; Start of lookup table
DATA hour_base , ( 0 , 4 , 2 , 6 , 1 , 5 , 3 , 7 , 8 , 12 , 10 , 14 , 9 , 13 , 11 , 15 )     ; "hour" pins
   hour_addr = hour + hour_base
   READ hour_addr , hour_pins
Normally, I would allocate Digit values as %0000 = "0" , %0001 = "1" , %0010 = "2" , %0011 = "3" , etc., because it's usually easier to calculate table addresses and offsets starting from zero, or integer multiples. But any sequence could be "fixed" with a LOOKUP or READ command as above. Perhaps useful because Wikipedia suggests that not all Nixie tubes have the same internal Digit sequence (but doesn't mention the pin sequence). But of course it is very important to ensure that all the High Voltage and Current supply rails do go to the correct pins. ;)

Cheers, Alan.

Dicky Mint

Senior Member
Umm thanks Alan, for the comment concerning my PCBs.

A look up table seems to be a good way forward!

I didn't notice that if I swapped B & D I'd get the origional ABCD arrangement.

But whatever the 'real' sequence turned out to be I could have used your method!

Look up tables are new to me but seem to be a useful apparatus.

I must admit to being a little out of my depth, especially with the best way to convert the output of RTC DC3231 to BCD value?

My test program of the Nixie Tube drivers seemed to display all the digits for each tube, although in the incorrect order, but I'm pleased with the Nixie Tube driver circuits.

I still have to get my head around lookup tables but this seems to be the way to go?

Good, but still quite a way to go....!

Just a thought, is it possible to attach video files to a post?



Senior Member

The LOOKUP ... command is particularly useful in that it's a single line that "Does What it Says on the Tin", but remember that the first entry is always numbered zero, not 1. Each data entry can be a number in any format (e.g. binary: %0101 , Hex: $5 , decimal: 5 , etc.) or they can all be combined into an ASCII string, e.g. LOOKUP b1 , ("0123456789ABCDEF") , b2 to display a "Hex" digit on an ASCII terminal/display. It's reasonably fast and doesn't consume a great amount of Program Memory, so it can be used multiple times in a program, but you wouldn't want to use more than about 16 or 32 entries in each list.

Alternatively, a Lookup Table can be located in EEPROM/DATA or TABLE or even RAM memory using the corresponding command, i.e. READ or READTABLE or PEEK and can contain up to 256 entries (i.e. for 8 bits/pins). For example, I used a 256 byte lookup table to "twist" the complete 8 bit data bus (i.e. D0 <---> D7, D1 <---> D6 , etc.) between a 20M2's Port B and the parallel bus pins of an OLED/LCD display, (rather than mount it upside down on a solderless breadboard). However, only one table can start at "address zero" in each type of memory, but smaller tables can start from any selected "offset" or "base" address (or most M2s have two "pages" of 256 bytes in their TABLE memory). For large or complex conversion tables, it may be worthwhile to write an intermediate PICaxe program, typically using the BIT variables (bit0, bit1, etc.).

Single-digit BCD (Binary Coded Decimal) digits are basically the same as the Decimal or Hex digit values, i.e. 0 to 9. The difference is that the values 10 to15 or $A to $F are "Not Valid" (or some 7-segment display drivers might generate special characters representing: a , b , C , d , E and F). Thus a BCD counter jumps directly from 9 (i.e. %1001) to 0 (i.e. %0000), perhaps with a "carry" to the next stage. All this needs only the Four Low bits of a byte, so the Four High bits can be used to contain another digit, where the "unity" digit has a "weight" of 16 rather than the normal 10. Thus in a BCD (up-) counter you might find an instruction of the form "IF b1 = 10 THEN b1 = 16".

Perhaps what you need to know is how to break the two digits in a BCD byte into two separate digits? The higher digit is conceptually easier, just divide by 16; for example a BCD value of $12 (i.e. %00010010) divided by 16 gives $01 or %00000001 or decimal 1. For the Low Digit you need to Hide or Delete the high bits which is usually done by using a "bitwise mask", e.g. b2 = b1 AND %00001111 (or other formats such as b2 = b1 & $0F). If you find this concept difficult, then you could alternatively multiply by 16 (to throw away the high digit by overflowing the byte) and then divide by 16 as before, i.e. b2 = b1 * 16 : b2 = b2 / 16 (note that this won't work as a single instruction b2 = b1 * 16 / 16 because multiple/internal calculations are performed to 16 bit word accuracy and the overflow won't occur).

Finally, No I don't believe it's possible to attach video clips directly to the forum, but they can be submitted to YouTube and the link posted here. Not really my province but erco/Eric uses the facility quite often.

Cheers, Alan.


Technical Support
Staff member
Another way to do it is by swapping the two bits in-situ ....
For b1 = 0 To 15
  b0 = b1
  Gosub ShowBinary

  ; Change ABCD to ADCB, 3210 to 3012
  SerTxd( "Inp : ", #bit3, #bit2, #bit1, #bit0, TAB )
  bit2 = bit2 ^ bit0
  bit0 = bit0 ^ bit2
  bit2 = bit2 ^ bit0
  SerTxd( "Out : ", #bit3, #bit2, #bit1, #bit0, CR, LF )
Inp : 0000      Out : 0000
Inp : 0001      Out : 0100
Inp : 0010      Out : 0010
Inp : 0011      Out : 0110
Inp : 0100      Out : 0001
Inp : 0101      Out : 0101
Inp : 0110      Out : 0011
Inp : 0111      Out : 0111
Inp : 1000      Out : 1000
Inp : 1001      Out : 1100
Inp : 1010      Out : 1010
Inp : 1011      Out : 1110
Inp : 1100      Out : 1001
Inp : 1101      Out : 1101
Inp : 1110      Out : 1011
Inp : 1111      Out : 1111
I always find the 'Swap by XOR' algorithm quite magical, hard to believe it works but it does.

The middle XOR is how it is because 'bitX = bitX^ bitY' is a little faster than 'bitX= bitY ^ bitX', but either works.

Using a separate variable, or an unused bit, and 'circulating the bits' is even faster ...
bit7 = bit2
bit2 = bit0
bit0 = bit7
Many of my output routines take an input byte as 'b0' with bits in an order which makes sense for the software and moves its bits into those of 'b1' to match what makes sense for the hardware or output wiring.

Manipulating bits is not as fast as having them perfectly matched throughout but can often simplify things or fix mismatch errors which may sneak in.

Dicky Mint

Senior Member
Thanks Alan and Hippy,

I think I follow your drift, Alan

I do like the lookup table as a concept and I think I'll will use it.

Hippy, as ever your sheer depth of understanding flumoxes me!

I'm trying to get my head round your code examples but, as before, I am just a 'bear of very little brain' sometimes.

I've got quite some stuff to process and assimilate.