Faulty AX133 serial display?

fastgrandad

New Member
I have an AX133 16 x 2 OLED display that has gone faulty and wondered if there is a way of resetting it. As far as I know I haven't 'done' anything to it to cause the problem and it had been working fine for several months before this happened.

At switch on, for a very brief instant the top row of the display flashes up "Serial OLED" as per the 18M2 program. There may be something on the bottom row but it's too brief to read.

The display then shows continuously the characters in the picture at full brilliance and ignores any data inputs.

25309

To investigate I have reprogrammed the 18M2 with the standard supplied 18M2 OLED code. No data inputs are connected, either to the data input pin on the driver board or to the serial I/O pins of the 18M2. A 5 volt supply is connected.

Any ideas as to why this might be and, perhaps more helpfully, whether there is a possible fix, or is it for the bin?

Thanks

Paul
 

inglewoodpete

Senior Member
The fact that you are getting intelligable text on the screen, even though it is very brief, suggests that the hardware is performing as expected.

My guess is that the fault will probably be found in the code being loaded. I presume you have downloaded the code found at this link and not made any changes to it. Regardless of anything you have done previously, download a fresh copy from here, load it into your PICAXE 18M2 backpack and see if that fixes the problem.

Please let us know how this goes.
 

Flenser

Senior Member
The fact that you can see the "Serial OLED" message on the first line indicates that the AXE133 initialization of the OLED display is successful but I can't guess why you now get that odd final display.

When you load a fresh copy of the AXE133 code from inglewoodpete's link don't forget to edit it to specify use_OLED
Code:
; ********************************************
; Note you must uncomment just one of these two options
; depending on whether you have an LCD or OLED module
;#define use_OLED
#define use_LCD
; ********************************************
to this
Code:
; ********************************************
; Note you must uncomment just one of these two options
; depending on whether you have an LCD or OLED module
#define use_OLED
;#define use_LCD
; ********************************************
and then my suggestion for doing some more investigation is to change this:
Code:
; display welcome message if desired
#ifdef use_welcome   
    let b1 = 0            ; message 0 on top line
    gosub msg            ; do it

    low rs            ; command mode
    let pinsB = 192        ; move to line 2, instruction 192
    pulsout enable,1      ; pulse the enable pin to send data.
    high rs            ; character mode again
    
    let b1 = 1            ; message 1 on bottom line
    gosub msg            ; do it
#endif
to this with an extra delay after each line is displayed to check of the standard welcome messages are being displayed normally before changing to that odd final display:
Code:
; display welcome message if desired
#ifdef use_welcome   
    let b1 = 0            ; message 0 on top line
    gosub msg            ; do it

pause 8000

    low rs            ; command mode
    let pinsB = 192        ; move to line 2, instruction 192
    pulsout enable,1      ; pulse the enable pin to send data.
    high rs            ; character mode again
    
    let b1 = 1            ; message 1 on bottom line
    gosub msg            ; do it

pause 8000
#endif
 

hippy

Technical Support
Staff member
To investigate I have reprogrammed the 18M2 with the standard supplied 18M2 OLED code.
It does seem odd that it's working to the extent it initialises the display, puts text up and only then fails.

I believe the welcome display should remain until the first serial character is received so it would seem it thinks it has received something.

Adding the pauses as suggested by Flenser makes sense, should hold off on the failure. The next would be to add code to see if something is being received, and maybe what. I'll look into what that would be.
 

Flenser

Senior Member
Hippy,

The other things I noticed that may, or may not, be relevant are:
- The "bar X" character displayed in post #1 is only available in the english_japanese font table nbr 00
- This Winstar OLED display does a default initiatialization when it powers on that does set the font table to nbr 00 after which the AXE133 initialization routine sets to font table to the Western European table nbr 01.

So if there was a power reset after the message line 2 was displayed then .....

On the other hand this display was working without any issues and then started misbehaving so the above does not explain:
1) how some hypothetical power reset started happening
2) why it now happens consistently after the message line 2 is displayed
3) why the text that is displayed on the final screen is consistently the same two characters
 

hippy

Technical Support
Staff member
3) why the text that is displayed on the final screen is consistently the same two characters
When I was trying to see if there were undocumented commands I managed to provoke similar, perhaps exact, same display, when brute force cycling through command values.

