Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

programme for SPI interface

this is the programme that i use to interface SPI with shift register . i use Apex 20k200e .

# include "excalibur.h"

int main ( )

{

int i;

int data_1 = 0x79;

for (i = 0; i < 100 ; ++i)

{

// Transmit a byte:

while (!(na_spi->np_spistatus & np_spistatus_trdy_mask));

na_spi->np_spitxdata = data_1;

// Read and throw away the received data:

while (!(na_spi->np_spistatus & np_spistatus_rrdy_mask));

na_spi->np_spirxdata;

}

//nr_delay(1000);

// Wait until the last byte is transmitted:

while (!(na_spi->np_spistatus & np_spistatus_tmt_mask));

// Release SS_n:

na_spi-> np_spicontrol &=~np_spicontrol_sso_mask;

}

but the problem is my shift register still no output. can anyone recomment me any comment about programme.
No RepliesBe the first to reply