资料介绍
用计算机并口模拟SPI通讯的C源程序
#define LPT_PORT 0x378
#define CLR_WCK(X) {X=X&(~(1<<0)); outportb(LPT_PORT,X); } // data.0
#define SET_WCK(X) {X=X | (1<<0) outportb(LPT_PORT,X); }
#define CLR_BCK(X) {X=X&(~(1<<2)); outportb(LPT_PORT,X); } // data.2
#define SET_BCK(X) {X=X | (1<<2) outportb(LPT_PORT,X); }
#define CLR_DATA(X) {X=X&(~(1<<3)); outportb(LPT_PORT,X); } // data.3
#define SET_DATA(X) {X=X | (1<<3) outportb(LPT_PORT,X); }
#define FALSE 0
#define TRUE 1
void test_comm()
{
unsigned char data
data = 0;
printf("Please press enter to begin send data\n");
getch();
printf("Pull down WCK data.0\n");
CLR_WCK(data);
getch();
printf("Pull up WCK data.0\n");
SET_WCK(data);
getch();
printf("Pull down BCK data.2\n");
CLR_BCK(data);
get