spi_test.c

来自「IARSOURCECODE是基于LPC2478嵌入式软件IAR EWARM V4」· C语言 代码 · 共 47 行

C
47
字号
#include "LPC2468.h"                        /* LPC24xx definitions */
#include "type.h"
#include "irq.h"
#include "target.h"
#include "timer.h"
#include "fio.h"

#include "SPI.h"

extern BYTE seg_buf[7];   // LPC2468开发板使用此数组的0~5显示六个数码管;LPC2478板使用1~6

/*****************************************************************************
**   Main Function  main()
******************************************************************************/
int main (void)
{
    DWORD i,j;

    TargetResetInit();
    enable_timer(1);

    /* GPIOInit() need to be carefully called if you want to run some
	other peripherals, it will set the PINSEL to default value and change
	the direction of IOs. */

    GPIOInit( 0, FAST_PORT, DIR_OUT );
    GPIOInit( 3, FAST_PORT, DIR_OUT );

    SPI_Init(8);                    // SPI总线速率为28.8/8 = 3.6 MHz

    for(i=1;i<7;i++)seg_buf[i]=0;
    Seg_Init( );                   // 数码管初始化

    while ( 1 )
    {

      /* 此处代码请自己编写 */
      
    }

}

/*****************************************************************************
**                            End Of File
*****************************************************************************/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?