It seemed to me that sending $00 or $03 commands had some kind of adverse affect and they are the only command value not used by the OLED itself - And now a belated D'Oh! given $3 is the reset / initialisation command - I'd forgotten that as it's not in the list of commands.

So I would guess it might well be some kind of reset issue.

That the display repeats in both halves suggested to me it might have gone into some kind of 8 character per line mode.

That the x-bar is only in the Japanese font is a brilliant observation and gives credence to a reset issue. Their binary values might also be significant - %11100000 and %11111000 - Some kind of square wave pick-up on the inputs ? Doesn't explain the leading spaces though - The extra blank character %11110001 could. Perhaps it's some kind of test mode ?
 
Last edited:

hippy

Technical Support
Staff member
2) why it now happens consistently after the message line 2 is displayed
It could be that it's resetting on some kind of over-current draw and writing the second line sets enough pixels to provoke that.

Having a pause after the line is set should help clarify if any reset is happening before that line is complete or after.
 

fastgrandad

New Member
Thanks for all the replies.

I had already done as Inglewoodpete suggested, several times in fact, but as recommended I did it again using a new download of the 18M2 code. I didn't mention that I previously replaced the 18M2, just in case.

I can't see why there should be a difference but the display now shows just the top line as it should, photo below, but no second row which is blank. Apart from ensuring the #ifdef use_OLED line is un-commented and adding the two pause 8000 lines (removing them doesn't make any difference), I have not made any changes to the code. So why no second row? I have checked/retouched all the multi pin soldered joints so I'm reasonably confident it's not a dry joint.

So re programming the 18M2 again seems to have cleared the spurious character issue and I'm left with the lack of a second row on the display.

25318

I've tried sending data to the display data input pin using the Picaxe 'terminal' set to 2400 N 8 1. Nothing shows on the display other than a brief blink, and the 'Serial OLED' text remains on the screen top row. Any reason why this shouldn't work?

I do have an oscilloscope so can look at the display command lines etc.

Thanks again for the inputs.

Paul
 

marks

Senior Member
Hi fastgrandad,
power and initialization problems can sometimes stop one of the controllers
or corrupt it (so hopefully not a faulty controller)
from working and only switching off power will allow you to recover from this and try again.
perhaps try a DC source.
on my axe132 board i usually fit a 47uf where the pot is usually fitted

as i happen too be looking at some 4bitcode.
I dug out and 4line oled one that has a faulty line in to do some testing as this uses more power.


i thought i'd try the firmware the oled firmware worked oright
but switching to lcd seem to corrupt the display
switching back to the oled firmware still had problems
but maybe apower cycle may of cured ths?

I altered their's slightly so you can now change between the two.

try leaving this set to lcd first.

Rich (BB code):
; AXE133 Serial LCD/OLED using PICAXE-18M2
; Emulates basic serial operation of the popular AXE033 module
; CPS, May 2011
; v2 18/01/2012

#picaxe 18M2

; ********************************************
; Note you must uncomment just one of these two options
; depending on whether you have an LCD or OLED module
     '#define use_OLED
     #define use_LCD
; ********************************************


; Supported Commands
; 0-7, 8-15    CGRAM characters
; 16-252    normal ASCII characters, according to selected character map table
; 253, X    display 16 character pre-saved message from EEPROM memory, X can be 0-15
; 254, X    LCD command, X can be 0 to 255 
; 255, X    control outputs C.2, C.1, C.0 (via lower 3 bits of X)
;        So, if using a backlit LCD with the active low transistor driver
;        on output C.2, then 255,%000 switches backlight on and 255,%100 switches off


#define use_welcome    ; display the welcome message upon power up
symbol line_length = 16    ; change to 20 for displays with 20 character lines

symbol baud = N2400_16    ; Serial baud rate 2400,N,8,1. Note main program runs at 16MHz

symbol spare0     = C.0 ; spare output 0
symbol spare1     = C.1 ; spare output 1
symbol spare2     = C.2 ; spare output 2 (or optional backlight)
symbol backlight     = C.2 ; optional backlight control for backlit LCDs, active low
symbol RX        = C.5    ; serial receive pin
symbol enable     = C.6    ; LCD enable
symbol rs         = C.7    ; LCD RS 


; LCD data pins are on B.0 to B.7

; Store the 16 character user defined messages in EEPROM data memory
; First two messages are optionally used as welcome message

