I just completed my RC6502 Apple-1 Replica kit and am attempting to load "pia_communicator.ino" to the arduino nano which is the serial interface for the RC6502 SBC. I have installed the required MCP23S17 library. When I attempt to verify/compile or upload the "pia_communicator.ino" file, I get a "no matching function for call to 'MCP23S17::MCP23S17" error. I have tried this on two different windows computers and a mac OS computer with the same results. Thanks in advance for any help with this project!
Your code does not match the (incompatible) libraries. Perhaps the PIA_Communicator_old is outdated and should be replaced? Or you get an older ino version...
Try to find more library versions and check the error messages containing "candidate" for better matching versions.
The problem seems to be this line: MCP23S17 bridge(&SPI, IO_SS, 0);
The MCP23S17 library you have installed doesn't know what to do with that first argument. It might work if you leave that argument out and use: MCP23S17 bridge(IO_SS, 0);
I do not get any errors compiling with the library supplied with the sketch.
How did you install the library?
If you already have another MCP23S17 library in the libraries folder, you can put the custom library in the same folder as the pia_communicator.ino file by doing the following:
Create a folder named "src"
Copy the MCP23S17 library folder to the src folder
Change the following line in the sketch:
//#include <MCP23S17.h> //original line
#include "src/MCP23S17/MCP23S17.h" //new line to use library in src
Change the following line in the MCP23S17.cpp library file:
David, thanks for your helpful reply. I made the changes that you suggested, but the IDE is returning the following error:
`Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano, ATmega328P"
/Applications/Arduino/Arduino 2.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino/Arduino 2.app/Contents/Java/hardware -hardware /Users/Erik/Library/Arduino15/packages -tools /Applications/Arduino/Arduino 2.app/Contents/Java/tools-builder -tools /Applications/Arduino/Arduino 2.app/Contents/Java/hardware/tools/avr -tools /Users/Erik/Library/Arduino15/packages -built-in-libraries /Applications/Arduino/Arduino 2.app/Contents/Java/libraries -libraries /Users/Erik/Documents/Arduino/libraries -fqbn=arduino:avr:nano:cpu=atmega328 -ide-version=10819 -build-path /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828 -warnings=none -build-cache /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_cache_443618 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -verbose /Users/Erik/Documents/Arduino/PIA_Communicator_old/PIA_Communicator_old.ino
/Applications/Arduino/Arduino 2.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino/Arduino 2.app/Contents/Java/hardware -hardware /Users/Erik/Library/Arduino15/packages -tools /Applications/Arduino/Arduino 2.app/Contents/Java/tools-builder -tools /Applications/Arduino/Arduino 2.app/Contents/Java/hardware/tools/avr -tools /Users/Erik/Library/Arduino15/packages -built-in-libraries /Applications/Arduino/Arduino 2.app/Contents/Java/libraries -libraries /Users/Erik/Documents/Arduino/libraries -fqbn=arduino:avr:nano:cpu=atmega328 -ide-version=10819 -build-path /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828 -warnings=none -build-cache /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_cache_443618 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/Users/Erik/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -verbose /Users/Erik/Documents/Arduino/PIA_Communicator_old/PIA_Communicator_old.ino
Using board 'nano' from platform in folder: /Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4
Using core 'arduino' from platform in folder: /Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4
Detecting libraries used...
/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/variants/eightanaloginputs /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828/sketch/PIA_Communicator_old.ino.cpp -o /dev/null
Alternatives for SPI.h: [SPI@1.0]
ResolveLibrary(SPI.h)
-> candidates: [SPI@1.0]
/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/variants/eightanaloginputs -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/libraries/SPI/src /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828/sketch/PIA_Communicator_old.ino.cpp -o /dev/null
/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/variants/eightanaloginputs -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/libraries/SPI/src /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828/sketch/src/MCP23S17/MCP23S17.cpp -o /dev/null
/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/variants/eightanaloginputs -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/libraries/SPI/src /Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/libraries/SPI/src/SPI.cpp -o /dev/null
Generating function prototypes...
/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/variants/eightanaloginputs -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/libraries/SPI/src /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828/sketch/PIA_Communicator_old.ino.cpp -o /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828/preproc/ctags_target_for_gcc_minus_e.cpp
"/Applications/Arduino/Arduino 2.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/Users/Erik/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/variants/eightanaloginputs -I/Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/libraries/SPI/src /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828/sketch/PIA_Communicator_old.ino.cpp -o /var/folders/_m/br5v6m7c8xj3yb006s6_0gf00000gp/T/arduino_build_85828/sketch/PIA_Communicator_old.ino.cpp.o
In file included from /Users/Erik/Documents/Arduino/PIA_Communicator_old/PIA_Communicator_old.ino:4:0:
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:1:2: error: stray '' in program
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:1:7: error: stray '' in program
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:1:12: error: stray '' in program
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:1:24: error: stray '' in program
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:1:37: error: stray '' in program
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:2:2: error: stray '' in program
{\fonttbl\f0\fmodern\fcharset0 Courier;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:2:10: error: stray '' in program
{\fonttbl\f0\fmodern\fcharset0 Courier;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:2:13: error: stray '' in program
{\fonttbl\f0\fmodern\fcharset0 Courier;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:2:21: error: stray '' in program
{\fonttbl\f0\fmodern\fcharset0 Courier;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:3:2: error: stray '' in program
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:3:12: error: stray '' in program
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:3:19: error: stray '' in program
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:3:28: error: stray '' in program
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:3:37: error: stray '' in program
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:3:42: error: stray '' in program
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:3:49: error: stray '' in program
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:4:2: error: stray '' in program
{*\expandedcolortbl;;\cssrgb\c0\c0\c0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:4:4: error: stray '' in program
{*\expandedcolortbl;;\cssrgb\c0\c0\c0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:4:23: error: stray '' in program
{*\expandedcolortbl;;\cssrgb\c0\c0\c0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:4:30: error: stray '' in program
{*\expandedcolortbl;;\cssrgb\c0\c0\c0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:4:33: error: stray '' in program
{*\expandedcolortbl;;\cssrgb\c0\c0\c0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:4:36: error: stray '' in program
{*\expandedcolortbl;;\cssrgb\c0\c0\c0;}
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:5:1: error: stray '' in program
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:5:11: error: stray '' in program
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:5:21: error: stray '' in program
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:5:32: error: stray '' in program
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:5:42: error: stray '' in program
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:6:1: error: stray '' in program
\deftab720
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:7:1: error: stray '' in program
\pard\pardeftab720\sl280\partightenfactor0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:7:6: error: stray '' in program
\pard\pardeftab720\sl280\partightenfactor0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:7:19: error: stray '' in program
\pard\pardeftab720\sl280\partightenfactor0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:7:25: error: stray '' in program
\pard\pardeftab720\sl280\partightenfactor0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:9:1: error: stray '' in program
\f0\fs24 \cf2 \expnd0\expndtw0\kerning0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:9:4: error: stray '' in program
\f0\fs24 \cf2 \expnd0\expndtw0\kerning0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:9:10: error: stray '' in program
\f0\fs24 \cf2 \expnd0\expndtw0\kerning0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:9:15: error: stray '' in program
\f0\fs24 \cf2 \expnd0\expndtw0\kerning0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:9:22: error: stray '' in program
\f0\fs24 \cf2 \expnd0\expndtw0\kerning0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:9:31: error: stray '' in program
\f0\fs24 \cf2 \expnd0\expndtw0\kerning0
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:10:1: error: stray '' in program
\outl0\strokewidth0 \strokec2 /
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:10:7: error: stray '' in program
\outl0\strokewidth0 \strokec2 /
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:10:21: error: stray '' in program
\outl0\strokewidth0 \strokec2 /*
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:41:1: error: stray '#' in program #ifndef _MCP23S17_H
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:42:1: error: stray '#' in program #define _MCP23S17_H
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:44:1: error: stray '#' in program #if (ARDUINO >= 100)
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:45:1: error: stray '#' in program
include <Arduino.h>\
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:46:1: error: stray '#' in program #else
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:47:1: error: stray '#' in program
include <WProgram.h>\
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:48:1: error: stray '#' in program #endif
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:50:1: error: stray '#' in program #ifdefPIC32MX
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:51:1: error: stray '#' in program #include <DSPI.h>
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:52:1: error: stray '#' in program #else
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:53:1: error: stray '#' in program #include <SPI.h>
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:54:1: error: stray '#' in program #endif
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:56:16: error: stray '' in program
class MCP23S17 {
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:58:1: error: stray '#' in program #ifdefPIC32MX
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:60:1: error: stray '#' in program #else
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:62:1: error: stray '#' in program #endif
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:68:14: error: stray '' in program
enum {
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:80:9: error: stray '' in program
};
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:88:1: error: stray '#' in program #ifdefPIC32MX
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:91:1: error: stray '#' in program #else
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:94:1: error: stray '#' in program #endif
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:112:1: error: stray '' in program
};
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:113:1: error: stray '#' in program #endif
^
/Users/Erik/Documents/Arduino/PIA_Communicator_old/src/MCP23S17/MCP23S17.h:1:1: error: expected unqualified-id before '{' token
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
^
PIA_Communicator_old:26:1: error: 'MCP23S17' does not name a type
MCP23S17 bridge(&SPI, IO_SS, 0);
^~~~~~~~
/Users/Erik/Documents/Arduino/PIA_Communicator_old/PIA_Communicator_old.ino: In function 'void configure_bridge()':
PIA_Communicator_old:43:3: error: 'bridge' was not declared in this scope
bridge.begin();
^~~~~~
/Users/Erik/Documents/Arduino/PIA_Communicator_old/PIA_Communicator_old.ino: In function 'void output_status()':
PIA_Communicator_old:61:30: error: 'bridge' was not declared in this scope
debug_value("Video D0-D6", bridge.readPort(IO_VIDEO) & 127);
^~~~~~
/Users/Erik/Documents/Arduino/PIA_Communicator_old/PIA_Communicator_old.ino: In function 'void pia_send(int)':
PIA_Communicator_old:106:5: error: 'bridge' was not declared in this scope
bridge.writePort(IO_KBD, c | 128);
^~~~~~
/Users/Erik/Documents/Arduino/PIA_Communicator_old/PIA_Communicator_old.ino: In function 'void serial_transmit()':
PIA_Communicator_old:158:14: error: 'bridge' was not declared in this scope
char c = bridge.readPort(IO_VIDEO) & 127;
^~~~~~
Using library SPI at version 1.0 in folder: /Users/Erik/Library/Arduino15/packages/arduino/hardware/avr/1.8.4/libraries/SPI
exit status 1
'MCP23S17' does not name a type
`
Looks like the MCP23S17 library you are using does not have the "readPort" and "writePort" functions that the sketch uses. Try using "read8" and "write8" instead, or use Google to locate the library that has the "readPort" and 'writePort" functions.
The (modified) library that is used with the sketch is included with the download from github, and is the one that should be used.
The original sketch should be pia_communicator.ino, not sure where the OP got PIA_Communicator_old.ino.
I changed "readPort" and "writePort" to read8" and "write8" but got errors until I restarted the computer and now it will upload! Thanks to you, David, and Dr Diettrich for your help! In the meantime, I had compiled a hex version of PIA communicator and got that working, also. You may be interested in seeing my Apple-1 Replica build video at: https://youtu.be/SdrbrfEB6EQ
Here is the working sketch per your suggested changes:
#include <Arduino.h>
#include <MCP23S17.h>
#include <SPI.h>
#define DEBUG 0
#define KBD_INTERRUPT_ENABLE true
#define KBD_SEND_TIMEOUT 23
#define IO_SS 10
#define IO_VIDEO 0
#define IO_VIDEO_D0 0
#define IO_VIDEO_D6 6
#define VIDEO_RDA 5
#define VIDEO_DA 3
#define IO_KBD 1
#define IO_KBD_D0 8
#define IO_KBD_D6 14
#define IO_KBD_DA 15
#define KBD_READY 2
#define KBD_STROBE 4
MCP23S17 bridge(IO_SS, 0);
void setup() {
Serial.begin(115200);
configure_pins();
configure_bridge();
output_status();
}
void configure_pins() {
pinMode(KBD_READY, INPUT);
pinMode(VIDEO_DA, INPUT);
pinMode(KBD_STROBE, OUTPUT);
pinMode(VIDEO_RDA, OUTPUT);
}
void configure_bridge() {
bridge.begin();
/* Configure video section */
for (int i = IO_VIDEO_D0; i <= IO_VIDEO_D6; i++) {
bridge.pinMode(i, INPUT);
}
bridge.pinMode(7, INPUT_PULLUP);
/* Configure keyboard section */
for (int i = 8; i <= 15; i++) {
bridge.pinMode(i, OUTPUT);
}
}
void output_status() {
Serial.println("RC6502 Apple 1 Replica");
debug_value("Video DA", digitalRead(VIDEO_DA));
debug_value("Video D0-D6", bridge.read8(IO_VIDEO) & 127);
debug_value("Keyboard RDY", digitalRead(KBD_READY));
}
void debug_value(String description, byte value) {
debug_value(description, value, 1);
}
void debug_value(String description, byte value, int level) {
if (DEBUG < level) return;
Serial.print(description);
Serial.print(": ");
print_hex(value);
}
void print_hex(byte value) {
print_hex(value, true);
}
void print_hex(byte value, bool newline) {
if (value <= 0xF) {
Serial.print("0x0");
} else {
Serial.print("0x");
}
if (newline) Serial.println(value, HEX);
else Serial.print(value, HEX);
}
void serial_receive() {
if (Serial.available() > 0) {
int c = Serial.read();
debug_value("PIA RX", c, 10);
pia_send(c);
}
}
void pia_send(int c) {
/* Make sure STROBE signal is off */
digitalWrite(KBD_STROBE, LOW);
c = map_to_ascii(c);
/* Output the actual keys as long as it's supported */
if (c < 96) {
bridge.write8(IO_KBD, c | 128);
digitalWrite(KBD_STROBE, HIGH);
if (KBD_INTERRUPT_ENABLE) {
byte timeout;
/* Wait for KBD_READY (CA2) to go HIGH */
timeout = KBD_SEND_TIMEOUT;
while(digitalRead(KBD_READY) != HIGH) {
delay(1);
if (timeout == 0) break;
else timeout--;
}
digitalWrite(KBD_STROBE, LOW);
/* Wait for KBD_READY (CA2) to go LOW */
timeout = KBD_SEND_TIMEOUT;
while(digitalRead(KBD_READY) != LOW) {
delay(1);
if (timeout == 0) break;
else timeout--;
}
} else {
delay(KBD_SEND_TIMEOUT);
digitalWrite(KBD_STROBE, LOW);
}
}
}
char map_to_ascii(int c) {
/* Convert ESC key */
if (c == 203) {
c = 27;
}
/* Ctrl A-Z */
if (c > 576 && c < 603) {
c -= 576;
}
/* Convert lowercase keys to UPPERCASE */
if (c > 96 && c < 123) {
c -= 32;
}
return c;
}
void serial_transmit() {
digitalWrite(VIDEO_RDA, HIGH);
if (digitalRead(VIDEO_DA) == HIGH) {
char c = bridge.read8(IO_VIDEO) & 127;
debug_value("PIA TX", c, 10);
digitalWrite(VIDEO_RDA, LOW);
delay(12);
send_ascii(c);
}
}
void send_ascii(char c) {
if (DEBUG >= 5) Serial.print("[");
switch (c) {
case 0x0d: Serial.println(); /* Replace CR with LF */
default:
Serial.print(c);
}
if (DEBUG >= 5) Serial.print("]");
}
void loop() {
serial_receive();
serial_transmit();
}
I imagine my solution is very, very wrong for several reasons but it compiled and loaded into the Nano which responds to the serial terminal at 115,200 baud.
I copied the MCP23S17.h file from the Github into the same folder in which I found Arduino.h (C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino).
I don't know if the program works properly in the RC6502 SBC as I've not finished building the board. I welcome your comments and will update this when the hardware is complete.