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:
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)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
Please x'cuse me while I go pull what's left of my hair out....



Reply With Quote

Bookmarks