Mzz Amin
Newbie level 5
- Joined
- Mar 18, 2014
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 86
I'm facing this problem while compiling my code using mikroc for PIC16F877.
that's my code:
And igot this message
that's my code:
Code C - [expand] 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 // Software I2C connections sbit Soft_I2C_Scl at RC3_bit; sbit Soft_I2C_Sda at RC4_bit; sbit Soft_I2C_Scl_Direction at TRISC3_bit; sbit Soft_I2C_Sda_Direction at TRISC4_bit; // End Software I2C connections int T, tc,h,m,se,i,j; int *nbr; char nb[7],T0[10],h1[20],m1[20],se1[20],ouv[20],nbre[20]; char h2, m2, se2 ; signed char seconds, minutes, hours, day, month, year; const int tps[40]={1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //----------------------------List of machines void mach(){ if (i==1) UART1_write_text("503"); else if (i==2) UART1_write_text("505"); else if (i==3) UART1_write_text("507"); else if (i==4) UART1_write_text("751"); else if (i==5) UART1_write_text("752"); else if (i==6) UART1_write_text("753"); else if (i==7) UART1_write_text("754"); else if (i==8) UART1_write_text("1002"); else if (i==9) UART1_write_text("1004"); else if (i==10) UART1_write_text("1005"); else if (i==11) UART1_write_text("1006"); else if (i==12) UART1_write_text("1504"); else if (i==13) UART1_write_text("1508"); else if (i==14) UART1_write_text("1509"); else if (i==15) UART1_write_text("2001"); else if (i==16) UART1_write_text("2507"); else if (i==17) UART1_write_text("3510"); } void clock(){ portc.rc5=1; delay_us(10); portc.rc5=0; delay_us(10); } void affichage () { if (nbre!=0){ uart1_write_text(" Machine: "); mach(); UART1_Write(10); UART1_Write(13); UART1_write_text(" Nombre de cycles termines:"); UART1_write_text(nb); UART1_Write(10); UART1_Write(13); UART1_write_text(" Temps du dernier cycle:"); UART1_Write_text(T0); UART1_Write(10); UART1_Write(13); } } void calcul() { for(j=0;j<=19;j++){ porta.ra0=tps[2*j-1]; clock(); if ( porta.ra1==0) { ouv[j] = 1; h1[j]=hours; m1[j]=minutes; se1[j]=seconds; } porta.ra0=tps[2*j]; clock(); if ( porta.ra1==0) if (ouv[j]==1){ *nbr=&nbre[j] ; nbr++; nbre[j]=nbr; h2=hours; m2=minutes; se2=seconds; ouv[j] = 0; } intToStr(nbr,nb) ; h=h2-h1[j] ; m=m2-m1[1] ; se=se2-se1[j]; if (h==0 ) { if (m==0) { tc=se ;} else if (m > 0) { if (se>0) { tc=se+m*60; } else if (se<=0) {se=se+60; m--; tc=se+m*60; } } } else if (h!=0) { m=m+60; if ( se>0) {tc= se+m*60; } else if ( s<0) { m=m--; tc=se+m*60; } } if ( tc>=0 && ouv==0){ T=tc; intToStr(T,T0); } i=j; affichage(); } } void main() { trisa.f0=0; trisa.f1=1; EEPROM_Write(0x53,0x80); UART1_Init(9615); // Initialize UART communication Soft_I2C_Init(); // Initialize Soft I2C communication while(1){ calcul(); } }
And igot this message
IRP bit must be set manually for indirect access to 'nb' variable calcul.c
Last edited by a moderator: