Pic 16f872 lcd and reused equipment

Discuss with MikroElektronika software developers about current library development.
Post Reply
Author
Message
davhello
Posts: 2
Joined: 06 Nov 2015 12:48

Pic 16f872 lcd and reused equipment

#1 Post by davhello » 06 Nov 2015 13:02

Hello all!

My name is david and i 'm french.
I am starting pic dev with Mikroc.
I am on a project of reuse a lcd board with a pic 16f872.
This part is a part of a Intermec PF4i printer.
I have the service manual with schematics of this board :
Pf4i console PCB.pdf
(305.42 KiB) Downloaded 281 times
I took the lcd example of mikroc site and customized it to :

Code: Select all


// Lcd module connections
sbit LCD_RS at RA5_bit;
sbit LCD_EN at RA4_bit;
sbit LCD_D4 at RA0_bit;
sbit LCD_D5 at RA1_bit;
sbit LCD_D6 at RA2_bit;
sbit LCD_D7 at RA3_bit;

sbit RW at RC6_bit;

sbit LCD_RS_Direction at TRISA5_bit;
sbit LCD_EN_Direction at TRISA4_bit;
sbit LCD_D4_Direction at TRISA0_bit;
sbit LCD_D5_Direction at TRISA1_bit;
sbit LCD_D6_Direction at TRISA2_bit;
sbit LCD_D7_Direction at TRISA3_bit;
// End Lcd module connections

char txt1[] = "mikroElektronika";
char txt2[] = "EasyPIC7";
char txt3[] = "Lcd4bit";
char txt4[] = "example";

char i;                              // Loop variable

void Move_Delay() {                  // Function used for text moving
  Delay_ms(500);                     // You can change the moving speed here
}

void main(){
PORTA = 0;
TRISA = 0;
PORTB = 0;
TRISB = 1;
PORTC = 0;
TRISC = 0;
//RC6_bit = 0;
PORTC.F6 = 0; //RW LCD à zéro



  //ANSELA = 0;                        // Configure PORTB pins as digital

  Lcd_Init();                        // Initialize Lcd

  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
  Lcd_Out(1,6,txt3);                 // Write text in first row

  Lcd_Out(2,6,txt4);                 // Write text in second row
  Delay_ms(2000);
  Lcd_Cmd(_LCD_CLEAR);               // Clear display

  Lcd_Out(1,1,txt1);                 // Write text in first row
  Lcd_Out(2,5,txt2);                 // Write text in second row

  Delay_ms(2000);

  // Moving text
  for(i=0; i<4; i++) {               // Move text to the right 4 times
    Lcd_Cmd(_LCD_SHIFT_RIGHT);
    Move_Delay();
  }

  while(1) {                         // Endless loop
    for(i=0; i<8; i++) {             // Move text to the left 7 times
      Lcd_Cmd(_LCD_SHIFT_LEFT);
      Move_Delay();
    }

    for(i=0; i<8; i++) {             // Move text to the right 7 times
      Lcd_Cmd(_LCD_SHIFT_RIGHT);
      Move_Delay();
    }
  }
}

But nothing arrive on lcd.

I noticed RW pin is connected to RC6.
The burning/flash/erase of the pic is OK and verifyed.


I am actually trying to find frequency of the rc configuration on the board.

Some photos of the board :
20151106_134758.jpg
20151106_134758.jpg (1.8 MiB) Viewed 5360 times
20151106_134815.jpg
20151106_134815.jpg (2.21 MiB) Viewed 5360 times
If someone see something wrong...

Config bits in other post (max3 attachments)...

davhello
Posts: 2
Joined: 06 Nov 2015 12:48

Re: Pic 16f872 lcd and reused equipment

#2 Post by davhello » 06 Nov 2015 13:24

Config bits :
ConfigBits.jpg
ConfigBits.jpg (99.29 KiB) Viewed 5330 times
Sorry for too big photos....

davegsm82
Posts: 156
Joined: 29 Mar 2011 20:35

Re: Pic 16f872 lcd and reused equipment

#3 Post by davegsm82 » 01 Dec 2015 21:25

I think you might have posted this in the wrong section but no worries.

I think 4mhz might be wildly optimistic for an RC oscillator frequency, I expect it's probably somewhere in the region of less than 100KHz, if you can get an oscilloscope on the CLKOUT pin and measure it then it will be easier than trying to guess. Bare in mind that all of your delay routines are based on what you put into the clock frequency box, so it will be running but your delays will be INCREDIBLY long and the display may not like this.

Nice boards by the way, do you have more than one? I have a few boards with 18F2520's on them, they are brilliant for prototyping.

Dave.

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: Pic 16f872 lcd and reused equipment

#4 Post by Aleksandar.Mitrovic » 02 Dec 2015 15:52

Hi,

Can you please try to change your oscillator settings to HS?

Best regards,
Aleksandar

Post Reply

Return to “Library Development Discussion”