Newhaven Display Forum

Newhaven Products => Character LCDs => Topic started by: DocDi on April 04, 2016, 06:41:18 AM

Title: NHD-0420D3Z-NSW-BBW-V3 initialization
Post by: DocDi on April 04, 2016, 06:41:18 AM
Hi everybody,

I'm trying to connect the upper LCD to a raspberry pi. I now checked all data sheets and forums I found but there are still many questions open which are so basic that I'M not sure whether I understand anything ;-)

First is in the there seem to be registers accessed which belong to a PIC18* (ADCON1, ADCON2). With the help of the specs I tried to convert these to PIC16* registers. Is this correct?
Then I have a basic chicken/egg problem. The init sequence initializes I2C in the end. I2C is already hard coded by R1 on the PCB and I get ACK from the LCD at address 0x28 which is 0x50 shifted by one bit. I also do not get any write errors. Maybe I have the same 1.8k pullup issue others in this forum had with the raspberry but this is currently not my issue. Anyhow my question is more about fundamental coding:
If I have OSCCON |= 0x73 in the example, how do I transfer this? My assumption is I have to translate it to assembler code (bsf STATUS, RP0; movlw 0x73; iorwf OSCCON,1, bcf STATUS, RP0). From the PIC16 spec I get the binary instruction codes for MOVLW, etc and all register addresses. I think this is how it would work with a PIC programmer (translate this to HEX and burn it to the PIC). Do I have to transfer this command sequence via I2C to the PIC? If I2C is not initialized how should the PIC understand this? Do I have to write the binary instruction to a register (SSPBUF, PORTC) or is it simply start bit, 0x28, instruction byte, data byte(s)? The example code uses writing into SSPBUF after init with the send_package routines therefore I think the init must be sent differently. Sorry for these stupid questions but currently I'm totally confused and I do not want to give up... 
Title: Re: NHD-0420D3Z-NSW-BBW-V3 initialization
Post by: ceb4 on May 02, 2016, 09:34:55 AM
I am using a Raspberry Pi model 2 B with the NHD-0420D3Z-NSW-BBW-V3 on both I2C1 (3,5) and I2C0. I was getting high spikes on the SDA above the 3.3 levels the Pi wants to deal with. I put a P82B96 between the Pi and NHD and don't have a problem with levels (now at +5) or display operations. The NHD specifications call for 5 volt levels.