Remove the jumper "L_CS_H" that bridges the "L_CS" connection
Remove the jumper "J68_J80"
Move the jumper "H_PS_L" to the "PS_L" position from its existing "H_PS" position.
Changing these jumper options requires a bit of soldering skill. The PCB is fragile and it's very easy to damage the copper pads and render the display inoperative.
'**************************************************************** '* Name : 2x8_OLED_SPI_Display_Demo * '* Author : Roberts * '* Notice : Copyright (c) 2019 * '* : All Rights Abandoned * '* Date : 11/24/2019 * '* Version : 1.0 * '* Notes : Demo code that writes to Vishay OLED-008N002A * '* : 2x8 character display via SPI interface * '**************************************************************** ' ' THIS OLED DEMO PROGRAM USES A PIC16F1619 MICROCONTROLLER IN THE MICROCHIP CURIOSITY BOARD ' ' Vishay (and several other) OLED character OLED displays are based on the Winstar WS0010 Controller ' whose command language closely emulates Hitachi's HD44780. The WS0010 also accommodates ' an SPI-like 4-wire interface (CS, MOSI, MISO, CLK), that can be efficiently interfaced to small ' pin-count PIC uCs. In most applications, only a 3-wire chip-select/data/clock interface is needed. ' However, the WS0010 controller requires a 10-bit clock/data sequence rather than the SPI standard 8-bit ' sequence in order to include the display's "RS" and "R/W" command bits. ' This demo code uses PCP's SHIFTOUT command with 16-bit variables truncated to 10-bits to conform with ' the display's interface requirements. ' ' While PBP's LCDOUT command uses $FE to designate a display command input in 4-bit and 8-bit parallel wired ' modes, this code directly sets the RS=0 to write to the command memory and RS=1 to write to the character memory. ' ' The following demo features these program segments: ' Microcontroller configuration ' Initialization and Variable Declarations ' OLED Initialization ' Looping Display of Demo Program Name ("2x8 OLED SPI TEST") ' ' The PIC16F1619 and other EMR core PICs have the LATx.x pin write function that overcomes read/modify/write ' conflicts that can occur with PORTx.x pin writes. If this demo code is run on BL or MR core PICs, ' assigning the CS pin function to a different port is necessary, and relocating the Function Set command to ' the end of the OLED initialization sequence might be required to ensure the OLED adopts 2-line mode. '************************************************************************************************************ '************************** Microcontroller Configuration PIC16F1619 **************************************** DISABLE DEBUG ' Disable ICD code for this section ' Microcontroller Configuration from PBP's "PIC***.info" files (see Ref Manual Pg. 100) ' The following configuration is for a PIC16F1619 #CONFIG __config _CONFIG1, _FOSC_INTOSC & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BOREN_ON & _CLKOUTEN_OFF __config _CONFIG2, _WRT_OFF & _PPS1WAY_OFF & _ZCD_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_OFF __config _CONFIG3, _WDTCPS_WDTCPS4 & _WDTE_ON & _WDTCWS_WDTCWS100 & _WDTCCS_LFINTOSC #ENDCONFIG OSCCON = %01110000 ' Set internal osc to 8MHz (IRCF<3:0> = %1101=4 MHz, %1110=8 MHz, %1111=16 MHz) DEFINE OSC 8 ' Tell PBP that the device will clock at 16MHz ENABLE DEBUG ' Enable ICD for code that follows '************************** Initialization and Variable Declarations ***************************************** TRISB.4 = 0 ' Set CS to output TRISB.5 = 0 ' Set uC SCK pin to output TRISB.6 = 0 ' Set uC SI pin to output ' SPI signals use LATx.x assignments to prevent read/modify/write conflicts on a single I/O port CS Var LATB.4 ' uC chip select output pin SCK Var LATB.5 ' uC clock out pin SI Var LATB.6 ' uC data out / LCD Data in pin CHR_x VAR WORD ' variable name of characters sent to display i VAR BYTE ' loop counter variable CS = 1 ' Disable SPI device select CS for OLED '************************** SPI OLED Initialization Sequence ************************************************* 'Each command is 10 bits with "00" RS & RW prefix (RS=0,RW=0) 'Example: $0028 = %0000 0000 0010 1000 -> 10-bit truncated = %0000101000 CS = 0 'Enable LCD on SPI bus SHIFTOUT SI, SCK, 5, [$0028\10] 'Function Set - D/L=0, N=2, Default Font CS = 1 : PAUSE 1 : CS = 0 'Disable CS / Pause / Enable CS SHIFTOUT SI, SCK, 5, [$0008\10] 'Display OFF CS = 1 : PAUSE 1 : CS = 0 'Disable CS / Pause / Enable CS SHIFTOUT SI, SCK, 5, [$0006\10] 'Entry Mode - Cursor moves right CS = 1 : PAUSE 1 : CS = 0 'Disable CS / Pause / Enable CS SHIFTOUT SI, SCK, 5, [$0001\10] 'Clear Display CS = 1 : PAUSE 30 : CS = 0 'Disable CS / Pause / Enable CS SHIFTOUT SI, SCK, 5, [$0002\10] 'Return Home (line 1 / position 1) CS = 1 : PAUSE 30 : CS = 0 'Disable CS / Pause / Enable CS SHIFTOUT SI, SCK, 5, [$000C\10] 'Display ON CS = 1 'Disable CS '************************** Demo Program Name Display ******************************************************** 'This sequence demonstates sending a character string to the OLED display 'Each display character is 10 bits with "10" RS & RW prefix (RS=1,RW=0) 'Example: $0200 = %0000 0010 0000 0000 ' CHR_x = % 0100 0100 (the letter "D") 'Bitwise OR'd and 10-bit truncated = %1001000100 main: CS = 0 SHIFTOUT SI, SCK, 5, [$0080\10] 'Start at Line 1 / Position 1 CS = 1 For i = 0 to 7 LOOKUP i, ["2x8 OLED"],CHR_x 'Get 1 character at a time from the string CS = 0 SHIFTOUT SI, SCK, 5, [($0200 | CHR_x)\10] 'Bitwise OR to create 10-bit data sequence with RS=1 CS = 1 Pause 100 'Output the characters at 1/10 second intervals Next i 'Output all 8 characters on line 1 Pause 500 'Pause 1/2 second CS = 0 SHIFTOUT SI, SCK, 5, [$00C0\10] 'Start at Line 2 / Position 1 CS = 1 For i = 0 to 7 LOOKUP i, ["SPI TEST"],CHR_x 'Get 1 character at a time from the string CS = 0 SHIFTOUT SI, SCK, 5, [($0200 | CHR_x)\10] 'Bitwise OR to create 10-bit data sequence with RS=1 CS = 1 Pause 100 'Output the characters at 1/10 second intervals Next i 'Output all 8 characters on line 2 PAUSE 2000 'Pause 2 seconds after both lines are displayed CS = 0 'Enable CS SHIFTOUT SI, SCK, 5, [$0001\10] 'Clear Display CS = 1 : PAUSE 1000 'Disable CS / Pause 1 second with blank display Goto main 'Repeat forever
Re: SERIN2 Receiving Wrong Data
The sending device has the typical 18F4550 USB setup and it is set to "Define OSC 48". The receiving device is set to "DEFINE OSC 16".
rsocor01 Yesterday, 19:56