; If using a display with 20 characters you will need to edit 
; the start addresses to be multiples of 20 (currently at 16) 
; and add 4 characters to each message.
; Please remember 4 line displays always use the strange 1-3-2-4 layout.

#ifdef use_OLED        
EEPROM $00, ("  Serial OLED   ")     ; store msg in the EEPROM memory
#else
EEPROM $00, ("   Serial LCD   ")     ; store msg in the EEPROM memory
#endif


EEPROM $10, (" www.picaxe.com ")     ; store msg in the EEPROM memory

EEPROM $20, ("This is msg 2   ")     ; store msg in the EEPROM memory
EEPROM $30, ("This is msg 3   ")     ; store msg in the EEPROM memory
EEPROM $40, ("This is msg 4   ")     ; store msg in the EEPROM memory
EEPROM $50, ("This is msg 5   ")     ; store msg in the EEPROM memory
EEPROM $60, ("This is msg 6   ")     ; store msg in the EEPROM memory
EEPROM $70, ("This is msg 7   ")     ; store msg in the EEPROM memory
EEPROM $80, ("This is msg 8   ")     ; store msg in the EEPROM memory
EEPROM $90, ("This is msg 9   ")     ; store msg in the EEPROM memory
EEPROM $A0, ("This is msg 10  ")     ; store msg in the EEPROM memory
EEPROM $B0, ("This is msg 11  ")     ; store msg in the EEPROM memory
EEPROM $C0, ("This is msg 12  ")     ; store msg in the EEPROM memory
EEPROM $D0, ("This is msg 13  ")     ; store msg in the EEPROM memory
EEPROM $E0, ("This is msg 14  ")     ; store msg in the EEPROM memory
EEPROM $F0, ("This is msg 15  ")     ; store msg in the EEPROM memory

;initialise LCD
init:
    gosub LCD_init         ; initialise LCD

; display welcome message if desired
#ifdef use_welcome    
    let b1 = 0            ; message 0 on top line
    gosub msg            ; do it

    low rs            ; command mode
    let pinsB = 192        ; move to line 2, instruction 192
    pulsout enable,1      ; pulse the enable pin to send data.
    high rs            ; character mode again
    
    let b1 = 1            ; message 1 on bottom line
    gosub msg            ; do it
#endif        
        
; main program loop, runs at 16MHz

main:

    serin RX,baud,b1            ; wait for the next byte

    ; NB keep character mode test as first item in this list to optimise speed
    if b1 < 253 then
        let pinsB = b1         ; output the data
        pulsout enable,1      ; pulse the enable pin to send data.
        goto main            ; quickly loop back to top
    else if b1 = 254 then
        low rs                  ; change to command mode for next character
        serin RX,baud,b1        ; wait for the command byte
        let pinsB = b1         ; output the data
        pulsout enable,1      ; pulse the enable pin to send data.
        high rs            ; back to character mode
        goto main            ; quickly loop back to top
    else if b1 = 253 then
        serin RX,baud,b1        ; wait for the next byte
        gosub msg            ; do the 16 character message
        goto main            ; back to top
    else ; must be 255
        serin RX,baud,b1        ; wait for the next byte
        let pinsC = b1 & %00000111 | %10000000
                        ; output the data on C.0 to C.1, keep RS high
        goto main            ; back to top
    end if


; power on LCD initialisation sub routine
LCD_init:
    let dirsC = %11000111    ; PortC 0,1,2,6,7 all outputs
    let dirsB = %11111111    ; PortB all outputs
    

    
#ifdef use_OLED
    ; Winstar OLED Module Initialisation
    ; according to WS0010 datasheet (8 bit mode)

    pause 500             ; Power stabilistation = 500ms

    ; Function set - select only one of these 4 character table modes
    ;let pinsB = %00111000     ; 8 bit, 2 line, 5x8 , English_Japanese table
    'let pinsB = %00111001     ; 8 bit, 2 line, 5x8 , Western_European table1
     'let pinsB = %00111010     ; 8 bit, 2 line, 5x8 , English_Russian  table
     let pinsB = %00111011     ; 8 bit, 2 line, 5x8 , Western_European table2
    
    pulsout enable,1      ; 
        
    let pinsB = %00001100    ; Display on, no cursor, no blink
    pulsout enable,1     

    let pinsB = %00000001     ; Display Clear
    pulsout enable,1
    pause 7            ; Allow 6.2ms to clear display

    setfreq m16            ; now change to 16Mhz

    let pinsB = %00000010     ; Return Home
    pulsout enable,1

    let pinsB = %00000110     ; Entry Mode, ID=1, SH=0
    pulsout enable, 1


