PIC Lesson: SPI Module


SPI adalah singkatan bagi Serial Peripheral Interface menggunakan Master Synchronous Serial Port (MSSP) Module. Address yang terlibat dalam operasi SPI adalah SSPCON, SSPSTAT, SSPBUF and SSPSR.

Isyarat SPI menghantar dan menerima data melalui empat atau lima wayar iaitu SCK, SDO, SS (Slave Select), GND dan memerlukan SDI  untuk menerima data. Antara chip yang menggunakan SPI adalah shift register 74595. Chip 74595 digunakan untuk menambahkan bilangan output daripada output PIC yang sedia ada. Sambungan 74595 menggunakan SCK, SDO dan SS seperti di bawah.

Berikut adalah videonya.

PIC Source Code

Sertai Telegram Group bagi dapatkan source code


12 responses to “PIC Lesson: SPI Module”

  1. hello… i tried to simulate the circuit with proteus, it not working with a error code

    Error [800] 877.as; 45. undefined symbol “MCLRE_ON”

    i would like to learn SPI, with your sample. thx

    i am a university student from malaysia

  2. salam,

    sy ada buat satu projek mutiple input shift register to spi guna 2 ic 74165 ,utk 8bit pertama berjaya shift masuk SDI,tap 8 bit berikutnye x berjaya masuk…so adakah kesalahan programming atau pic16f877a yang x bole trima..minta pendapat En. Shahrul

  3. ok..nie function yg sy pkai utk read spi, mintak bantuan tgk kesalahan kat mna

    unsigned int spi_read(char input)
    {unsigned char data;

    SSPBUF=0;
    SSPBUF=input;

    while(!SSPIF);
    data=SSPBUF;

    return data;
    }

  4. Salam abg shah,

    saya buat projek attandance system guna respberry pi3 guna sensor PN532 NFC ,untuk testing card terima error,,
    abg ada solution untuk masalah saya.

    pi@raspberrypi:~ $ nfc-scan-device -v
    nfc-scan-device uses libnfc 1.7.1
    1 NFC device(s) found:
    error libnfc.driver.pn532_spi Unable to wait for SPI data. (RX)
    pn53x_check_communication: Timeout
    error libnfc.driver.pn532_spi Unable to wait for SPI data. (RX)
    nfc_open failed for pn532_spi:/dev/spidev0.0:500000

    looking for solution
    wei

Leave a Reply to Shahrul Cancel reply

Your email address will not be published. Required fields are marked *