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.

how to configured pic16f676 in micro c pro compiler

Status
Not open for further replies.

SHADIQUE

Member level 3
Member level 3
Joined
Dec 3, 2016
Messages
54
Helped
3
Reputation
6
Reaction score
3
Trophy points
8
Location
New Delhi
Activity points
444
hi,
i am new in pic programming .i work with simulation. but just work with hardware not working my programming please help me how to define header and configuration bit.

- - - Updated - - -

anybody help me how to start configure and header code in micro c for pic16f676
 

It is done in project settings. Then in project settings it shows config words, copy them and paste them in proteus PIC model.
 
hi sir i am using micro c pro compiler .in project setting not shown config bit, please help me sir
 

See image.
 

Attachments

  • config registers.png
    config registers.png
    32.8 KB · Views: 234

hello sir i seen but how to define in compiler please give a exampleof real world source code of led blinking for pic16f676

- - - Updated - - -

please okada give me a example of led blinking in real world for pic16f676 with header and config world
 

You don't have to define config words in mikroC PRO PIC code. It will be included in the .hex file. If you are simulating in Proteus then you have to set the config words accordingly in Proteus.

Zip and post your mikroC PRO PIC project files and I will modify it.

Edit:

Ext Osc / Int Osc ?
Crystal frequency ?
Which pin Led is connected to ?
 
Last edited:
Code:
void main()
{
     while(1)
     {
  TRISC = 0x00;                 //Port C as Output

      PORTC=0XFF;
      delay_ms(1000) ;
      PORTC=0X00;
      delay_ms(1000) ;

}    
}
sir this is my code ,it is not working on hardware of pic16f676 ,where is define config word ,please correct it.

- - - Updated - - -

sir i am using portc all pin as a high
Code:
void main()
{
     while(1)
     {
  TRISC = 0x00;                 //Port C as Output

      PORTC=0XFF;   // all pin high 
      delay_ms(1000) ;
      PORTC=0X00;
      delay_ms(1000) ;

}    }
 

I already told you there is no config word in mikroC code. config word is auto generated when you select osc type and other settings in project properties. The config word will be in the .hex file generated.

When you load .hex file in your programmer software then the config words are shown. See if your programmer software is changing it. If WDT is enabled then PIC will be resetting and you don't see the output. Disable WDT (Watch Dog Timer) if it is enabled in project settings.

Code is correct.
 
please tell me sir how to define and where is define please give a example sir
 
Try my code. It works. You had to turn Off Analog function on PORTC. Proteus file attached.
 

Attachments

  • Blinky.rar
    29.5 KB · Views: 204
hi sir i am using micro c pro compiler .in project setting not shown config bit, please help me sir

You use mikroc compiler yet you don't see configuration bit settings? Then tell me step by step how you compile your code.
 

hi sir in my hardware not working my hex file .

- - - Updated - - -

anybody help me how to configure pic16f676 in micrro c pro compiler for led blinking source code
 

Make a copy of the project in post #10. I tested it on hardware and it is working fine. Now compile that project with your compiler and if the .hex file generated differs from my .hex file (you can open .hex file in notepad to compare) then it means you are not using legit version of Compiler and that is the actual problem. If you find that is the problem then better buy a Compiler.
 
hi sir in my hardware not working my hex file .

- - - Updated - - -

anybody help me how to configure pic16f676 in micrro c pro compiler for led blinking source code

Send the schematic of your hardware. What is the source of your oscillator. Is it internal oscillator or crystal? when you compile the code follow this step. Special attention to be given to Oscillator and MCLR settings. These are to be set as per your hardware.

Open mikroC pro compiler - Project - New Project - (A new window will be opened where you put Project Name, Project Folder, Device Name, device clock - also check the box against "Open Edit Project Window to set configuration bits" and finally hit Next) - Next - Next - (Another window "Edit Project" will be opened where you set/put various bits of configuration settings and hit OK).

This will finish your configuration bit settings and main work space will open. Delete whatever on this work space and paste the following code on the work space.


Code:
void main()
{
TRISC = 0x00;                 //Port C as Output
ANSEL = 0x00;
     while(1)
     {
  
      PORTC=0XFF;   // all pin high 
      delay_ms(1000) ;
      PORTC=0X00;
      delay_ms(1000) ;

}  
  }

Now build the code and burn your MCU with the generated .hex file.
Hope this will make your desired result.
 
thanks okara ,you said right .your hexfile is working on my hardware but you source code not work.i think my compiler is not right hex file generate ,why please tell me and which com piler are you used .
 

I have used mikroC PRO PIC licensed Compiler latest version.
 

thanks okara ,you said right .your hexfile is working on my hardware but you source code not work.i think my compiler is not right hex file generate ,why please tell me and which com piler are you used .

It may not true to conclude that compiler is faulty. I think you missed something in setting configuration bits. Have a try as per post at #14 and see what happens.
 

    MOHITARORA

    Points: 2
    Helpful Answer Positive Rating
@swapan

How do you say Compiler is not faulty ? He Compiled my project with my code and my project settings and he obtained a differing .hex file.
 

@swapan

How do you say Compiler is not faulty ? He Compiled my project with my code and my project settings and he obtained a differing .hex file.

Please note, I have only pointed out a possibility and not surely. Compiler's fault is remote. However let the guy buy compiler and feel if there is any difference.
 

Please note, I have only pointed out a possibility and not surely. Compiler's fault is remote. However let the guy buy compiler and feel if there is any difference.

hello swapan in setting you said
also check the box against "Open Edit Project Window to set configuration bits" and finally hit Next) - Next - Next - i din't found ,please tell me again step by step setting config
please
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top