📄 调试程序1.i
字号:
#line 33 "C:/icc/include/macros.h"
void _StackCheck(void);
void _StackOverflowed(char);
#line 14 "D:\LZY归档\最新进样器文件\最新带锁进样器程序\调试程序1.c"
#line 1 "C:/icc/include/eeprom.h"
#line 4 "C:/icc/include/eeprom.h"
int EEPROMwrite( int location, unsigned char);
unsigned char EEPROMread( int);
int _256EEPROMwrite( int location, unsigned char);
unsigned char _256EEPROMread( int);
void EEPROMReadBytes(int addr, void *ptr, int size);
void EEPROMWriteBytes(int addr, void *ptr, int size);
#line 15 "D:\LZY归档\最新进样器文件\最新带锁进样器程序\调试程序1.c"
#line 1 "D:\LZY归档\最新进样器文件\最新带锁进样器程序/ZDJY.h"
typedef struct receiver
{
unsigned char mission_number;
unsigned char strat_number;
unsigned char muster_volume;
unsigned char clear_time;
unsigned char clear_select;
}RECEIVER;
typedef struct Test_Motor
{
unsigned char place_number;
unsigned char recoup_value;
unsigned char water_pump;
unsigned char air_pump;
unsigned char init_place;
unsigned char armup_down;
unsigned int setp_num;
unsigned char add_sub;
} TEST_MOTOR;
typedef struct _device_request
{
unsigned char bmRequestType;
unsigned char bRequest;
unsigned short wValue;
unsigned short wIndex;
unsigned short wLength;
} DEVICE_REQUEST;
typedef struct _control_xfer
{
DEVICE_REQUEST DeviceRequest;
unsigned short wLength;
unsigned short wCount;
unsigned char * pData;
unsigned char dataBuffer[8];
} CONTROL_XFER;
unsigned char H1DACData[]={ 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48,
47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32,
31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48,
47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32,
31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63};
unsigned char H2DACData[]={192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176,
175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160,
159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144,
143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112,
111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96,
95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80,
79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64};
unsigned char MainBuf[64];
unsigned char SendFlag;
unsigned char TxdBuf[16];
unsigned char RxdBuf[16];
unsigned char StepNum[4];
unsigned char ArmState;
unsigned char setup_packet;
unsigned char remote_wakeup;
unsigned char configuration;
unsigned char control_state;
unsigned char bNoRAM;
unsigned char num;
unsigned char WorkObjectFlag;
unsigned char ReceiveLen;
unsigned int DelayLen;
unsigned char oldplate_number=1,plate_sport;
unsigned char g[8];
unsigned char Work_flag=0,over_flag=0,debug_flag=0,reset_flag=0;
unsigned char by_value=0,yp_value=0,wz_value=0,free;
unsigned int zx_value=0;
unsigned int volume;
unsigned int clear_S;
RECEIVER Work;
CONTROL_XFER ControlData;
TEST_MOTOR Debugger;
unsigned char PlayTransaction;
unsigned char PlayNum;
unsigned char step1[4]={31,31,0,0};
unsigned char DeviceDescr[] =
{0x12,0x01,0x10,0x01,0xdc,0x00,0x00,0x10,0x71,
0x04,0x66,0x06,0x00,0x01,0x00,0x00,0x00,0x01};
unsigned char ConfigDescr[] =
{0x09,0x02,0x2e,0x00,0x01,0x01,0x00,0xa0,0x01};
unsigned char InterfaceDescr[] =
{0x09,0x04,0x00,0x00,0x04,0xdc,0xa0,0xb0,0x00};
unsigned char EP1_TXDescr[] =
{0x07,0x05,0x81,0x03,0x10,0x00,0x01};
unsigned char EP1_RXDescr[] =
{0x07,0x05,0x01,0x03,0x10,0x00,0x01};
unsigned char EP2_TXDescr[] =
{0x07,0x05,0x82,0x02,0x40,0x00,10};
unsigned char EP2_RXDescr[] =
{0x07,0x05,0x2,0x02,0x40,0x00,10};
void get_status(void);
void control_handler(void);
void init_config(void);
void set_feature(void);
void set_address(void);
void get_interface(void);
void set_interface(void);
void reconnect_USB(void);
void init_unconfig(void);
void single_transmit(unsigned char * pData,unsigned char len);
void code_transmit(unsigned char * pRomData,unsigned short len);
void send(unsigned char Len);
void MainSend (void);
void port_init(void);
void init_devices(void);
void motorstrat_right (void);
void motorstrat_left (void);
void muster_init (void);
void one_course (void);
void arm_up (void);
void arm_down (unsigned int down);
void armround_init (void);
void plate_init (void);
void mustermotor_init (void);
void motor_right (unsigned char motor_number,unsigned char modulus,unsigned int delaytime);
void motor_left (unsigned char motor_number,unsigned char modulus,unsigned int delaytime);
void plate_round (unsigned char mewplate_number,unsigned char n);
void plate_oneround (void);
void mustermotor_contorl (unsigned int any_muter,unsigned char updown);
void armround_control1(unsigned char initstate,unsigned char endstate,unsigned long movenum);
void armround_move(unsigned char leftOrRight,unsigned char GuOu,unsigned long movenum);
void armround_control (unsigned char m,unsigned char n,unsigned char v);
unsigned char D12_Read1Endpoint(unsigned char endp,unsigned char len,unsigned char * buf);
void needle_egis (void);
void push_air (void);
void armup_init (void);
void eeprom_value (void);
unsigned char read_eeprom (unsigned int address);
void write_eeprom (void);
void armrate_change (unsigned int step_modulus,unsigned char left_right);
#line 16 "D:\LZY归档\最新进样器文件\最新带锁进样器程序\调试程序1.c"
void port_init(void)
{
(*(volatile unsigned char *)0x3B) = 0xFF;
(*(volatile unsigned char *)0x3A) = 0xFF;
(*(volatile unsigned char *)0x38) = 0xFF;
(*(volatile unsigned char *)0x37) = 0xFF;
(*(volatile unsigned char *)0x35) = 0xFF;
(*(volatile unsigned char *)0x34) = 0xFF;
(*(volatile unsigned char *)0x32) = 0xFF;
(*(volatile unsigned char *)0x31) = 0x00;
(*(volatile unsigned char *)0x23) = 0xFF;
(*(volatile unsigned char *)0x22) = 0xFF;
(*(volatile unsigned char *)0x62) = 0xFB;
(*(volatile unsigned char *)0x61) = 0xFF;
(*(volatile unsigned char *)0x65) = 0x1F;
(*(volatile unsigned char *)0x64) = 0x1F;
}
void init_devices(void)
{
asm("cli");
(*(volatile unsigned char *)0x5C) = 0x00;
(*(volatile unsigned char *)0x6D) = 0x00;
port_init();
(*(volatile unsigned char *)0x55) = 0x00;
(*(volatile unsigned char *)0x6A) = 0x00;
(*(volatile unsigned char *)0x5A) = 0x00;
(*(volatile unsigned char *)0x59) = 0x00;
(*(volatile unsigned char *)0x57) = 0x00;
(*(volatile unsigned char *)0x7D) = 0x00;
(*(volatile unsigned char *)0x55)|= 0x80;
(*(volatile unsigned char *)0x6D) = 0x00;
asm("sei");
}
unsigned char InitMotor(unsigned char Port)
{
unsigned char STRB_LOW,CLOK_LOW,DATA_LOW;
unsigned char STRB_HIG,CLOK_HIG,DATA_HIG;
if((Port>=0x01)&&(Port<=0x04))
{
switch(Port)
{
case 0x01:
STRB_LOW = 0x00;
STRB_HIG = 0x10;
CLOK_LOW = 0x00;
CLOK_HIG = 0x01;
DATA_LOW = 0x00;
DATA_HIG = 0x10;
break;
case 0x02:
STRB_LOW = 0x00;
STRB_HIG = 0x20;
CLOK_LOW = 0x00;
CLOK_HIG = 0x02;
DATA_LOW = 0x00;
DATA_HIG = 0x20;
break;
case 0x03:
STRB_LOW = 0x00;
STRB_HIG = 0x40;
CLOK_LOW = 0x00;
CLOK_HIG = 0x04;
DATA_LOW = 0x00;
DATA_HIG = 0x40;
break;
case 0x04:
STRB_LOW = 0x00;
STRB_HIG = 0x80;
CLOK_LOW = 0x00;
CLOK_HIG = 0x08;
DATA_LOW = 0x00;
DATA_HIG = 0x80;
break;
}
(*(volatile unsigned char *)0x38)=CLOK_LOW;
(*(volatile unsigned char *)0x38)=CLOK_LOW;
(*(volatile unsigned char *)0x23)=STRB_LOW;
(*(volatile unsigned char *)0x23)=STRB_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_LOW;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
(*(volatile unsigned char *)0x23)=STRB_HIG;
(*(volatile unsigned char *)0x23)=STRB_HIG;
return 0x01;
}
else{
return 0x00;
}
}
unsigned char OutputMotor(unsigned char Port,unsigned char Bridge1DAC,unsigned char Bridge2DAC)
{
unsigned char STRB_LOW,CLOK_LOW,DATA_LOW;
unsigned char STRB_HIG,CLOK_HIG,DATA_HIG;
if((Port>=0x01)&&(Port<=0x04))
{
switch(Port)
{
case 0x01:
STRB_LOW = 0x00;
STRB_HIG = 0x10;
CLOK_LOW = 0x00;
CLOK_HIG = 0x01;
DATA_LOW = 0x00;
DATA_HIG = 0x10;
break;
case 0x02:
STRB_LOW = 0x00;
STRB_HIG = 0x20;
CLOK_LOW = 0x00;
CLOK_HIG = 0x02;
DATA_LOW = 0x00;
DATA_HIG = 0x20;
break;
case 0x03:
STRB_LOW = 0x00;
STRB_HIG = 0x40;
CLOK_LOW = 0x00;
CLOK_HIG = 0x04;
DATA_LOW = 0x00;
DATA_HIG = 0x40;
break;
case 0x04:
STRB_LOW = 0x00;
STRB_HIG = 0x80;
CLOK_LOW = 0x00;
CLOK_HIG = 0x08;
DATA_LOW = 0x00;
DATA_HIG = 0x80;
break;
}
(*(volatile unsigned char *)0x38)=CLOK_LOW;
(*(volatile unsigned char *)0x23)=STRB_LOW;
if((Port==1)||(Port==4))
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else
{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
if(Bridge2DAC&0x80)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge2DAC&0x40)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge2DAC&0x20)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge2DAC&0x10)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge2DAC&0x08)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge2DAC&0x04)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge2DAC&0x02)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge2DAC&0x01)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge1DAC&0x20)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge1DAC&0x10)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge1DAC&0x08)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge1DAC&0x04)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge1DAC&0x02)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
if(Bridge1DAC&0x01)
{
(*(volatile unsigned char *)0x38)=DATA_HIG;
(*(volatile unsigned char *)0x38)=DATA_HIG|CLOK_HIG;
}
else{
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
}
(*(volatile unsigned char *)0x38)=DATA_LOW;
(*(volatile unsigned char *)0x38)=DATA_LOW|CLOK_HIG;
(*(volatile unsigned char *)0x23)=STRB_HIG;
(*(volatile unsigned char *)0x23)=STRB_HIG;
return 0x01;
}
else{
return 0x00;
}
}
void outportb(unsigned int Addr,unsigned char Data)
{
if(Addr== 0)
{
(*(volatile unsigned char *) 0xF000) = Data;
}
else if(Addr== 1)
{
(*(volatile unsigned char *) 0xF001) = Data;
}
}
unsigned char inportb(unsigned int Addr)
{
unsigned char Data;
if(Addr== 0)
{
Data =(*(volatile unsigned char *) 0xF000);
}
else if(Addr== 1)
{
Data =(*(volatile unsigned char *) 0xF001);
}
return Data;
}
void D12_SetAddressEnable(unsigned char bAddress,unsigned char bEnable)
{
(*(volatile unsigned char *)0x59)=0x00;
outportb(1, 0xD0);
if(bEnable)
bAddress |= 0x80;
outportb(0, bAddress);
(*(volatile unsigned char *)0x59)=0x01;
}
void D12_SetEndpointEnable(unsigned char bEnable)
{
(*(volatile unsigned char *)0x59)=0x00;
outportb(1, 0xD8);
if(bEnable)
outportb(0, 1);
else
outportb(0, 0);
(*(volatile unsigned char *)0x59)=0x01;
}
void D12_SetMode(unsigned char bConfig,unsigned char bClkDiv)
{
outportb(1, 0xF3);
outportb(0, bConfig);
outportb(0, bClkDiv);
}
void D12_SetDMA(unsigned char bMode)
{
outportb(1, 0xFB);
outportb(0, bMode);
}
unsigned short D12_ReadInterruptRegister(void)
{
unsigned char b1;
unsigned int j;
outportb(1, 0xF4);
b1 = inportb(0);
j = inportb(0);
j <<= 8;
j += b1;
return j;
}
unsigned char D12_SelectEndpoint(unsigned char bEndp)
{
unsigned char c;
(*(volatile unsigned char *)0x59)=0x00;
outportb(1, bEndp);
c = inportb(0);
(*(volatile unsigned char *)0x59)=0x01;
return c;
}
unsigned char D12_ReadLastTransactionStatus(unsigned char bEndp)
{
outportb(1, 0x40 + bEndp);
return inportb(0);
}
void D12_SetEndpointStatus(unsigned char bEndp,unsigned char bStalled)
{
(*(volatile unsigned char *)0x59)=0x00;
outportb(1, 0x40 + bEndp);
outportb(0, bStalled);
(*(volatile unsigned char *)0x59)=0x01;
}
unsigned char D12_ReadEndpoint(unsigned char endp,unsigned char len,unsigned char * buf)
{
unsigned char i, j;
(*(volatile unsigned char *)0x59)=0x00;
outportb(1, endp);
if((inportb(0) & 0x01) == 0)
{
(*(volatile unsigned char *)0x59)=0x01;
return 0;
}
outportb(1, 0xF0);
j = inportb(0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -