Starting Programming PIC16f877 with C

ErnieM

Joined Apr 24, 2011
8,377
HI,

while building project it show error...why?
step i have done...
1. create new project PIc16F877A next
2.save a file with testpic next
4.next ( I have not add any file)next
5.finish
6.open new file paste my code
7.save code by testpic.c
8. then right click i add to project
9.after that i build it show this error, why??
Last line of quoted message: "20. delay exceeds maximum limit of 197120 cycles"

This means in line 20 the number passed to the delay routine is too large. Either call it several times with a smaller number or use another delay routine.
 

t06afre

Joined May 11, 2009
5,934
Last line of quoted message: "20. delay exceeds maximum limit of 197120 cycles"

This means in line 20 the number passed to the delay routine is too large. Either call it several times with a smaller number or use another delay routine.
This has been fixed in later versions of the HI-Tech C compiler also. If the OP use version 9.83. As he said in post #4 (I think). It will not be a problem. However your point is quite good. Then the compiler give an error. Read the error message. If still in doubt look the error up in the manual. Learn to know the manual, and it will be your best friend
 

t06afre

Joined May 11, 2009
5,934
Hi,

In my C drive there is only PIC->PRO->9.65 no other now what to do??
Dude You gave a link showing which C-compiler you used in post 6. And strangely enough you will also find downloading links on this page. That is for 9.83 Thats why assumed you used this version:rolleyes:. The download is free for the compiler in LITE mode. So just download and have fun. Then you have installed remove the older version.
It may be that you must register in order to download. But Microchip will not spam your inbox
 

t06afre

Joined May 11, 2009
5,934
I think it is for window if not then which r u talking...?
anyway, i have downloaded this ...8.87 is there any need of any other thing now??
In the link you posted in post #6 One is marked OSX, one is marked linux. What do you think. Will either of these work on Windows OS. I guess no. So once more. If you have downloaded any thing else than the file "picc_9_.83_win.exe" You have done something wrong.
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
And now you have for sure downloaded and installed the 9.83 version of the Hi-Tech C compiler. Yes or no.
OK, I have installed it, and the project is build ..
with this message.


Build C:\Users\John\Desktop\pic for device 16F877A
Using driver C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe

Make: The target "C:\Users\John\Desktop\pic.p1" is out of date.
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" --pass1 C:\Users\John\Desktop\pic.C -q --chip=16F877A -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"
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" -opic.cof -mpic.map --summary=default --output=default pic.p1 --chip=16F877A -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 (Lite Mode) V9.83
Copyright (C) 2011 Microchip Technology Inc.
(1273) Omniscient Code Generation not available in Lite mode (warning)

Memory Summary:
Program space used 27h ( 39) of 2000h words ( 0.5%)
Data space used 5h ( 5) of 170h bytes ( 1.4%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
Configuration bits used 1h ( 1) of 1h word (100.0%)
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)


Running this compiler in PRO mode, with Omniscient Code Generation enabled,
produces code which is typically 40% smaller than in Lite mode.
See http://microchip.htsoft.com/portal/pic_pro for more information.

Loaded C:\Users\John\Desktop\pic.cof.

********** Build successful! **********
 

t06afre

Joined May 11, 2009
5,934
So now you just have to program the PIC, with your programmer. If you have a PICKIT 2 or 3 you can program from MPLAB. If not load the .hex file made by the compiler into your programmer
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
I have programed that HEX successfully, but when i was testing PIC on Breadboard with 4Mhz crystal and 5V supply with one LED at port B it was not blinking....only glowing,why??
the voltage on port B was near .14V and on other it was ~2V
 
Top