

takes in data and sends to the shift register MSB first function for bit banging to the shift register. #define _XTAL_FREQ 8000000 //let the compiler know what our crystal is so our _delay functions properly. #pragma config CPD = OFF // Data NVM Memory Code Protection bit (Data NVM code protection disabled) #pragma config CP = OFF // User NVM Program Memory Code Protection bit (User NVM code protection disabled) #pragma config LVP = OFF // Low Voltage Programming Enable bit (High Voltage on MCLR/VPP must be used for programming.) #pragma config WRT = OFF // User NVM self-write protection bits (Write protection off) #pragma config DEBUG = OFF // Debugger enable bit (Background debugger disabled) #pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable bit (Stack Overflow or Underflow will cause a Reset) #pragma config PPS1WAY = ON // PPSLOCK bit One-Way Set Enable bit (The PPSLOCK bit can be cleared and set only once PPS registers remain locked after one clear/set cycle) #pragma config BORV = LOW // Brown-out Reset Voltage selection bit (Brown-out voltage (Vbor) set to 2.45V) #pragma config BOREN = ON // Brown-out Reset Enable bits (Brown-out Reset enabled, SBOREN bit ignored) #pragma config LPBOREN = OFF // Low-power BOR enable bit (ULPBOR disabled) #pragma config WDTE = OFF // Watchdog Timer Enable bits (WDT disabled SWDTEN is ignored) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config MCLRE = ON // Master Clear Enable bit (MCLR/VPP pin function is MCLR Weak pull-up enabled) #pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled) #pragma config CSWEN = ON // Clock Switch Enable bit (Writing to NOSC and NDIV is allowed) #pragma config CLKOUTEN = OFF // Clock Out Enable bit (CLKOUT function is disabled I/O or oscillator function on OSC2) #pragma config RSTOSC = EXT1X // Power-up default value for COSC bits (EXTOSC operating per FEXTOSC bits)

#pragma config FEXTOSC = HS // FEXTOSC External Oscillator mode Selection bits (HS (crystal oscillator) above 4 MHz) Use project enums instead of #define for ON and OFF. #pragma config statements should precede project file includes.
SHIFT REGISTER USING SPI ARDUINO HOW TO
Below is a small schematic showing how to connect your shift register to the pic.Īgain I will post the whole program and then go over it piece by piece. In the next tutorial I will discuss how to used the built in hardware SPI that comes as one of the peripherals inside the pic16f18323. This is basically a port from the Arduino ShiftOut function.
SHIFT REGISTER USING SPI ARDUINO SOFTWARE
As the title suggests, this will be done using a software hack to bit bang the data into the shift register. In this tutorial I will go over the basics of using a 74hc595 shift register with the pic16f18323.
