Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC mikroC Led display project

Status
Not open for further replies.

TheKnight

Member
Hello all. I am a newbie at microcontrollers and I've been following a simple tutorial from Andrew Hazelden's blog - https://www.andrewhazelden.com/blog/2010/02/creating-a-custom-lcd-character-in-mikroc-pro-for-pic/. Anyway, the code is written but when he does "Program" the code compiles and loads into the microcontroller. What do I need to make this work? Do I need to connect a microcontroller board via USB to the PC? Or can it be done with serial port? (I have programmer on serial port). Any explanation on the steps to make it work? Help very appreciated. Thanks.
 
Well, as I said I have both mikroC and MPLAB IDE compilers and don't know if any other software is needed. Anyway here is the code

C:
/*
 * Project name:
     I Heart mikroC
 * Copyright:
     (c) Andrew Hazelden, 2010.
 * Revision History:
     2010 - 02 - 14
 * Description:
     This example shows how to write custom characters to an LCD display.
 * Test configuration:
     MCU:             PIC18F4685
     Dev.Board:       EasyPIC5
                      [url]https://www.mikroe.com/en/tools/easypic5/[/url]
     Oscillator:      HS, 08.0000 MHz
     Ext. Modules:    16x2 LCD display
     SW:              mikroC PRO for PIC
                      [url]https://www.mikroe.com/en/compilers/mikroc/pro/pic/[/url]
 * NOTES:

*/

// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

const char character[] = {0,10,31,31,14,4,0,0};

void CustomChar(char pos_row, char pos_char) {
  char i;
    LCD_Cmd(64);
    for (i = 0; i<=7; i++) LCD_Chr_Cp(character[i]);
    LCD_Cmd(_LCD_RETURN_HOME);
    LCD_Chr(pos_row, pos_char, 0);
}

void main(){

  Lcd_Init();                        // Initialize LCD

  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off


  LCD_Chr(2,4,'I');                  //Write the letter I on the LCD
  CustomChar(2,6);                   //Draw the heart shape on the LCD
  Lcd_Out(2,8,"mikroC");             //Write the word mikroC on the LCD

  Delay_ms(3000);

}  //  end main
 
Last edited by a moderator:
Well, as I said the code works fine but don't know what to do next. How do I upload it to the pic. What hardware do I need.. I was looking for USB pic programmer scheme to make one.
 
Might consider that, but I don't need anything pro for now. I'm just a beginner and I want to try the possibilites. I still haven't made my first project attached to pic. I'm looking for something for starters to see how it's going and if I see that I can do it, I will definetily buy it. Anyway, my question is what PICs are supported by pickit2?
 
Right! Going back to my first post.... You said you had a serial programmer connected to the serial port! Can I ask where it was built? what designs were followed? If you have a home built programmer you need a small piece of software to send the assembled file to the pic chip. If you show me the board you / or someone else made I will point you to the correct software.

As for the pickit2.. I have yet to have an issue with any pic device... The pickit2 uses the standard programming header that all pic's follow (even the latest pic32 )
 
I don't no what programmer you have,but here some good software for serial programers **broken link removed**
 
Guys sorry A million times - been disconected from the net at the moment of the topic for some time and now was searching for new replies. Sorry guys.

Ian : There was an electronics magazine with all the steps explained on how to make the pic, I think I can find it - or take a picture of the pic.

be80be : I am sorry if I am asking dumb questions but does this mean that softwares like mikroC, MPLAB cannot be used with serial? What difference does it make? I was considering of getting a Pickit2 but was unencouraged because still don't know much about microcontrollers.

And one more question : I have Proteus, so was googling for some time about making Proteus and mikroC work together, took me to some french site. So basically what I need to do is make the schematic, place all the parts including the MCU into Proteus, build the code with mikroC or MPLAB Ide (will they both work and which one is better or more useful?) and put the .hex file onto the microcontroller? Had a very simple code, built it and didn't work out. Maybe I'm doing something wrong.

Thanks.
 
Last edited:
Welcome back Knight... You can develop entirely in MPLAB, Proteus has a simulator plugin that makes coding easy... As to the programmer.... MPLAB sends the code in byte form to a device that can control the pic chip to be programmed...ie..pickit2 / 3 these have themselves inbuilt programs that serially clock the byte code into the pic.

So you need MPLAB ( IDE )
.... MickroC ( compiler )
............pickit2 or similar ( programmer )
Or
.......ISIS ( simulator )
 
Last edited:
Good to be back.

First of all, the plugin is into the program, doesn't need to be downloaded it's built into Proteus right? I have seen that the code is built in mikroC then imported into MPLAB and then into Proteus though didn't get the process much.

I have mikroC, MPLAB and Proteus. Also, about the plugin, does this mean that the code can be directly written and edited in Proteus?

Thanks.
 
If you mean...using proteus as a real device...then yes...I don,t use the plugin as I use Hitech for 14 pics and C18 for 16 pics... both these compilers are free and both spew out a decent coff file that runs in ISIS with real time debugging.
 
Yes, I have HiTech. Will be trying out these days and keep you reported.

Thanks a lot. Cheers.
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top