Go Down

Topic: Advice on the smallest board available with direct port (Read 244 times) previous topic - next topic

fall-apart-dave

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:

Code: [Select]
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

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.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

fall-apart-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.
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.

sterretje

So I guess that a Pro Mini will do. Analogue pins can be used for digital IO.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

fall-apart-dave

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

fall-apart-dave

#5
Sep 16, 2019, 07:18 am Last Edit: Sep 16, 2019, 07:20 am by fall-apart-dave
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.

https://www.arduino.cc/en/Reference/PortManipulation

Are there any other chips that can do this?

GoForSmoke

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).
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

fall-apart-dave

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.

pert

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:
https://www.tindie.com/stores/drazzy

fall-apart-dave


dave-in-nj


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.


fall-apart-dave

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:

GoForSmoke

#14
Sep 17, 2019, 08:11 am Last Edit: Sep 17, 2019, 08:23 am by 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.

1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Go Up