Hello!
I am trying to control a 7-Segment Display using the Arduino Uno and the MCP23S17.
This is my Code so far( not sure tho if this is correct):
#define F_CPU 16000000UL
#include <avr/io.h>
#include <SPI.h>
#define DATAOUT 11//MOSI
#define DATAIN 12//MISO
#define SPICLOCK 13//sck
#define SLAVESELECT 10//ss
int main(void)
{
Serial.begin(9600);
PORTB = (1<<2); // Pull-Up-Widerstand
DDRB = (1<<2);
DDRD |= (0<< DATAIN); //schalte Pin 12 auf Eingang
DDRD |= (1<<SLAVESELECT) | (1<< SPICLOCK) | (1<<DATAOUT); //Pin 10,13, 11 werden auf Ausgang gesetzt
PORTD = (1<<SLAVESELECT);
SPI.begin();
SPI_CLOCK_DIV64; //Takt 64
SPI.attachInterrupt();
while(1){
}
}
Now I am trying to store a byte in the SDPR register and wait until it got send.
However do I have no idea how to do this. I've been researching all morning but I seem to not find the right answer. To be honest I don't know anything about the SDPR, where it is, what it does, how I can use it.
I hope one of you might be able to help me out.