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.

Problem with running C code from mikro pro C on high tex C compiler

Status
Not open for further replies.

newbie111

Member level 2
Joined
Nov 29, 2009
Messages
51
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
h.k
Activity points
1,609
hi guys

i tested an example code below with mikro pro c complier

it worked well got the hex

but when i use mplab + high tec c complier

it did not work




void main()
{
TRISC = 0 ; // set PORTB as OUTPUT

for(;;) // forever
{
PORTC = 0b00000100 ;
Delay_ms(1000) ; // wait 1000 ms

PORTC = 0 ; // turn it OFF
Delay_ms(1000) ; // wait 1000 ms
}
}


Make: The target "C:\PK2 Lessons\LPC Demo Board\09 Timer0\trying1.p1" is out of date.
Executing: "C:\Program Files\HI-TECH Software\PICC\9.70\bin\picc.exe" --pass1 "C:\PK2 Lessons\LPC Demo Board\09 Timer0\trying1.c" -q --chip=16F690 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Error [192] C:\PK2 Lessons\LPC Demo Board\09 Timer0\trying1.c; 3.1 undefined identifier "TRISC"
Error [192] C:\PK2 Lessons\LPC Demo Board\09 Timer0\trying1.c; 7.1 undefined identifier "PORTC"
Warning [361] C:\PK2 Lessons\LPC Demo Board\09 Timer0\trying1.c; 8.1 function declared implicit int

********** Build failed! **********


My question is is it is true that codes in c should be different when we use
different c compliers?

Thanks
 

Re: c programme

Hello.

You just need to include a header file with definition of all register. I'm not familiar with MicroC but i believe that this is true for all compilers. So i think that there must be a general header file with all register definitions. Else you can define this registers yourself.

#define PORTB 0x07 (i think this is right)
#define TRISC 0x87

Check data sheet for correct adresses.
 

Re: c programme

Use #include<htc.h> header file in your program.
This header file is including all the definition.

Regards
Chanchal
 

    newbie111

    Points: 2
    Helpful Answer Positive Rating
Re: c programme

After using the header file

it still did not work tho
Sigh
:(


newbie
 

Re: c programme

Programs for different compilers are not compatible with each other. But the syntax and some commands may be same. And I am sure that the code for MicroC wouldn't work on hi-tech, ccs or any other compilers(but there are some exceptions)...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top