#else    
    ; Standard LCD Module Initialisation
    pause 15             ; Wait 15ms for LCD to reset.

    let pinsB = %00111000     ; 8 bit, 2 line
    pulsout enable,1      ; Send data by pulsing enable
    pause 5             ; Wait 5 ms
    pulsout enable,1          ; Send data 48 again
    pulsout enable,1      ; Send data 48 again
    
    setfreq m16            ; now change to 16Mhz

    'let pinsB = %00111000     ; LCD  - 8 bit, 2 line, 5x8  
    'pulsout enable,1
            
    let pinsB = %00000001    ; Clear Display
    pulsout enable,1     
    pause 8            ; 8 = 2ms at 16MHz
    
    let pinsB = %00000010     ; return home
    pulsout enable,1

    let pinsB = %00000110    ; Entry mode
    pulsout enable,1     
    pause 1            

    let pinsB = %00001100    ; Display on, no cursor, no blink
    pulsout enable,1     
#endif
    
    high rs            ; Leave in character mode
    return


; display message from EEPROM sub routine
; message number 0-15 must be in b1 when called
; uses (alters) b1, b2, b3, b4
msg:
    let b2 = b1 & %00001111 * line_length
                        ; EEPROM start address is 0 to 15 multiplied by 16
    let b3 = b2 + line_length - 1 ; end address is start address + (line_length - 1)
    for b4 = b2 to b3            ; for 16 times
        read b4,b1            ; read next character from EEPROM data memory into b1
        let pinsB = b1         ; output the data
        pulsout enable,1      ; pulse the enable pin to send data.
    next b4                ; next loop
    return
    
; Check end user has defined just one type of display
#ifndef use_OLED
#ifndef use_LCD
#error "Oops - no OLED / LCD type defined at top of program!"
#endif
#endif

#ifdef use_OLED
#ifdef use_LCD
#error "Oops - both OLED / LCD types defined at top of program!"
#endif
#endif
 

inglewoodpete

Senior Member
power and initialization problems can sometimes stop one of the controllers
or corrupt it (so hopefully not a faulty controller)
from working and only switching off power will allow you to recover from this and try again.
perhaps try a DC source.
on my axe132 board i usually fit a 47uf where the pot is usually fitted as i happen too be looking at some 4bitcode.
@marks your post jogged an obscure brain-cell with a similar memory dating back to around 2012. I, too was developing code (on a 20X2) for a 2-row OLED.

To confirm, I found that the OLED could lock up, particularly in 4-bit mode, and the OLED needed power cycling to get it working correctly. Power-cycling or just rebooting the PICAXE was not enough.
 

Flenser

Senior Member
fastgrandad,

Congratulations on solving the first problem with that odd display in your post #1.

You can forget about the two pause 8000 lines now. I only suggested adding them as a part of investigating that odd display and now that you have solved that problem these are of no use.

We can see in the section of the AXE133 code below that the msg subroutine being called to display message nbr 0 on the first line is working correctly but that message nbr 1 is not being displayed on the second line. So we're pretty confident that the msg subroutine is probably also working for message nbr 1 and this indicates that it is moving the LCD cursor position to line 2 that is not working somewhere.

Code:
; display welcome message if desired
#ifdef use_welcome  
    let b1 = 0            ; message 0 on top line
    gosub msg            ; do it

    low rs            ; command mode
    let pinsB = 192        ; move to line 2, instruction 192
    pulsout enable,1      ; pulse the enable pin to send data.
    high rs            ; character mode again
   
    let b1 = 1            ; message 1 on bottom line
    gosub msg            ; do it
#endif
To test this if this is the case try changing the section of code above to this below to write message nbr 1 to the LCD twice in a row.

Code:
; display welcome message if desired
#ifdef use_welcome  
    let b1 = 0            ; message 0 on top line
    gosub msg            ; do it

    low rs            ; command mode
    let pinsB = 192        ; move to line 2, instruction 192
    pulsout enable,1      ; pulse the enable pin to send data.
    high rs            ; character mode again
   
    let b1 = 1            ; message 1 on bottom line
    gosub msg            ; do it
   
    let b1 = 1            ; message 1 on bottom line
    gosub msg            ; do it
