All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Programmer's Corner

Notices

Programmer's Corner Discussion forum for all aspects of programming and software engineering. Any software programming language welcome: C, C++, C#, Fortran, Java, Matlab, etc.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 04-24-2011, 03:22 AM
Rk17 Rk17 is offline
Junior Member
 
Join Date: Apr 2011
Posts: 43
Default Mplab help!!!

helo its my first time to post here i really need some help regarding mplab. i cant compile a code in mplab ide; i use the hi-tech compiler; here is the code

#include <16c84.h> #USE DELAY( CLOCK=4000000 ) /* Using a 4 Mhz clock */ #FUSES XT,NOWDT,NOPROTECT,NOPUT /* Use XT mode, No Watch Dog, No Code Protect, No Power-up Timer */ #byte port_b=6 /* define the location of register port_b */ main(){ byte cnt; value; set_tris_b(0); /* set port_b to be outputs */ port_b = 0; /* initialize All port_b outp/uts to be zero */ value = 0x01; while( TRUE ) { /* forever loop using WHILE construct */ cnt = 0; while ( cnt<8 ) { port_b = value; DELAY_MS(1000); value = value << 1; /* shift left will put 0x01, 0x02, 0x04, 0x08, 0x10 */ cnt++; /* 0x20, 0x40, 0x80 to port_b */ } } }

>>and here is the error;

Build C:\Documents and Settings\Administrator\My Documents\forsundayfinal\srv for device 16F84A
Using driver C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe

Make: The target "C:\Documents and Settings\Administrator\My Documents\forsundayfinal\srv.p1" is out of date.
Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" --pass1 "C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\srv.c" -q --chip=16F84A -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 [141] C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\srv.c; 1.18 can't open include file "16c84.h": No such file or directory

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


**i dont know the cause of this.. please help me.. tnx in advnce!


Reply With Quote
  #2  
Old 04-24-2011, 06:15 AM
nerdegutta's Avatar
nerdegutta nerdegutta is offline
Senior Member
 
Join Date: Dec 2009
Location: (GMT +1)
Posts: 1,667
Blog Entries: 6
Default

For starters, if you edit your post, and use the code - tag, the readability will be much better.

What PIC are you programming? 16F84 or 16C84?

Try changing the:
Code:
#include <16c84.h>
Select All
with:
Code:
#include <htc.h>
Select All
You configuration word looks also a bit off...
__________________
- nerdegutta

On the other hand - you have different fingers.
Reply With Quote
The Following User Says Thank You to nerdegutta For This Useful Post:
Rk17 (04-25-2011)
  #3  
Old 04-24-2011, 09:09 AM
Rk17 Rk17 is offline
Junior Member
 
Join Date: Apr 2011
Posts: 43
Default

im kind of a rookie in this stuff but thanks for the help bor i really appreciate it by the way what does #include <htc.h> mean?

ive did what you said and the result got better but still faild to compile here is the error code i got>>

Make: The target "C:\Documents and Settings\Administrator\My Documents\forsundayfinal\srv.p1" is out of date.
Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" --pass1 "C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\16F84A_delay (100)\srv.c" -q --chip=16F84A -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"
Warning [361] C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\16F84A_delay (100)\srv.c; 54.1 function declared implicit int
Warning [361] C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\16F84A_delay (100)\srv.c; 56.1 function declared implicit int
Warning [361] C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\16F84A_delay (100)\srv.c; 58.1 function declared implicit int
Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" -osrv.cof -msrv.map --summary=default --output=default srv.p1 --chip=16F84A -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"
HI-TECH C Compiler for PIC10/12/16 MCUs (PRO Mode) V9.81
Copyright (C) 2010 Microchip Technology Inc.
Licensed for evaluation purposes only.
This licence will expire on Tue, 07 Jun 2011.
Warning [1090] C:\Documents and Settings\Administrator\My Documents\pic16F84 projects\16F84A_delay (100)\srv.c; 41. variable "_i" is not used
Error [500] ; 0. undefined symbols:
_Delay_ms(srv.obj) _resBit(srv.obj) _setBit(srv.obj)

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

ive program the source code on my PIC16F84A and it worked when i used the hex file that was the 100ms delay time.
I wish to recompile the file to do a little experiment (change 100ms to 5000ms) but it turned out to be that mplab cant recompile

further help would be highly appreciated tnx in advance
Reply With Quote
  #4  
Old 04-24-2011, 08:13 PM
spinnaker's Avatar
spinnaker spinnaker is offline
Senior Member
 
Join Date: Oct 2009
Location: Pittsburgh, PA U.S.A.
Posts: 3,650
Default

Repost your code with code tags as suggested and mark whicj line is 361.

but those are warnings and usually nothing to worry about.

This line

Error [500] ; 0. undefined symbols:
_Delay_ms(srv.obj) _resBit(srv.obj) _setBit(srv.obj)

