ElaKiri Community
Downloads
Go Back   ElaKiri Community > General > Education
Reload this Page Microcontroller Programming with MikroC PRO for PIC
Reply
 
Thread Tools
(#1)
Old
Little DJ's Avatar
Little DJ Little DJ is offline
Senior Member
Little DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the rough
 
Posts: 1,103
Join Date: Nov 2010
Location: Panadura
Up Microcontroller Programming with MikroC PRO for PIC - 09-01-2011, 01:58 PM





Download MikroC PRO for PIC 4.60 with Crack: Click Here

Step 01: Install and open mikroC PRO for PIC and go to Project---> Close Project to close previously opened projects.



Step 02: Go to File ---> New -----> New Project.. ---->Click Next



Step 03: Select your PIC Microcontroller and click Next



Step 04: Give your clock frequency which use for the Microcontroller (Ex: 4 MHz, 8MHz, 20 MHz)



Step 05: Specify the location to save the project



Step 06: Add project filed if needed. If not leave it as it is and click Next



Step 07: Select initial Library Manager state. According to the requirement include all the libraries or include non3. (Recommend to add all the libraries for the beginners)




Step 08: Click Finish



Step 09: Now you could program your PIC Microcontroller in MikroC PRO environment



To be continued...



For more info: Click Here
Reply With Quote
(#2)
Old
Little DJ's Avatar
Little DJ Little DJ is offline
Senior Member
Little DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the rough
 
Posts: 1,103
Join Date: Nov 2010
Location: Panadura
Up LED Blink Circuit with 16F877A Microcontroller - 09-01-2011, 10:02 PM


After creating the project in MikroC PRO for PIC software, as the next step we could write our first programme to blink LED's using 16F877A Microcontroller.

We could write our programme using ANSI C language. MikroC PRO provides full featured ANSI C compiler for PIC devices from Microchip®.


TRISB - TRISB is a 8 bit register which use to assign the PORT B of the microcontroller as input or output.


If TRISB=0 PORT B is assigned as output.
If TRISB=1 PORT B is assigned as output.


This can be also done as follows

TRISB= b'00000000; //In Binary
TRISB= 0x00; // In Hexadecimal


Same procedure can be done for other ports (PORT A, PORT C, PORT D, PORT E)as well.

PORTB - Assigning values for PORT B register (8 bit) we could get inputs or give outputs from the Microcontroller

If we need to power up pin 0 and pin 2 of the PORT B it could do as follow.

PORTB= b'00000101;
or
PORTB.F0=1;
PORTB.F2=1;



Delay_ms(1000)- This is the delay function which provides by MikroC to make delays according to the user requirement. Changing the value inside the brackets we could make the delay in milliseconds.

Code:

Code:
/************************************************\
*                      www.electronicworkspace.com                      *
*                         Electronics for Everyone                           *
*                           Date: 01/09/2011                                  *
*                        LED Blink with 16F877A                              *
\************************************************/

void main() {
TRISB=0;
PORTB=0;
TRISD=0;
PORTD=0;

  while(1){
    PORTB.RB0=1;
    Delay_ms(750);
    PORTB.RB0=0;
    
    PORTB.RB1=1;
    Delay_ms(750);
    PORTB.RB1=0;
    
    PORTB.RB2=1;
    Delay_ms(750);
    PORTB.RB2=0;
    
    PORTB.RB3=1;
    Delay_ms(750);
    PORTB.RB3=0;
    
    PORTB.RB4=1;
    Delay_ms(750);
    PORTB.RB4=0;
    
    PORTB.RB5=1;
    Delay_ms(750);
    PORTB.RB5=0;
    
    PORTB.RB6=1;
    Delay_ms(750);
    PORTB.RB6=0;
    
    PORTB.RB7=1;
    Delay_ms(750);
    PORTB.RB7=0;

    PORTD.RD0=1;
    Delay_ms(750);
    PORTD.RD0=0;
    
    PORTD.RD1=1;
    Delay_ms(750);
    PORTD.RD1=0;
  }
}

How to compile the code:
Go to Build ----> Click Build (Ctrl + F9)



This programme can be simulate using PROTEUS software (ISIS Professional)



Created HEX file from the MikroC can be imported to the ISIS Professional software and test.



Download MikroC code & PROTEUS Design: Click Here

More info: Click Here

Reply With Quote
(#3)
Old
Little DJ's Avatar
Little DJ Little DJ is offline
Senior Member
Little DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the rough
 
Posts: 1,103
Join Date: Nov 2010
Location: Panadura
09-02-2011, 07:03 AM

bump
Reply With Quote
(#4)
Old
wave.slay's Avatar
wave.slay wave.slay is offline
Senior Member
wave.slay is on a distinguished road
 
Posts: 642
Join Date: Sep 2008
Location: atana metana
09-02-2011, 07:32 AM

bump
Reply With Quote
(#5)
Old
Little DJ's Avatar
Little DJ Little DJ is offline
Senior Member
Little DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the rough
 
Posts: 1,103
Join Date: Nov 2010
Location: Panadura
Up 16x2 LCD with 16F877A - 09-03-2011, 07:00 AM



In this exercise lets look at how can we interface a LCD display with 16F877A PIC microcontroller.

The mikroC PRO for PIC provides a library for communication with LCDs (with HD44780 compliant controllers) through the 4-bit interface.

HD44780 Pinout
  1. Vss (Ground)
  2. VCC (5V)
  3. Contrast (use a potentiometer for variable contrast, or just connect to GND)
  4. Register Select (RS), 0 = command write, 1 = data write
  5. Read/Write (R/W), 0 = write to display, 1 = read from display
  6. Enable (EN) - used to clock in data
  7. DB0 (not used in 4-bit mode) - LSb
  8. DB1 (not used in 4-bit mode)
  9. DB2 (not used in 4-bit mode)
  10. DB3 (not used in 4-bit mode)
  11. DB4 - LSb in 4-bit mode
  12. DB5
  13. DB6
  14. DB7 - MSb
  15. Backlight + (5V)
  16. Backlight - (GND)

4-bit and 8-bit modes

An HD44780 LCD can be operated in two different modes: 4-bit mode and 8-bit mode. In 8-bit mode, pins 7-14 of the LCD are connected to eight I/O pins on the microcontroller; while in 4-bit mode, pins 11-14 on the LCD are connected to four I/O pins on the microcontroller. The advantage to operating in 8-bit mode is that the programming is a bit simpler and data can be updated more quickly. The obvious reason to operate in 4-bit mode is to save four I/O pins on the PIC microcontroller.

Circuit Diagram for 16x2 LCD



Complete Circuit Diagram with PIC Microcontroller




To get MikroC Code & PROTUES Design: Click Here

Reply With Quote
(#6)
Old
GDThanuja's Avatar
GDThanuja GDThanuja is offline
Senior Member
GDThanuja has a spectacular aura aboutGDThanuja has a spectacular aura aboutGDThanuja has a spectacular aura aboutGDThanuja has a spectacular aura about
 
Posts: 498
Join Date: Dec 2010
Location: පුටුව උඩ
09-03-2011, 07:50 AM

Thanks........
Reply With Quote
(#7)
Old
Little DJ's Avatar
Little DJ Little DJ is offline
Senior Member
Little DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the rough
 
Posts: 1,103
Join Date: Nov 2010
Location: Panadura
Up Let's Make a Thermometer with DB18B20 - 09-12-2011, 12:07 PM



Dallas 18B20



The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points. The DS18B20 communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with a central microprocessor. It has an operating temperature range of -55°C to +125° and is accurate to ±0.5°C over the range of -10°C to +85°C.

Here the thermometer (Dallas 18B20) senses the environment temperature and then sends that value as a digital input with 16bit binary code to the microcontroller. It could measure temperatures from -55°C to +125°C (-67°F to +257°F). Dallas 18B20 uses 1 wire bus system to communicate with the microcontroller. The 1-Wire bus system uses a single bus master to control one or more slave devices. The DS18B20 is always a slave. When there is only one slave on the bus, the system is referred to as a ‘single-drop’ system, the system is ‘multi-drop’ if there are multiple slaves on the bus.


Circuit Diagram





Download MikroC code and PROTEUS Design: Click Here
Reply With Quote
(#8)
Old
Little DJ's Avatar
Little DJ Little DJ is offline
Senior Member
Little DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the roughLittle DJ is a jewel in the rough
 
Posts: 1,103
Join Date: Nov 2010
Location: Panadura
09-22-2011, 06:59 AM

bump
Reply With Quote
(#9)
Old
chariya1 chariya1 is offline
Member
chariya1 is an unknown quantity at this point
 
Posts: 40
Join Date: Nov 2011
06-04-2012, 10:13 PM

maxxa bro
Reply With Quote
(#10)
Old
0716aravinda's Avatar
0716aravinda 0716aravinda is offline
Senior Member
0716aravinda is a name known to all0716aravinda is a name known to all0716aravinda is a name known to all0716aravinda is a name known to all0716aravinda is a name known to all0716aravinda is a name known to all0716aravinda is a name known to all0716aravinda is a name known to all0716aravinda is a name known to all0716aravinda is a name known to all0716aravinda is a name known to all
 
Posts: 21,343
Join Date: Aug 2008
Location: අනේ මන්දා බන්zලා
06-04-2012, 10:28 PM

bumpppppp
Reply With Quote
Reply

Bookmarks

Thread Tools

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



Copyright © 2006 - 2011 ElaKiri™ Beta2.Evo vBulletin, vBa iBproArcade Subdreamer I-Magic MKv
Optimisation plugin by DBtech

Page generated in 0.09053 seconds with 8 queries