#endif
If is moving the LCD cursor to line 2 that is not working then you should get the text "axe.com" displayed in positions 1-7 on line 2.
 

fastgrandad

New Member
Thanks for the suggestions. As it was raining the other day I decided to waste some time trying to get to the bottom of what's going in with the display.

Reloading and power cycling the display seems to have got rid of the odd characters in start up, so we can forget that issue. However things got more interesting when looking at the lack of a second row display.

Test 1.
Sending a single text stream of a few characters to the display from a separate Picaxe, preceded either by a clear screen command (254,1) or a return to normal command (254,2), correctly displays at the start of the top row. Adding a goto row 2 position 1 (254,192) gave a totally blank display.

Test 2.
Sending a repeated steam of characters, without a repeated clear screen or return to normal command, started displaying at the start of row1 and then eventually appeared on row 2, presumably as the registers progressively filled up. Very interesting as it demonstrated that the second row of the OLED display itself is working.

Test 3.
Sending a single long string of non repeating characters.

Code:
Main:
Serout C.0, N2400,(254,1)         ; Clear display
Pause 30
Serout C.0, N2400,(254,2)         ; return to normal/start of row 1
Pause 30
Serout C.0, N2400,("0 1 2 3 4 5 6 78 9 A B C D E F G H I J K ! £ $ % ^ & * ( )_ - + = ? : @ ~ # / *-+ ")
end
The first 16 characters displayed on row 1 as expected, and then character 65 and following characters appeared on row 2. This suggests to me that the display registers are set up for 16 x 4 rows of characters and, when the end is reached, it rolls over and starts again.

25333

Commands in the low digits, e.g. (254,2) and clear screen (254,1) are being correctly interpreted by the display, but higher number commands, e.g. goto row 1 pos 1 (128) and row 2 pos 1 (192) appear to be ignored for some reason.

I've spent far too much time on this and really should just bin the display, but I am extremely curious as to why this is happening and would be delighted if it could be reset in some way to full functionality again.

Any ideas for further investigation and testing gratefully received.

Thanks for the interest

Paul
 

neiltechspec

Senior Member
You aren't telling the cursor to move to line 2, or even telling it to start on line 1 either.
(254,128,"line 1 text")
(254,192,"line 2 text")

You don't need 254,2.
 

fastgrandad

New Member
The problem with this faulty display is that it doesn't respond normally to either 254, 128 or 254,192, in either case short text strings don't appear in the display area. Adding 254,2 to the start of the code forces the display to start at row 1 position 1 each time it runs, without having to power off and on. Otherwise I would agree.
The test strings are to see where the display is placing the characters, in an attempt to find out why it isn't working correctly and, perhaps, coming up with a fix, other than the bin!
Thanks
Paul
 

AllyCat

Senior Member
Hi,
The first 16 characters displayed on row 1 as expected,
IMHO the characters are not (exactly) "as expected". Your text string contains only one "0", but two are displayed, the 16th character (8) is not shown and the / * are shown adjacent to each other, but your string appears to include a space between them. Otherwise, most of your reported issues might be caused by one (or more) of the bits in the "command" (254 , N) codes, being "lost" or corrupted in some way.

Firstly, the "254 , 2" shouldn't be necessary because it does much the same as "254 , 1" unless a command in the range "254 , N" where N = 5 to 15 has been executed (either intentionally or accidentally/erroneously). Could it be responsible for displaying that first "0" on the screen? Also, "254 , 3" should do exactly the same as "254 , 2" (because there is a "don't care" bit), which might give another clue.

