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.

[SOLVED] PIC complete discussion for all

Status
Not open for further replies.

romel_emperado

Advanced Member level 2
Advanced Member level 2
Joined
Jul 23, 2009
Messages
606
Helped
45
Reputation
132
Reaction score
65
Trophy points
1,318
Location
philippines
Activity points
6,061
guys, Im a starter of PIC microcontroller.

As I check the Hitech c compiler there are fuse bits settings for WDT, FOSC and ETC.. and then when I look to my programmer software (winPICgm and pony prog) the same settings for config bits are present..

the question is, is it the same if I just make a fuse bit settings during programming the device? I mean I will just write code to my compiler without setting a fuse bits. and set it later in my programming software.(winpicgm and ponyprog,Icprog).?
 
Last edited:

thanks ckshivaram!! You're the best!! :)

I will study first how to set the fuse bits..if you have any useful links pls share.. Im reading also now..
 

Hi,

this is very good tutorial of hitech - C for pic 18
**broken link removed**

---------- Post added at 10:35 ---------- Previous post was at 10:34 ----------

you can get some download books also here
The PIC Tutorial - Free PIC Books
 
I've got this simple code but why there's a warning that is out of date?? what does it mean??



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
#include<pic.h>
 
 
void main()
{
   RA2 = 0;
   while(1)
   {
      RA2 = 1;
   }
}





Build C:\users\romel\Desktop\program test\blink-LED.c for device 16F628
Using driver C:\Program Files\HI-TECH Software\PICC\9.80\bin\picc.exe

Make: The target "C:\users\romel\Desktop\program test\blink-LED.p1" is out of date.
Executing: "C:\Program Files\HI-TECH Software\PICC\9.80\bin\picc.exe" --pass1 "C:\users\romel\Desktop\program test\blink-LED.c" -q --chip=16F628 -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\HI-TECH Software\PICC\9.80\bin\picc.exe" -oblink-LED.c.cof -mblink-LED.c.map --summary=default --output=default blink-LED.p1 --chip=16F628 -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"
(1273) Omniscient Code Generation not available in Lite mode (warning)
HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.80
Copyright (C) 2010 Microchip Technology Inc.

Memory Summary:
Program space used Ah ( 10) of 800h words ( 0.5%)
Data space used 2h ( 2) of E0h bytes ( 0.9%)
EEPROM space used 0h ( 0) of 80h bytes ( 0.0%)
Configuration bits used 0h ( 0) of 1h word ( 0.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 **broken link removed** for more information.

Loaded C:\users\romel\Desktop\program test\blink-LED.c.cof.

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

IM using the new version of MPLAB from microchip.. the hex is generated but not funtioning.. i tested it in proteus..
 

thanks.. it's now working.. what's wrong with declaring specific bit like what I did?


this sample code is now working


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
#include<pic.h>
 
 
void main()
{
   TRISB = 0;
   while(1)
   {
      PORTB = 1;
   }
}



---------- Post added at 11:26 ---------- Previous post was at 11:24 ----------

I think I need to declare first TRISB = 0 before I can declare RB2 = 0;

wait I will try.. :)
 

Nothing is wrong, you can use specific bits of a PORT if needed.
If you use TRISB=0;
That means you are setting each bits of TRISB register to 0.
This makes all PORTB bits as output .

If you want to make a single bit say RB0 as output then you can use
TRISB0=0;
or
TRISB=0b11111110;
This details are there in the datasheet.
 
thanks... I think I know a little of using PIC microcontroller... tnx guys... I will practice more..

I tried this code and its working.
.

Code C++ (Qt) - [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
#include<pic.h>
 
 
void main()
{
   
   unsigned int x;
   TRISB = 0x02;
   PORTB = 0x02;
   
  
   while(1)
   {
   
      
      RB0 = 1;
      RB5 = 0;
      for(x=0; x<1000; x++);
      RB0 = 0;
      RB5 = 1;
      for(x=0; x<1000; x++);
      
      if(RB1 = 0)
      RB7 = 1;
      else
      RB7 = 0;
      
   }
}

 

yes sorry.. that's typographical error.. :) hehe

thanks..

---------- Post added at 12:39 ---------- Previous post was at 12:31 ----------

by the way what is the difference if I say

#include"pic.h"
and
#include<pic.h>

the result is the same in the simulation..
 

if you use < > symbol then this file is searched in the complete drive
if you use " " then the header file is searched only in the present working directory......
 
if you use < > symbol then this file is searched in the complete drive
if you use " " then the header file is searched only in the present working directory......

thanks... I see the difference now..



FRIEND,
NO NEED to click 'help' for every post.......okay.:wink:.

what do you mean by clicking help?

---------- Post added at 12:47 ---------- Previous post was at 12:47 ----------

you mean the thanks button?

---------- Post added at 12:49 ---------- Previous post was at 12:47 ----------

I noticed that the fuse bits of HItech C is not working unless you write directly the fuse bits into your code.. . Isn't it?
 

yes... there is no need to click on helpful button.. if you feel the answered has helped you then you can click... that's what vinodstanur means..........
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top