Hc 595 4780 LED display

lurkepus

Member
I'm working on a little project using a pic16f628a , hc595 and a 4780 LCD display in 8 bit mode , but i just get a black screen .
i'm not sure if it is a hardware or software problem ..

This is the code i'm using
Code:
;*******************HC595 pins****************************************
; Pic pin 17 (DS)to pin 14
; Pic pin 18 (SH)to pin 11
; Pic pin 1  (ST)to pin 12
; 595 Pin 10 16 to +
; 595 Pin  8 13  to  Gnd
;********************************************************************
#define PIN_q7 PORTA,0 ; DS (serial data in)
#define PIN_SH PORTA,1 ; SH_CP(shift)
#define PIN_ST PORTA,2 ; ST_CP (latch)
#define LCD_RS PORTA,3 ; PIC pin 2 ->LCD RS (pin4)
#define LCD_E  PORTA,4 ; PIC pin 3 ->LCD clock(pin6) 1 to send data

#define R_DEL1            0x20    ; Delay register
#define R_DEL2            0x21    ; Delay register

*********************************************************
;LCD INIT
;**********************************************************
;Boot
;**********************************************************
Boot
    movlw    0x14
    call    delay
;**********************************************************
;   LCD INIT 2
;**********************************************************

INIT
    bcf LCD_E
    BcF LCD_RS
    ;movlw b'00110000'
    ;call _595
    ;call pulse_e
    movlw b'00110000'
    call _595
    call pulse_e
    movlw b'00110000'
    call _595
    call pulse_e
;***************************************************
    movlw b'00110000'  ;8 bit operation For 4 bit mode Send command 0010xxxx as one operation (bottom 4 bits are don't care)
    call _595
    call pulse_e
    movlw b'00001111'
    call _595
    call pulse_e
    movlw b'00000111'
    call _595
    call pulse_e
    movlw b'00000001'
    call _595
    call pulse_e

 
loop
 
    bcf LCD_RS
    movlw b'00000010'
    nop
    nop
    nop
    bsf        LCD_RS
    call delay_1ms
    movlw 'a'
    call _595
    call pulse_e
loop1
    goto loop1
_595
  movwf data1
   movlW .8
  movwf RXT


d0
        btfsc     data1,7
        bsf   PIN_q7
        btfss   data1,7
        bcf     PIN_q7
        bsf     PIN_SH
        call    delay_1ms
    call    delay_1ms
        bcf     PIN_SH
     rlf data1

  DECFSZ RXT,F

  goto d0
       bsf     PIN_ST
     call    delay_1ms
    call    delay_1ms
        bcf     PIN_ST
  return
pulse_e
    bsf        LCD_E
    nop
    nop
    nop
    nop
    bcf        LCD_E
    call    delay_1ms
    call    delay_1ms
    call    delay_1ms
    return
 
i just added the code for the 595 and 4780 to make it easy to read but i do have the comparators turned off and the 595 works. tested it using LED's .. I also use a 10k trimpot to adjust the contrast ..

Code:
main
CLRF PORTA
MOVLW 0x07
MOVWF CMCON
BCF STATUS, RP1
BSF STATUS, RP0 ;Select Bank1
MOVLW b'01000000'
MOVWF TRISA
MOVLW 0xf0
MOVWF TRISB
BANKSEL PORTA
CLRF PORTA
CLRF PORTB
 
i did try to swap
LCD_RS PORTA,3 --> PORTB,3
LCD_E PORTA,4 --> PORTB,0

They both have pullup resistors but no luck ...
 
Just tested the (bit) of code you posted.... With a 10k pullup on RA4 it works well!!


EDIT!!!

I noticed you have named PORTA,0 pin_q7... I know this connects to the DS pin... You haven't connected it to Q7???
 
Last edited:
sorry about the messy code RA0 (pin 17) is connected to pin 14 (DS) on the 595 .. I i will try to add the pull up resistor and see if that helps i just need to put stuff back on the breadboard first btw the loop was just for testing and will be removed as soon as i got things working
 
i have gone trough the wiring and added the pull up resistor but the display is just looking like this .. could it be a timing issue ?

 
this is the config settings i'm using not sure if it's the problem

__CONFIG _FOSC_INTOSCIO & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _BOREN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…