AFAIK, ALL display controllers of that type have a similar display structure, arranged as a circular buffer with at least 64 bytes. After the first 16 bytes, there are at least another 16 which are either not displayed, or as "Row3" if the display has such a row. Similarly, there are additional bytes after the second row, which are displayed as Row 4 if it exists. These additional characters/rows may be viewed by side-scrolling the display, if desired (that's where those commands in the range N = 5 to 15 come in).

In practice, most of the display controllers support rows of (at least) 20 characters long (for 20 x 4 displays) so there are at least 80 bytes in the "Display RAM" and there might be 128 bytes. Sometimes the address of the first character in Row 1 is numbered 0 and sometimes 128 (or $80 in hex) and then the start of the second row is either 64 ($40) or 64 + 128 = 192 ($C0). However, it appears that the start of the third row might be either 20 ($14) or 32 ($20) and the fourth row at 64 + 20 = 84 ($54) , or 64 + 32 = 96 ($60) or with 128 added to those values (to $D4 or $E0). But if less than 128 bytes of RAM are implemented, then the "auto-incrementing" of the RAM pointer (when sending strings of characters) will [EDIT] might just skip over the "missing" bytes, or perhaps duplicate one or more characters from elsewhere in the RAM buffer, for each "missing" address byte.

Personally for testing, I would use a loop of the form: FOR char = 40 TO 120 : SEROUT ... (char) : NEXT and check the printed characters against the ASCII character table, but it appears from your listing that there are (about) 48 characters "hidden" between the "7" and the "+", which suggests that the controller has a full 128 byte buffer. Therefore in principle, you should be able to move to Row 2 by sending 48 "dummy" characters from the last character of Row1 (or 64 bytes from the start), perhaps rather "slow" but better than binning the display? Then it might be worth experimenting with some of the 254 , N commands in the range N = 5 to 15 (in association with a typical data sheet such as HD44780) to see if there are other ways to move (or move through) the stored characters that are actually displayed on the OLED.

Cheers, Alan.
 
Last edited:

hippy

Technical Support
Staff member
It does all seem a bit odd that's it's not accepting 254,$80 or 254,$C0 positioning. It might be worth trying the code here to see what results you get -


The only thing I can think is that the D7 line to the LCD isn't reliable, isn't passing the msb through. Broken track, dodgy board connection, the PICAXE not making good contact in its socket, socket contact or leg bent perhaps.
 

Flenser

Senior Member
The only thing I can think is that the D7 line to the LCD isn't reliable,
Hippy, from the description of the behaviour in post #12 that's what the problem looks like to me too, and it's easy enough to test.
- Send the character 0xBD (decimal 189) . If the connection to D7 is OK then you'll get the "1/2" character and if D7 is not OK you'll get the "=" character (0x3D).

I just tested this and it turns out that the 2x16 LCD I bought on ebay actually has the Japanese font ROM, not the European font ROM, and sending the character 0xBD displays a Japanese character o_O.
My test is on an LCD, not an OLED, but the issue of what gets displayed for the character 0xBD when the D7 connection is not working is the same.
 
Last edited:

fastgrandad

New Member
Alan

thanks for that explanation of the architecture, it's a lot clearer than my experimentally derived picture!

With apologies, the difference between the programmed and displayed string is a red herring. I wrote the post over a couple of days ago and played with the code in the meantime. The code line should have read

Code:
Serout C.0, N2400,("00 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K ! £ $ % ^ & * ( )_ - + = ? : @ ~ # /*")
which is the same as the display in the photo.

Hippy and Flenser, the 18M2 is correctly inserted - no bent pins - and I have checked the D7 continuity from the PIC pin 12 to pin 14 on the OLED board and it's fine. I have even made sure the pin is soldered both sides of the board in case there's a crack in the through-hole plating, although if it's multi layer this may not help with intermediate layers. I changed the 18M2 again to rule it out too.

Flenser's test confirms the suspicion that this is where the fault lies as it does exactly what was expected, i.e. it prints '=' not the 1/2 symbol.

So I guess it's toast, but an interesting and educational process, which is the point isn't it?

Many thanks for all the interest.

Paul
 

Technical

Technical Support
Staff member
If it is just d7 then doesn't work you could possibly initialise the screen in 4 bit mode instead of 8 bit and just use the lower 4 connections!
 

AllyCat

Senior Member
Hi,

Unfortunately, I believe that 4-bit mode uses DB7-4 (with two write cycles) so that might be totally unusable. It really depends where the data bus is "broken", but it might be inside the Display Controller itself, so can't be "repaired".

However, the display still seems able to display ALL the ASCII characters (including the User-Defined Characters function) and very nearly all the display commands, so I wouldn't consider it "toast" (i.e. totally unusable). Of course it can't be used exactly as a "normal" display, but it might well be "adequate" by avoiding the "Select Display Address" commands, which move the cursor directly to another position on the screen. Also the "Busy" flag may be unavailable, but this is rarely used in PICaxe programs (because the few internal operations that are actually slower than a PICaxe instruction generally use a PAUSE anyway).

Furthermore, it might be possible to modify the AXE133 program itself to execute the "254 , N" commands in a different way. Basically, it's possible to move from the end of Row 1 to the Start of Row 2 by sending 48 (arbitrary) characters: That might take rather a long time to send as serial bytes at 2400 baud, but the 18M2 in the AXE133 needs only to toggle the EN pin 48 times , which could be executed in less than 50 ms with PULSOUTs in a loop, and possibly much faster using a "trick" such as (untested): SEROUT EN , N19200_16 , ("UUUUUUUUUP") , since ASCII "U" gives a start pulse (1) plus %01010101 plus a stop pulse (0) .

Moving the cursor "randomly" around the screen would be a little more difficult, but the ("254 , N") commands with N in the range 16 to 60 have the function of: "Moves cursor and {/or} shifts display without changing DDRAM contents" so an extra subroutine or two could be sufficient. ;)

