LCD_AnyPin.pbp


+ Reply to Thread
Results 1 to 40 of 113

Thread: LCD_AnyPin.pbp

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Still no traction

    I'm still not getting anywhere with this.

    At this point I've tried so many things I can't tell where I'm at anymore.

    I think the LCD_Anypin code is working, it compiles w/o error and when I probe the circuit (the 16F883 is in) with my oscilloscope while its supposed to be running, I am seeing the "E" pin going up and down, but not seeing anything on the data pins LCD_DB4 through LCD_DB7.

    I'm trying to get this LCD onto PortB. I understand the 16F883 has a comparator on pins 22-(aka; RB1) and pin 24-(aka; RB3) and that can be a problem so I've tried to use CM1CON0=%00000000 to disable them.

    I'm trying to get my LCD (H44780 type) to be hooked up to the 16F883 as follows:

    RB7->RS
    RB6->E
    RB5->D4
    RB4->D5
    RB3->D6
    RB2->D7

    so far no joy.

    In many threads here and elsewhere I see people saying I should have my own __CONFIG line instead of relying on the default PBP one, so I tried that. Also people say to disable the WDT so I tried that too.

    My PICKit2 programmer and software seem to working properly, it can run the tests fine and seems to read/write to the PIC.

    When I switch on my test circuit all I get on the 16x2 LCD is the first row of pixel-blocks and nothing else...ever.

    Any help would be very much ppreciated, I'm just starting out with PIC programming I'll appologise in advance if I'm doing something stupid in my code:


    Code:
    @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF & _HS_OSC
    
    CLEAR
    DEFINE OSC 4                 ; set oscillator speed
    
    ; Setup Ports and Pins
    PORTA  = %00000000
    TRISA  = %00000011           ; set AN0 and AN1 to inputs
    PORTB  = %00000000
    TRISB  = %00000000           ; set all PORTB pins to outputs
    IOCB   = %00000000           ; disable IOCB on PortB
    PORTC  = %00000000
    TRISC  = %00000000           ; set all PORTC pins to outputs
     
    ; Initialize I/O 
    ADCON0  = %00000111          ; enable and set up AN0 input as ADC
    ADCON1  = %10000000          ; right justify and use power rails as Vref
    ANSEL   = %00000001          ; A/D enabled for ANS0, disabled for ANS1->ANS7
    ANSELH  = %00000000          ; A/D disabled for ANS8->ANS13
    CM1CON0 = %00000000          ; Disable comparators
    CM2CON0 = %00000000          ; These default to disabled at POR, but just in case
    
    ; Initialize your Hardware first, set CONFIGs, OSC, Turn off A/D etc
    ;----[ Change these to match your LCD ]---------------------------------------
    LCD_DB4   VAR PORTB.5
    LCD_DB5   VAR PORTB.4
    LCD_DB6   VAR PORTB.3
    LCD_DB7   VAR PORTB.2
    LCD_RS    VAR PORTB.7
    LCD_E     VAR PORTB.6
    LCD_Lines     CON 2    ' # of Lines on LCD,  1 or 2 (Note: use 2 for 4 lines)
    LCD_DATAUS    CON 50   ' Data delay time in us 
    LCD_COMMANDUS CON 2000 ' Command delay time in us 
    
    INCLUDE "LCD_AnyPin.pbp"  ' *** Include MUST be AFTER LCD Pin assignments ****
     
    ;HIGH PORTB.6
    
    ;----[ Your Main program starts here ]----------------------------------------
    
    PAUSE 500
    LCDOUT $FE, 1
    PAUSE 250                            ; Initialize LCD (You may not need this,
                                         ;  but some displays are picky)
    Main:
        LCDOUT $FE, 1                    ; clear screen
        PAUSE 2000
        LCDOUT $FE, $87, "Hello,", $FE, $C8, "From DT!"  
        PAUSE 2000
    
    GOTO Main
    
    END
    I'd love to just hook up the LCD like PBP normally wants it, but I have no control over the PCB it's an existing design and I have to get it to work as-is (LCD on PortB:RB2-7)

    Please x'cuse me while I go pull what's left of my hair out....

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default

    Are you sure LCD is OK?

    Ioannis

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Is the RW pin on the LCD connected to the PIC, or is it grounded?
    <br>
    DT

  4. #4
    Join Date
    Nov 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    Are you sure LCD is OK?

    Ioannis
    Yes, when I plug it into another pic controlled unit I get both lines of verbiage expected.

    Quote Originally Posted by Darrel Taylor View Post
    Is the RW pin on the LCD connected to the PIC, or is it grounded?
    <br>
    The circuit board has the RW line hard-wired to ground.

    Would it be better to re-post this Q over in the regular part of the forum since it's doesn't seem related directly to the LCD_Anypin extension? my thinking is it might be something peculiar to the 16F883 that someone may see and chime-in about.

  5. #5
    Join Date
    Nov 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Schematic attached.
    (Note that in the code I'm not doing anythng with the sensor yet, and it's disconected from AN0 right now)
    Attached Images Attached Images  
    Last edited by PICn-It; - 19th November 2009 at 16:21.

  6. #6
    Join Date
    Nov 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    (sound of crickets chirping....)

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Just curious why you have LCD Data on RB2,3,4 & 5. If you simply moved them up two pins and moves E and RS down, you could use the standard PICBasic product with no modifications. I can understand if you have a PIC which doesn't have four consecutive pins available on a port, but why go to all the inconvenience when there is no need?

Members who have read this thread : 3

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