LCD RS bit wiring with 16F685


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Location
    North of France
    Posts
    18

    Question LCD RS bit wiring with 16F685

    Hi everybody.
    After spending time since many days and looking everywhere on this forum and other, I don't find where is my mistake.
    Below, y'oull se my working program if I connect the LCD Register Select bit on PORTA.4.
    But... It's better for my PCB to connect it on PORTC.6.

    If I do that, my LCD doesn't work and I don't know why.

    Is there anyone who know ?

    Here is the code :

    Code:
    @ device PIC16F685, intrc_osc_NOCLKOUT, wdt_off, pwrt_on, mclr_off, protect_off, bod_on
    DEFINE NO_CLRWDT 1         
    
    Define OSC 4			 
    INTCON = %10001000     
    OSCCON = %01100111	
    VRCON  = 000000   
    ADCON0 = 000000       
    
    Define ADC_BITS 10
    Define ADC_CLOCK 3            
    Define ADC_SAMPLEUS 50 
    ADCON0.7 = 1                     ' Right justify result
    
    ANSEL  = %00000001               ' Set pin AN0 to AN7 (AN0) to analog input, the rest to digital (for future use)
    ANSELH = %0000                   ' Set pins AN8 to AN11
    
    TrisA = 001111            
    TrisB = %00000000
    TrisC = %11111111
    
    Clear                       
    
    LOW TRISA                             
    LOW TRISB
    LOW TRISC
    
    Define LCD_COMMANDUS 2000
    Define LCD_DATAUS 50
    
    DEFINE LCD_DREG PORTB               ' Set LCD Data on PORTB
    DEFINE LCD_DBIT 4                   ' Set starting Data bit on PORTB.4 (0 or 4) if 4-bit bus i.e, PortB.4-PORTB.7
    DEFINE LCD_RSREG PORTA              ' Set LCD Register Select on PORTA
    DEFINE LCD_RSBIT 4                  ' Set LCD Register Select bit on PORTA.4 (PORTA.3 is only in input mode)
    DEFINE LCD_EREG PORTC               ' Set LCD Enable on PORTC
    DEFINE LCD_EBIT 7                   ' Set LCD Enable bit on PORTC.7
    DEFINE LCD_BITS 4                   ' LCD in 4 bit mode
    DEFINE LCD_LINES 4                  ' 4 lines LCD display
       
    Pause 500
    
    AFF:
             
    LCDOut $FE, 1                                      ' Clear the display
    PAUSE 500
    '----------LINE 1
    LCDOut $FE, $80, "Line 1 for test"
    PAUSE 1000
    GOTO AFF
    
    END
    Now if I change
    Code:
    DEFINE LCD_RSREG PORTA
    DEFINE LCD_RSBIT 4
    to:
    Code:
    DEFINE LCD_RSREG PORTC
    DEFINE LCD_RSBIT 6
    and rewiring the RS pin to PORTC6 (Pin #8), it doesn't work.
    I'm sure it's for a very simple reason but I don't find which one.

    Thanx a lot for any help.

  2. #2
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: LCD RS bit wiring with 16F685

    You have set

    TrisC = %11111111

    which makes PORTC6 an input. I would have thought it needs to be output for a LCD?

  3. #3
    Join Date
    Jan 2006
    Location
    North of France
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: LCD RS bit wiring with 16F685

    Quote Originally Posted by EarlyBird2 View Post
    You have set

    TrisC = %11111111

    which makes PORTC6 an input. I would have thought it needs to be output for a LCD?
    Arrrg ! The only thing and the most simple I didn't checked !!
    Sometimes, we are looking for things so far and what we want is just font of our eyes...
    You're right, it was mistake. Now, everything is okay.

    Thanx a lot EarlyBird2

  4. #4
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: LCD RS bit wiring with 16F685

    Pleased I helped.

Similar Threads

  1. Replies: 1
    Last Post: - 12th March 2012, 23:34
  2. LCD Troubles on 16F685
    By SOTASOTA in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 20th November 2011, 16:53
  3. LCD Backlight Proper Wiring
    By DavyJones in forum General
    Replies: 11
    Last Post: - 26th July 2009, 23:01
  4. A2D on PIC 16F685
    By Forkosh in forum General
    Replies: 7
    Last Post: - 16th October 2007, 15:33
  5. 16f685 Reset
    By Ruben Pena in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th August 2007, 19:06

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts