hi every one i am making my graduation project with aduc7061 and I wrote the code but I cant debug it alot of error in libraries and I don't know how to check on cod before and after burn without but micro into rest hardware and thanks in advance the code :#include "ioADuC7060.h" #include "stdio.h" #include "string.h" // Bit Definitions #define BIT0 0x01 #define BIT1 0x02 #define BIT2 0x04 #define BIT3 0x08 #define BIT4 0x10 #define BIT5 0x20 #define BIT6 0x40 #define BIT7 0x80 #define BIT8 0x100 #define BIT9 0x200 #define BIT10 0x400 #define BIT11 0x800 #define BIT12 0x1000 #define BIT13 0x2000 #define BIT14 0x4000 #define BIT15 0x8000 #define BIT16 0x10000 #define BIT22 0x400000 #define BIT24 0x1000000 #define BIT30 0x40000000
#define ch1 0x8440 //sel ch1 with ADCxCON #define ch2 0x8480 //sel ch1 with ADCxCON #define ch3 0x8B80 //sel ch1 with ADCxCON #define ch4 0x8C00 //sel ch1 with ADCxCON #define ch5 0x8C80 //sel ch1 with ADCxCON
void frameSend (void); void storeAdc (int , int); unsigned char frame[120] = "";
// global variable declarations
unsigned char szTemp[64] = ""; // Used to store ADC result before printing to UART
int main(void) { //unsigned char i = 0;
POWKEY1 = 0x1; POWCON0 = 0x78; // Set core to max CPU speed of 10.24Mhz POWKEY2 = 0xF4;
// turn on excitation current source IEXCON = BIT1 + BIT6; // Enable Excitation Current Source 0 - 400uA
// Initialize the UART for 9600-8-N GP1CON = BIT0 + BIT4; // Select UART functionality for P1.0/P1.1 COMCON0 = BIT7; // Enable access to COMDIV registers COMDIV0 = 0x02; // Set baud rate to 115200. COMDIV1 = 0x00; COMDIV2 = 0x796 + BIT11; // Enable fractional divider for more accurate baud rate setting
COMCON0 = BIT0 + BIT1 + BIT2; COMIEN0 = BIT0 + BIT1; // Enable UART interrupts when Rx full and Tx buffer empty.
// Configure ADC for on demand conversions, 8khz, Differential inputs ADCFLT = 0x00; // 8kHz no filtering, Chop off, No averaging ADCCFG = 0; // Offest Self Calibration ADCMDE = BIT2 + BIT4 + BIT7; while((ADCSTA & BIT0) != BIT0){} // Wait for Calibration routine to complete
// Gain Self Calibration ADCMDE = BIT0 + BIT2 + BIT4 + BIT7; while((ADCSTA & BIT0) != BIT0){} // Wait for Calibration routine to complete
while (1) { storeAdc(ch1 , ch3); storeAdc(ch2 , ch4); storeAdc(0x0000 , ch3); frameSend(); } }
void storeAdc (int chA , int chB) { if(chA == 0x0000) { ADC1CON = chB; ADC0CON = 0x0000; ADCMDE = 0x82; while(ADCSTA & 0x0002 != 0x0002){} stract(frame , ADC1DAT); //Concatenation int x == ADC0DAT ; //clear ADC1RDY } else { ADCMDE = 0x82; ACD0CON = chA; ADC1CON = chB; while(ADCSTA $ 0x0003 != 0x0003) {} stract(frame , ADC1DAT); stract(frame , ADC0DAT); } }
void frameSend (void) { sprintf ( (char*)frame, "ADC Result (hex) : %8lX,\r\n",ulADC0Result );// Send the ADC Result to buffer for the UART int nLen = strlen((char*)frame); for (int i = 0 ; i < nLen ; i++ ) { COMTX = frame[i];
while ((COMSTA0 & 0x10) != 0x10)) { } } }
hi every one i am making my graduation project with aduc7061 and I wrote the code
Did you not mean
hi every one i am making my "graduation project" (?!?!?!!?!?!?!) with aduc7061 and I wrote the code (?!?!!?!?!?!?!!)
This is your graduation project code?
GRADUATION? GRADUATION? GRADUATION? GRADUATION? GRADUATION?
and again:
GRADUATION?!?!?!?!?!