Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Unknown proteus simulation error

Status
Not open for further replies.

Shahzaib8412

Newbie level 4
Joined
Jan 14, 2017
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
65
There is no error when i compile it in ccs pic c when i run the proteus simulation model it gives an error.
if anybody is serious to help me in this situation i can send him proteus model
i dont know how to upload image here


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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#define LCD_RS_PIN PIN_B0;
#define LCD_RW_PIN PIN_B1;
#define LCD_ENABLE_PIN PIN_B2;
#define LCD_DATA4 PIN_B3;
#define LCD_DATA5 PIN_B4;
#define LCD_DATA6 PIN_B5;
#define LCD_DATA7 PIN_B6;
#include <16F877A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP                       
#use delay(clock = 8000000)
#include <lcd.c>
#use fast_io(D)
         
 
unsigned float Adc_values[5];         //ARRAY TO READ ADC VALUES
unsigned float voltage;
char A[15];                 //CHARACTER ARRAY USED TO DISPLAY THE ADC VALUES
int k=0;
int x;                      //USED FOR BIT SHIFTING IN MOTOR PROGRAM
int i=0;                    //USED IN FILTERING OF THE DATA
int j=0;
float Intensity=0;            //TEMPERATURE LEVEL VARIABLE
float Intensity1 = 0;
int flag=0;
 
void Motor(void){           //MOTOR DRIVER PROGRAM
   x=0b00000001;
   for (j = 0; j < 3000; j++){
     PORTC = x;
     x = x << 1;
     Delay_ms(5);
     if( x==0b00010000){
      x=0b00000001;
     }
   }
}
 
void SettingSFRs(){
    TRISA=0xFF;
    TRISB.F0=1;
    TRISD.F0=0;                    //Sets the PORTD for Indicating Lights
    TRISD.F1=0;
    TRISD.F2=0;
    TRISD.F3=0;
    PORTD.F4=1;
    PORTD.F1=0;
    PORTD.F2=0;
    PORTD.F3=0;
    PORTD.F4=0;                     //Ending Indicating Lights Settings
 
    TRISC=0x00;                    //Sets PORTC as OUTPUT
    ANSEL=0xFF;                    //Sets the pin0-7 of ADC as analog input
    ANSELH=0x00;                   //Sets all other Analog Inputs to Digital
    ADCON0= 0b01000111;            //Initializing the ADC Converter
    ADCON1 = 0x0E;
    INTCON=0b10010000;             //Setting INTCON for External Interrupt
    C1ON_bit = 0;                  // Disable comparators
    C2ON_bit = 0;
    for (i = 0; i < 5; i++){
         Adc_values[i] = Adc_values[i + 1];
    }
}
 
void LCD(){
 LCD_Init();
 Lcd_Cmd(_LCD_CURSOR_OFF);
 Lcd_Out(1,4,"WELCOME");
 Lcd_Out(2,4,"GROUP # 4");
 Delay_ms(1000);
 Lcd_Cmd(_LCD_CLEAR);
 
}
 
void ReadValues(){
     Lcd_Cmd(_LCD_CURSOR_OFF);
     for (i = 0; i < 4; i++){
         Adc_values[i] = Adc_values[i + 1];
     }
 
     Adc_values[4] = adc_Read(1);
     Delay_ms(200);
     voltage = 0;
     for (i = 0; i < 5; i++){
         voltage += Adc_values[i];
     }
     voltage /= 5;
     if(PORTD.F4==1){
       Intensity=voltage/212.88;
       if ((Intensity1 + 0.250) > Intensity || (Intensity1 - 0.250) < Intensity ) {
         Lcd_Cmd(_LCD_CLEAR);
         Lcd_Out(1,3,"VOLTAGE");
         Lcd_Out(2,15,"V");
         Lcd_Out(2,4,A);
       }
     }
     
      if(PORTD.F4==0){
       Intensity=voltage/1.9679;
       if ((Intensity1 + 0.250) > Intensity || (Intensity1 - 0.250) < Intensity ) {
         Lcd_Cmd(_LCD_CLEAR);
         Lcd_Out(1,3,"TEMPERATURE");
         Lcd_Out(2,14,"C");
         Lcd_Out(2,4,A);
       }
     }
     floatToStr(Intensity, A);
 
 
     Intensity1 = Intensity;
      Lcd_Out(2,4,A);
}
 
void interrupt (){
     if(INTCON.INTF==1){
     INTCON.INTE=0;
     flag=1;
     INTCON.INTE=1;
     INTCON.INTF=0;
     }
}
 
void IndicatingLights(){
      if(Intensity>0 && Intensity<2){
       PORTD.F0=1;
       PORTD.F1=0;
       PORTD.F2=0;
       }
        if(Intensity>2 && Intensity<4){
            PORTD.F0=0;
            PORTD.F1=1;
            PORTD.F2=0;
         }
       if(Intensity>4&& Intensity<6 ){
       PORTD.F0=0;
       PORTD.F1=0;
       PORTD.F2=1;
       }
         if(Intensity>15 && Intensity<20){
       PORTD.F0=1;
       PORTD.F1=0;
       PORTD.F2=0;
       }
        if(Intensity>20 && Intensity<25){
            PORTD.F0=0;
            PORTD.F1=1;
            PORTD.F2=0;
         }
       if(Intensity>25){
       PORTD.F0=0;
       PORTD.F1=0;
       PORTD.F2=1;
       }
}
 
void main() {
SettingSFRs();
LCD();
while(1){
 PORTD.F3=~PORTD.F3;
 if(flag==1){
     Lcd_Cmd(_LCD_CLEAR);
     Lcd_Out(1,1,"MOTOR RUNNING");
     Motor();
     flag=0;
     }
ReadValues();
IndicatingLights();
}
}

 
Last edited by a moderator:

Hi,

First we nned to know "what" error proteus displays. I assume it won't display "unknown proteus simulation error"..

How to upload a picture... you could read the help files.
Or you could press the "insert image" button, then select the picture file from your PC.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top