Register Declaration

Thread Starter

Surender Singh 2

Joined Mar 7, 2017
3
The SPI Data register and SPI status registers are directly used without any declaration in the current program or even in the included file. Please help me to find out where it is declared.
Currently I am working in ArduinoUNOR3 and with CAN controller MCP2515.
I find that the below files are included but in none of the file the SPDR or SPSR is declared
C:
#include <avr/io.h>
#include <util/delay.h>

#if ARDUINO>=100
#include <Arduino.h> // Arduino 1.0
#else
#include <Wprogram.h> // Arduino 0022
#endif
#include <stdint.h>
#include <avr/pgmspace.h>

#include "global.h"
#include "mcp2515.h"
#include "mcp2515_defs.h"


#include "defaults.h"
But they are using it directly
uint8_t spi_putc( uint8_t data )
{
// put byte in send-buffer
SPDR = data;

// wait until byte was send
while( !( SPSR & (1<<SPIF) ) )
;

return SPDR;
}
Please help me I am confused.
Thank you

Mod edit: code tags
 
Last edited by a moderator:

JWHassler

Joined Sep 25, 2013
306
That declaration must be pulled in by one of those eight "include"-files.
Find them and look at them: your curiosity (certainly not 'confusion'?) will be satisfied
 
Top