سلام عليكم
اخي كريم جزيل شكر لك
اخي كود غير موجود ضمن ملفات التي ارفقتها وياريت تجمعها كلها في ملف مضغوط اقصد ملفات مشروع
نلاحظ من ربط rs232 ذو 9 الاطراف استخدمت فقط rx,tx وبدون دائره max232 اين يستخدم هذا ربط فقط
لانك تعلم وكما قلت انها تربط مع حاسبه ولكن هنا بحاجه الى تعديل مستوى الاشاره لذا يستخدم max232
كما اتمنى من حضرتك وضع كود عن طريق علامه # موجوده ضمن الرد
انا قمت بعد اذن حضرت بستنساخ الكود وضعته ضمن كود لكي يتم قراته بشكل صحيح
كود:
char *temp0 = "0000"; char *temp1 = "0000"; char *temp2 = "0000";
char *temp3 = "0000"; char *temp4 = "0000"; char *temp5 = "0000";
char *temp6 = "0000"; char *temp7 = "0000"; char *temp8 = "000";
unsigned int adc_Value0, adc_Value1 , adc_Value2 , adc_Value3,
adc_Value4, adc_Value5 , adc_Value6 , adc_Value7;
/*================================================= ======================*/
void adc(){
adc_value0 = ADC_Read(0)*1.9; adc_value1 = ADC_Read(1)*1.9; adc_value2 = ADC_Read(2)*1.9;
adc_value3 = ADC_Read(3)*1.9; adc_value4 = ADC_Read(4)/1.9; adc_value5 = ADC_Read(5)*1.9;
adc_value6 = ADC_Read(6)*1.9; adc_value7 = ADC_Read(7)*1.9;
temp0[0] = adc_value0/1000 + 48;
temp0[1] = (adc_value0/100)%10 + 48;
temp0[2] = (adc_value0/10)%10 + 48;
temp0[3] = adc_value0%10 + 48;
temp1[0] = adc_value1/1000 + 48;
temp1[1] = (adc_value1/100)%10 + 48;
temp1[2] = (adc_value1/10)%10 + 48;
temp1[3] = adc_value1%10 + 48;
temp2[0] = adc_value2/1000 + 48;
temp2[1] = (adc_value2/100)%10 + 48;
temp2[2] = (adc_value2/10)%10 + 48;
temp2[3] = adc_value2%10 + 48;
temp3[0] = adc_value3/1000 + 48;
temp3[1] = (adc_value3/100)%10 + 48;
temp3[2] = (adc_value3/10)%10 + 48;
temp3[3] = adc_value3%10 + 48;
temp4[0] = adc_value4/1000 + 48;
temp4[1] = (adc_value4/100)%10 + 48;
temp4[2] = (adc_value4/10)%10 + 48;
temp4[3] = adc_value4%10 + 48;
temp5[0] = adc_value5/1000 + 48;
temp5[1] = (adc_value5/100)%10 + 48;
temp5[2] = (adc_value5/10)%10 + 48;
temp5[3] = adc_value5%10 + 48;
temp6[0] = adc_value6/1000 + 48;
temp6[1] = (adc_value6/100)%10 + 48;
temp6[2] = (adc_value6/10)%10 + 48;
temp6[3] = adc_value6%10 + 48;
temp7[0] = adc_value7/1000 + 48;
temp7[1] = (adc_value7/100)%10 + 48;
temp7[2] = (adc_value7/10)%10 + 48;
temp7[3] = adc_value7%10 + 48; }
void main(){
TRISA = 0xFF; uart1_init(9600);
while (1){
UART1_Write_Text ("ADC"); uart1_write_text(" ");
uart1_write_text(temp1); uart1_write_text(" ");
uart1_write_text(temp2); uart1_write_text(" ");
uart1_write_text(temp3); uart1_write_text(" ");
uart1_write_text(temp4); uart1_write_text(" ");
uart1_write_text(temp5); uart1_write_text(" ");
uart1_write_text(temp6); uart1_write_text(" ");
uart1_write_text(temp7); uart1_write_text(" ");
uart1_write(10);
uart1_write(13);
adc(); }}