Cheers, Alan.
 

Flenser

Senior Member
Paul,

Alan is correct, driving the LCD & OLED modules in 4-bit mode uses pins D4-D7, so that is not an option.

Alan has also pointed out everything that is needed to code a workaround for your OLED without using D7.

Replace this code in the AXE133 program:
Code:
    low rs            ; command mode
    let pinsB = 192        ; move to line 2, instruction 192
    pulsout enable,1      ; pulse the enable pin to send data.
    high rs            ; character mode again
With this and you should get the normal welcome message displayed on line 2:
Code:
    low rs            ; command mode
    let pinsB = %00010100    ; Cursor or Display shift, Move Cursor, Move Right
    SEROUT enable , N19200_16 , ("UUUUT")
    high rs            ; character mode again
We can also replace this code for case 245 that deals with commands in the main loop:
Code:
    else if b1 = 254 then
        low rs                  ; change to command mode for next character
        serin RX,baud,b1        ; wait for the command byte
        let pinsB = b1         ; output the data
        pulsout enable,1      ; pulse the enable pin to send data.
        high rs            ; back to character mode
        goto main            ; quickly loop back to top
with this code that adds a speical case to issues the "Cursor or display shift" command multiple times to position the cursor instead of using the "Set CGRAM address" command that uses D7:
Code:
    else if b1 = 254 then
        low rs                  ; change to command mode for next character
        serin RX,baud,b1        ; wait for the command byte
       
        if b1 < 128 then        ; This is not the "Set CGRAM address" command
            let pinsB = b1         ; output the command
            pulsout enable,1      ; pulse the enable pin to send the command.
        else                ; This is the "Set CGRAM address" command
            let pinsB = $02         ; Home the cursor command
            pulsout enable,1      ; Pulse the enable pin to send the command.

            let pinsB = %00010100    ; Cursor or Display shift command, Move Cursor, Move Right

            ; Calculate how many cursor shift operations need to be done
            b1 = b1 & $7F        ; Mask off the address bits      
            b2 = b1 // $40        ; Get the column posiion
            b2 = b1 / $40 * 40 + b2    ; Calculate the start of the row and add the column position
            b3 = 0
            do while b3 < b2        ; Until we get to the calculated position
                pulsout enable,1  ; Pulse the enable pin to move the cursor.
                inc b3
            loop
        end if
        high rs            ; back to character mode
        goto main            ; quickly loop back to top
I've struck a problem with my USB-to-Serial converter that means I wasn't able to test this last code in a copy of AXE133 but I have tested the "b1 > 127" code using a different program and it moved the cursor to where it was supposed to.. Try it out this AXE133 version and see how you go.

You will still not be able to display characters above 127 on this OLED. If you would like to use any of those characters then you will need to define them as on of the CGRAM characters 0-7.
 
Last edited:

hippy

Technical Support
Staff member
I just tested this and it turns out that the 2x16 LCD I bought on ebay actually has the Japanese font ROM
Original HD44780 LCD controllers only had one font which was usually Japanese plus a few Latin maths symbols. Multiple fonts are a result of using unused bits in the original command set, same too for the graphic display mode and power control.
 

Flenser

Senior Member
Hippy,

Thanks for the info. I don't use the LCD a lot and I've probably never needed to display a character above 0x7F before.
 
Last edited:
Top