Advice on the smallest board available with direct port

Hello

I'm looking for advice. What is the smallest board available that can use direct port instructions?

I'm using a mega at the moment but I need something much smaller. This is a snip of what I'm running:

void loop()

{

    Htime=pulseIn(18,HIGH);      //read high time
    Ltime=pulseIn(18,LOW);        //read low time
   
    Ttime = Htime+Ltime;

    RPM=1000000/Ttime/2*60;    //getting frequency with Ttime is in Micro seconds, then divide frequency by two, as there are 2 pulses per crank revolution to give revs per second, multiplied by 60 to get revs per minute

//Writing RPM value to nixie tubes

    writeToPort = (RPM / 1000 % 10) << 4;
    writeToPort = writeToPort + (RPM / 100 % 10);
    PORTE = writeToPort + (RPM / 100 % 10);
    writeToPort = (RPM / 10 % 10) << 4;
    writeToPort = writeToPort + (RPM % 10);
    PORTD = writeToPort;


}

I'm a newbie and not so familiar with what is available and fumbling around in the dark a little here.

Thanks

Dave

In the Arduino family, I would look at the Sparkfun Pro Mini; it's more or less an Uno without the USB (and a lot smaller).

Not familiar with other makes.

You don't specify how many digital and/or analogue pins you need.

sterretje:
In the Arduino family, I would look at the Sparkfun Pro Mini; it's more or less an Uno without the USB (and a lot smaller).

Not familiar with other makes.

You don't specify how many digital and/or analogue pins you need.

Hi

Sorry... I need one digital input pin, and 16 digital outputs and one PWM output, unless I multiplex, then I guess I could get away with 5 digital outputs and 1 pwm but I'd like to not multiplex if possible.

So I guess that a Pro Mini will do. Analogue pins can be used for digital IO.

Can a pro mini deal with the port instructions in the function I posted up there?

What about the Micro? It would mean I don't have to multiplex then as there are enough IO pins. But I don't know which boards can and cannot use the port instructions.

Are there any other chips that can do this?

All AVR ports work the same way but how many ports varies from family to family. Uno has no Port E.

5V Arduinos with ATmega328P chips only have ports A to D and none of them have a port with 8 bits open to use (counting serial RX/TX as taken), only 6 bits. A 3.3V 328P board should have 1 port with 8 usable bits. You might check the pin map of any board you intend to use.

If you need 2 8-bit ports, you can go with the Mega2560 or roll your own duino using an ATmega1284P (40 pin DIP).

Indeed two 8 bit ports for sure.

Hmm. Looks like I stuck with a mega then. Unless there's a way of assigning puns to act as ports.

There are boards with an ATmega2560 in a smaller form factor than the mega. You can find them on eBay and Aliexpress, probably other locations too.

There are some fairly small ATmega1284P-based boards available for sale:

Might be worth a look through DrAzzy's Tindie store to see if any of those nice ATtiny boards will meet your requirements:

Thanks! That's a great idea!

arduino mega mini ?

You could use shift registers, then you only need three arduino pins. Do all 8 output pins have to change simultaneously? If not, then you could have the 8 pins split between two or more ports.

dave-in-nj:
arduino mega mini ?

good shout!

david_2018:
You could use shift registers, then you only need three arduino pins. Do all 8 output pins have to change simultaneously? If not, then you could have the 8 pins split between two or more ports.

I could use shift registers, the pins dont have to change simultaneously, they are for a nixie display. I would have to figure out how to code the sketch to then output to a shift register and I do struggle with coding :lol:

Shift registers... you load their internal registers and then "latch" those bits into the pins. Until the latch signal, the pins stay as they were. You can load 100's of bits into a chain of shift registers faster than anyone can see and change them all with one latch signal.

PS -- using the SPI bus (needs a library and more code) instead of shiftOut works faster.

GoForSmoke:
Shift registers... you load their internal registers and then "latch" those bits into the pins. Until the latch signal, the pins stay as they were. You can load 100's of bits into a chain of shift registers faster than anyone can see and change them all with one latch signal.

https://www.arduino.cc/en/Tutorial/ShiftOut

PS -- using the SPI bus (needs a library and more code) instead of shiftOut works faster.

thanks for that.

I'll have a look at how to shift out for nixie tubes. I have the problem that I have to represent each digit seperately... So to output "1234" as a number, it has to be done in binary and has to be done as 1, 2, 3, 4 not 1234, i.e. 0001, 0010, 0011, 0100 and NOT 10011010010.

Shift register chips I've used have a max total current output of about 40mA. With all 8 pins ON that's 8mA each. Even with leds I'd put a transistor (and 2 resistors) on each pin just so the current for each led could be the same no matter how many pins are ON.

With nixie tubes, how much current does each need?

There are driver chips that output more pin current, up to 150mA per pin IIRC. They're not cheap.

This is where I learned to breadboard 1284P chips:

On this site I like the Bobweeny for 1284P DIP chips. The Bobuino2 with SD and RTC is also a good one.
http://www.crossroadsfencing.com/BobuinoRev17/

AVR chip pins are good for continuous output of 25mA. If the tubes need more then you'd need a transistor and two resistors for each pin driving those via external power.

PS - fun fact, the ATmega1284P has 40 pins, same as the Intel 8088 used in IBM PC/XT and most XT clones. The thing to do back then was to buy a NEC V20 to replace the 8088 as the NEC did addressing in hardware making the V20 average 15% faster operation for about $10. And then the 80286 PC/AT's came out.

fall-apart-dave:
thanks for that.

I'll have a look at how to shift out for nixie tubes. I have the problem that I have to represent each digit seperately... So to output "1234" as a number, it has to be done in binary and has to be done as 1, 2, 3, 4 not 1234, i.e. 0001, 0010, 0011, 0100 and NOT 10011010010.

That is known as binary coded decimal (BCD), where each decimal digit is represented by a 4-bit binary number. Formatting the output data is no different from the way you are doing it for direct port manipulation, you just use the appropriate shiftout() instruction instead of writing it to a port. Do you have a schematic of the NIXIE tube display, or a link if you are using a pre-built display?

GoForSmoke:
Shift register chips I've used have a max total current output of about 40mA. With all 8 pins ON that's 8mA each. Even with leds I'd put a transistor (and 2 resistors) on each pin just so the current for each led could be the same no matter how many pins are ON.

With nixie tubes, how much current does each need?

I doubt current would be a problem, NIXIE tube displays commonly use a 74141 or similar BCD to decimal decoder to drive the tubes, so a shift register would have no problem driving the TTL input.

david_2018:
I doubt current would be a problem, NIXIE tube displays commonly use a 74141 or similar BCD to decimal decoder to drive the tubes, so a shift register would have no problem driving the TTL input.

Now I see why they were so popular a ways back, ease of use.

4 pins per digit plus pwr and ground?

The forum name for shift registers used to be "pin multipliers". I think that addressable led strips took over most of what members were using shift registers for back then.

You can drive Nixies directly with TPIC6B595s.

Three pins to drive many.