is an error and it means these are functions missing from your project. The need to be included either from a library or source code included in your project.

And this should have been posted in the embedded forum and not here. Hopefully a mod will move it soon. If not then PM a mode.
Reply With Quote
The Following User Says Thank You to spinnaker For This Useful Post:
Rk17 (04-25-2011)
  #5  
Old 04-24-2011, 11:21 PM
Rk17 Rk17 is offline
Junior Member
 
Join Date: Apr 2011
Posts: 43
Default

ok tanx for the info i really appreciate it. ill try it again
Reply With Quote
  #6  
Old 04-25-2011, 12:36 PM
Rk17 Rk17 is offline
Junior Member
 
Join Date: Apr 2011
Posts: 43
Default

sir it seems that _Delay_ms(srv.obj) _resBit(srv.obj) _setBit(srv.obj) are terms which mplab can not indentify. here is the code
>>
#include <htc.h>

void main() {
unsigned short pa=0;
unsigned int i;


PORTA = 0;
TRISA = 0; // o/p - sets analogue pins to digital output

TRISB = 0;
PORTB = 0;

while(1) {

pa=~pa;
if (pa) {
setBit(PORTB,3);
} else {
resBit(PORTB,3);
}
Delay_ms(100);
} ; // infinite while loop
}

>>i got this from this link http://www.best-microcontroller-proj...ircuit_diagram

im using mplab.. but it says mikroC is there a difference between the two? they have the same commands in c right?

i have a .ppc file also downloaded with it but i dont know how to open it.

tnx for the help sir
Reply With Quote
  #7  
Old 04-25-2011, 12:48 PM
nerdegutta's Avatar
nerdegutta nerdegutta is offline
Senior Member
 
Join Date: Dec 2009
Location: (GMT +1)
Posts: 1,667
Blog Entries: 6
Default

This line:
Code:
#include <htc.h>
Select All
tells the compiler to include the file htc.h at compile time.

Try:
Code:
__delay_ms(1000);
Select All
Instead of:
Code:
Delay_ms(1000);
Select All
You can not mix MikroC and MPLAB Hi-tech C. Stick with one of them.
__________________
- nerdegutta

On the other hand - you have different fingers.
Reply With Quote
The Following User Says Thank You to nerdegutta For This Useful Post:
Rk17 (04-25-2011)
  #8  
Old 04-25-2011, 01:21 PM
t06afre's Avatar
t06afre t06afre is offline
Senior Member
 
Join Date: May 2009
Posts: 5,939
Default

You are using a program not written for HI-Tech C hence all your problems.
before you do anything more I will STRONGLY recommend reading the document
C:\Program Files\HI-TECH Software\PICC\9.81\docs\quickstart.pdf
Then in the same folder you will also find the manual. Check out the function __delay_ms. And HI-tech C also do not use the
Code:
 
#FUSES XT,NOWDT,NOPROTECT,NOPUT
Select All
but rather
Code:
__CONFIG(XT & WDTDIS & PWRTDIS & BORDIS & LVPEN & WRTEN &DEBUGEN & DUNPROT & UNPROTECT);
Select All
as an example. This setting may not apply to your MCU
And please use code tags
Reply With Quote
The Following User Says Thank You to t06afre For This Useful Post:
Rk17 (04-25-2011)
  #9  
Old 04-25-2011, 05:56 PM
Rk17 Rk17 is offline
Junior Member
 
Join Date: Apr 2011
Posts: 43
Default

ah ok now i think i get it thnks again.. sori bout that. really appreciate your help
Reply With Quote
  #10  
Old 04-25-2011, 06:08 PM
nerdegutta's Avatar
nerdegutta nerdegutta is offline
Senior Member
 
Join Date: Dec 2009
Location: (GMT +1)
Posts: 1,667
Blog Entries: 6
Default

What does your code look like now?

Post it with code-tags... It's the # symbol in the menu on top of the editor...
__________________
- nerdegutta

On the other hand - you have different fingers.
Reply With Quote
The Following User Says Thank You to nerdegutta For This Useful Post:
Rk17 (04-25-2011)
Reply   Post New Thread

Tags


Similar Threads
Thread Thread Starter Forum Replies Last Post
MPLAB simulator jimtr6 Embedded Systems and Microcontrollers 3 06-20-2010 09:11 PM
Willem EPROM Programmer and MPLAb? spinnaker Embedded Systems and Microcontrollers 13 11-26-2009 06:59 PM
Proplem with MPLAB and assembly steinar96 Embedded Systems and Microcontrollers 2 07-10-2009 12:27 AM
"#include" error in mplab Tahmid Embedded Systems and Microcontrollers 1 04-07-2009 05:20 PM
MPLAB: sticking breakpoints [solution] 0xFF Programmer's Corner 0 02-26-2008 04:27 PM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:29 AM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin
Copyright ©2000 - 2014, vBulletin Solutions, Inc.