View previous topic :: View next topic |
Author |
Message |
omid_juve
Joined: 25 Oct 2012 Posts: 8
|
lcd 2x16 interfacing need pull up? |
Posted: Thu Nov 08, 2012 12:26 pm |
|
|
I write a program for my pic, it`s work fine with Proteus but when i test it in real hardware it`s just show a black line on first line of the lcd display.
Does it need a pull up resistor? |
|
|
WingNut
Joined: 04 Nov 2012 Posts: 6 Location: NC
|
|
Posted: Thu Nov 08, 2012 12:38 pm |
|
|
What PIC are you using?
What is your compiler version?
No one here is psychic. Post your code. |
|
|
omid_juve
Joined: 25 Oct 2012 Posts: 8
|
|
Posted: Thu Nov 08, 2012 1:13 pm |
|
|
plz check my pic is 16f1947 and this the config of lcd pin
Code: |
#define LCD_DB4 PIN_D3
#define LCD_DB5 PIN_D2
#define LCD_DB6 PIN_D1
#define LCD_DB7 PIN_D0
#define LCD_E PIN_E3
#define LCD_RS PIN_E2
|
and here is the code
with compiler pcm 4.13
Code: |
#include <control valve.h>
#include <stdlib.h>
#include <flex_kbd.c>
#define startpoint 3200
#define error 120
#define cw 1
#define ccw 2
#define ccwm 3
#define threshold 921
#include <lcd_flex.c>
unsigned int16 step1;
unsigned int16 position;
int8 opening;
char m;
float ff1;
void main()
{
char c;
set_tris_g(0xf0);
setup_oscillator(OSC_16MHZ|OSC_INTRC|OSC_PLL_OFF,0);
port_b_pullups(0XFF);
setup_adc_ports(sAN2);
setup_adc(ADC_CLOCK_DIV_64);
set_adc_channel( 2 );
delay_us(100);
lcd_init();
kbd_init();
while(m!=ccwm )
{
m = kbd_getc();
lcd_gotoxy(1,1);
printf(LCD_PUTC, "open=%u",opening);
lcd_putc(" ");
if( m==cw)
{
if (++opening!=100)
delay_ms(200);
}
else if (m==ccw)
{
if (--opening!=0)
delay_ms(200);
}
}
ff1=(opening/100.0);
ff1=ff1*startpoint;
position=ff1;
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(LCD_PUTC, "pos=%Lu",position);
lcd_putc(" ");
delay_ms(1000);
while(true)
{
m = kbd_getc();
if (m==ccw)
{
initialize();
delay_ms(200);
step_motor_ccw();
}
else if (m==ccwm) manual_adjust1();
}
}
|
|
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Nov 08, 2012 2:44 pm |
|
|
We also need to know LCD type and compiler version No.
What have you done with LCD W/R pin?
Have you checked that LED flasher code works at EXACTLY the correct speed?
Mike
EDIT Read CCS forum guidelines for instructions on how best to get help.
Get rid of Proteus. Do a search on this forum to assess its worth. |
|
|
|