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
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
w/salam, saya x tahu sebab x tgk depan2. Kena tempah projek.
Oke, it’s possible to show my projek to u to solve this problem,
What about price for consultation?
Contact me at http://shahrulnizam.com/about/
There have whatsapp and e-mail.
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;
}
Saya pun x boleh check coding kalau x de hardware.
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
ws, saya rasa kesalahan programming.
salam shahrul,
kenapa perlu ada statement
RCK=1;
RCK=0;
ws, pulse RCK untuk IC 74595 keluarkan data. Kalau tak, output takkan keluar drpd shift register.
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
iRviNe, this is code for PIC16F887 not PIC16F877A. PIC16F877A don’t have MCLRE_ON configuration.