I found a serial bit bang program using direct port manipulation which won't compile - code attached below. It complains that PORTB is undeclared. I created a new sketch and included the softUart.h at the top.
I also found a version of 'blink' using direct port manipulation which compiles just fine and also refers to PORTB.
Arduino IDE 1.8.5, Arduino Nano
{softUart.h}
#define UART_SOFT_DDR DDRB
#define UART_SOFT_PORT PORTB
#define UART_SOFT_PIN PB1
#define UART_SOFT_BAUD 4800UL
//----------------------------//
#define UART_SOFT_DELAY_US (int) (1000000.0/((float) UART_SOFT_BAUD)+0.5)
#define softUartInit() UART_SOFT_DDR |= (1<<UART_SOFT_PIN); \
UART_SOFT_PORT |= (1<<UART_SOFT_PIN)
void softUartSendChar (char txData);
void softUartSendString (char *txData);
{Serial_Bit_Bang.c}
#include "softUart.h"
void softUartSendChar (char txData)
{
//txData = ~txData;
UART_SOFT_PORT &= ~(1<<UART_SOFT_PIN);
_delay_us(UART_SOFT_DELAY_US);
for (char i=0; i<8; i++)
{
if( txData & 1 )
UART_SOFT_PORT |= (1<<UART_SOFT_PIN);
else
UART_SOFT_PORT &= ~(1<<UART_SOFT_PIN);
txData >>= 1;
_delay_us(UART_SOFT_DELAY_US);
}
UART_SOFT_PORT |= (1<<UART_SOFT_PIN);
_delay_us(UART_SOFT_DELAY_US);
}
void softUartSendString (char *txData)
{
while(*txData != '\0') softUartSendChar(*txData++);
}