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.

main function is not defined

Status
Not open for further replies.

sooyassine1

Newbie level 6
Joined
Jul 25, 2012
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,374
hi,
please i have a problem in my "simple" program , i have this error :main function is not defined
here is the program






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
void main()
{    unsigned int temp_res;
  float K,I;
  int J;
K=11117.28;
I=0.01;
J=1;
 
  ANSEL  = 0x01;              // Configure AN2 pin as analog
  ANSELH = 0;                 // Configure other AN pins as digital I/O
  C1ON_bit = 0;               // Disable comparators
  C2ON_bit = 0;
 
  TRISA  = 0b00000011;              // PORTA is input
  TRISB  = 0b00000000;                 // PORTB is output
 
  while (1)
       {
    temp_res = ADC_Read(2);   // Get 10-bit results of AD conversion
    PORTA = temp_res;         // Send lower 8 bits to PORTB
                if(PORTA>K)
                {
                      PORTB = PORTB+J*I;
                }
                else
                {
                        J=-J;
                      PORTB = PORTB+J*I;
                }
                K=PORTA;
                delay_ms(1ms);
        }
}



thanks for ur inswers
 
Last edited by a moderator:

If you are using MikroC, you'll see that error if you try and build a C file without creating/saving a project file. That's why starting all over worked out for you. If you get that error again, just go to Save Project As, etc and it should work.
 

thanks for ur aswers i use a 18F1220 and i m using micro C
in fact, finaly it work. but there is a problem in the simulation on ISIS ...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top