programa para lcd de 4 bits sin rw

Hola todos: tengo el siguiente inconveniente, estoy programando una lcd 16X2 a 4 bits en un pic 16F84a con ccs- picc. Intenté hacer la programación sin rw, poniendo este pin a masa, pero no logro ni inicializar la pantalla. Con el uso del rw me sale muy bien, pero necesito ese pin. He probado toda clase de retardos, los que traen los tutoriales de la lcd, junto con otros de prueba, pero nada. Agradeceriasi alguien tiene una rutina que no use rw y funcione poniendo este pin a masa. Gracias. Bye.
 
hola amigo, yo manejo el pic16f873a con 8 bits para la lcd.....en tu caso es para 4bits y bueno tengo un libro del pic16f84 en donde esta el codigo para la lcd a 4 bits.......ahora bien no cual es tu forma de programas ya que hay varios........el que yo uso es mplab ide de microchip y el del libro tambien.....

.......si te sirve dime......bye
 
aqui tienes una

Código:
//////////////////////////////////////
// SET AMOUNT OF COLUMBS TO DISPLAY //
//////////////////////////////////////
#define DISPLAY_COLS  16            //
//////////////////////////////////////
////////////////////////////////////
// DEFINE PINS IN USE FOR THE LCD //
////////////////////////////////////
#define LCD_D0  PIN_D4
#define LCD_D1  PIN_D5
#define LCD_D2  PIN_D6
#define LCD_D3  PIN_D7
#define LCD_EN  PIN_D3
#define LCD_RS  PIN_D2

//LCD Commands

#define CLEAR_DISP         0X01
#define LCD_HOME	         0X02
#define LCD_SETMODE	      0X04
#define LCD_SETVISIBLE	   0X08
#define LCD_SHIFT	         0X10
#define LCD_SETFUNCTION    0X20
#define LCD_SETCGADDR	   0X40
#define LCD_SETDDADDR	   0X80


#define LINE_1          0X00
#define LINE_2          0X40

#if DISPLAY_COLS == 40
#define LINE_3          0X28
#define LINE_4          0X68
#endif

#if DISPLAY_COLS == 20
#define LINE_3          0X14
#define LINE_4          0X54
#endif

#if DISPLAY_COLS == 16
#define LINE_3          0X10
#define LINE_4          0X50
#endif

//////////////////////

void LCD_INITIALMODE       ( void );
void CLEAR_C_SCREEN        ( void );
void LCD_MTPOS             ( char D_ );
void LCD_WRITE_CHAR        ( char D_ );
void LCD_WRITE_COMMAND     ( char D_ );
void LCD_NIBBLELOAD        ( void );
void LCD_PUT_DATA          ( unsigned int D_ );

void LCD_INITIALMODE ( void )
{
    LCD_PUT_DATA ( 0X00 );
    delay_ms ( 15 );
    output_low ( LCD_RS );
    LCD_PUT_DATA ( 0X03 );
    LCD_NIBBLELOAD();
    LCD_NIBBLELOAD();
    LCD_NIBBLELOAD();
    LCD_PUT_DATA ( 0X02 );       /* set 4-bit interface                       */
    LCD_NIBBLELOAD();
    LCD_WRITE_COMMAND ( 0X2C );  /* function set (all lines, 5x7 characters)  */
    LCD_WRITE_COMMAND ( 0X0C );  /* display ON, cursor off, no blink          */
    LCD_WRITE_COMMAND ( 0X06 );  /* entry mode set, increment & scroll left   */
}
void CLEAR_C_SCREEN ( void )
{
   LCD_WRITE_COMMAND(CLEAR_DISP);
   LCD_WRITE_COMMAND(LCD_SETDDADDR+0X00);
}
void LCD_MTPOS ( char D_ )
{
    LCD_PUT_DATA ( swap ( D_ ) | 0X08 );
    LCD_NIBBLELOAD();
    LCD_PUT_DATA ( swap ( D_ ) );
    LCD_NIBBLELOAD();
}
void LCD_WRITE_CHAR( char  D_ )
{
    output_high ( LCD_RS );
    LCD_PUT_DATA ( swap ( D_ ) );
    LCD_NIBBLELOAD();
    LCD_PUT_DATA ( swap ( D_ ) );
    LCD_NIBBLELOAD();
    output_low ( LCD_RS );
}
void LCD_WRITE_COMMAND( char D_ )
{
    LCD_PUT_DATA ( swap ( D_ ) );
    LCD_NIBBLELOAD();
    LCD_PUT_DATA ( swap ( D_ ) );
    LCD_NIBBLELOAD();
}
void LCD_NIBBLELOAD( void )
{
    output_high ( LCD_EN );
    delay_us ( 10 );
    output_low ( LCD_EN );
    delay_us ( 200 );
}
void LCD_PUT_DATA( unsigned int D_ )
{
    output_bit ( LCD_D0, D_ & 0X01 );
    output_bit ( LCD_D1, D_ & 0X02 );
    output_bit ( LCD_D2, D_ & 0X04 );
    output_bit ( LCD_D3, D_ & 0X08 );
}
 
Hola como están?, hace tiempo que no pasaba por este foro... y ahora que me estoy iniciando en el lenguaje CCS y ando queriendo utilizar un LCD2x16 sin usar el pin RW, pero no logro que el código funcione en la práctica... en Proteus me funciona casi bien.. ya que quiero escribir "hola" y solo me muestra " ola"... pensando que es un problema del simulador monte todo pero no logro que me escriba bien..., es decir me muestra unas letras tipo el símbolo de sumatoria... bueno les dejo el código...

Código:
#include <lcd_sinRW.h>

#include <lcd_2.c>


void main()
{

   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_ccp1(CCP_OFF);
   setup_comparator(NC_NC_NC_NC);

   //TODO: User Code
   
   LCD_INITIALMODE();
   
   while(true){
   
      CLEAR_C_SCREEN();
         
      LCD_WRITE_CHAR("hola");
      
      delay_ms(500);
      
   }
      
}

y en el archivo lcd_2.c

Código:
#define LCD_D0  PIN_B4
#define LCD_D1  PIN_B5
#define LCD_D2  PIN_B6
#define LCD_D3  PIN_B7
#define LCD_EN  PIN_B3
#define LCD_RS  PIN_B2

desde ya gracias... y seguiré buscando el problema... un abrazo Ramón
 
Atrás
Arriba