AXE131Y firmware

afb

Member
In the PICAXE Store the AXE131Y 8x2 OLED page resources link to AXE133Y which upon examination is set up for 16x2 with comments how to change for 20 character displays - can I assume it's safe to edit for 8 lines and reduce the stored message lengths accordingly? I'm just looking to change the power up welcome message.
 

inglewoodpete

Senior Member
Yes, the code can be changed. I transferred the code to a different model PICAXE so that I could send data to it via i2c.

The only problem with changing the code is that you will have to remove any bugs you may unintentionally add ;)! Save a separate copy of each version of the code that you develop and you can easily revert to your previous working version.
 

afb

Member
Thanks for the information - the issue is that I can't save the code that's already in there when it was bought, in order to get back to a working module if I 'brick' it by installing the (virgin) AXE133Y firmware - before I've edited it! So I was looking to know that it really is the AXE133Y firmware that's in there - which may or may not have been modified by PICAXE to suit 8x2 - probably has as the power up welcome message does not agree with the AXE133Y code. However, I also say 'may not' as the AXE133 library for the Arduino drives it just fine, just truncating print statements that exceed 8 characters. (I'm replacing the 16x2 OLED which I used for development as the final unit only needs 8x2 and is usefully smaller - but I want to change the power up welcome message).
 

afb

Member
Thank you Jim, but that link also refers to the AXE133 firmware in which it talks about 16char displays with info on converting to 20char - I'm using the 8char OLED display and want to know if it's safe to simply edit the AXE133 code appropriately for 8 char - I'm competent to do that but aware that some firmware upgrades have turned tablets etc into 'bricks'. I'm simply querying the information conflict that the PICAXE store page for the 8char OLED points you at firmware which in the code only talks about 16 and 20 char displays. Clearly PICAXE *have* modified the firmware for the 8char OLED as the power up welcome message doesn't agree with that in the AXE133 code.

And yes, I wouldn't be making PICAXE based products commercially were it possible to retrieve the source code from them!
 

inglewoodpete

Senior Member
While I can't provide a 100% watertight guarantee that you will not have any difficulty reprogramming your AXE133 chip, I can say you have 100% support here on the forum. The controller chip is just a PICAXE 18M2: something that practically all forum members are familiar with. You can even get help at 3:00am (from someone on the other side of the world) if you ask! And no-one has 'bricked' a PICAXE in the last ten years that I can recall. There are only 3 ways that I know of to kill a PICAXE: with a hammer, in an oven or with a power supply with its voltage set too high.
 

afb

Member
OK, thanks for your input Pete - 'bricked' was perhaps too strong a word to use because the 18M2 can always be re-programmed, but I wouldn't know what to re-program with until the PICAXE people sent me the appropriate file - but I was hoping to avoid the delay that might entail as I wish to demonstate my project tomorrow and its fully functional except the boot up screen needs altering - my editing of the file and uploading it has the risk that the display won't work at all after that so better I leave it as it is until I get a definitive answer from PICAXE - "hello Technical" !!!!
 

hippy

Technical Support
Staff member
Please accept our apologies for the confusion which has arisen. I thought we had produced specific AXE131Y 8x2 firmware but I may be mistaken.

All the OLED displays as far as I know use the same firmware so, as long as the '#define use_OLED' is included and '#define use_welcome' is commented out; the AXE133 firmware should work on all and behave exactly the same - accepting that start of line addressing code values differ depending on size of display.

The differences come when enabling the welcome screen. And I am afraid I cannot recall exactly what needs to be done to use the 8x2 display.

So late in the day, with it needing to be working tomorrow, I would suggest the safest path is to leave it as it is. Explaining the situation is better then not having it work at all.

Unfortunately the AXE131 has a surface mount 18M2 fitted so you don't have the option of replacing that with a different 18M2 and being able to keep the current firmware intact.

If willing to risk it, you can probably brute force edit EEPROM $00 to "ABCDEFGHIJKLMNOP", EEPROM $10 to "abcdefghijklmnop" and download to see what shows up. That should give an indication of what you need to alter to get what you want. Maybe also try with 'symbol line_length = 16' changed to 8.

Alternatively you could disable the welcome in the firmware and generate that yourself from your master PICAXE program.

If I can lay my hands on an 8x2 I can see what I can come up with.
 

hippy

Technical Support
Staff member
This is what I have come up with, works on my AXE131Y 8x2.

It is likely not exactly what is in the production line AXE131Y and I have not exhaustively tested the showing of pre-defined messages, have not tested serial input but haven't changed any of that. It's therefore at your own risk but should work as required.

Code:
; AXE131 Serial 8x2 OLED using PICAXE-18M2
; http://www.picaxeforum.co.uk/showthread.php?30788-AXE131Y-firmware
; Only works on AXE131Y 8x2
; Thrown together in a rush from -

; 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

; Supported Commands
; 0-7, 8-15	CGRAM characters
; 16-252	normal ASCII characters, according to selected character map table
; 253, X	display 8 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 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 8 character user defined messages in EEPROM data memory
; First two messages are optionally used as welcome message

;             12345678
EEPROM $00, ("Top Line") ; Msg 0
EEPROM $08, ("Bot Line") ; Msg 1

EEPROM $10, ("Msg 2   ")
EEPROM $18, ("Msg 3   ")
EEPROM $20, ("Msg 4   ")
EEPROM $28, ("Msg 5   ")
EEPROM $30, ("Msg 6   ")
EEPROM $38, ("Msg 7   ")
EEPROM $40, ("Msg 8   ")
EEPROM $48, ("Msg 9   ")
EEPROM $50, ("Msg 10  ")
EEPROM $58, ("Msg 11  ")
EEPROM $60, ("Msg 12  ")
EEPROM $68, ("Msg 13  ")
EEPROM $70, ("Msg 14  ")
EEPROM $78, ("Msg 15  ")

;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
	
	; 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

	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 * 8
						; EEPROM start address is 0 to 15 multiplied by 16
	let b3 = b2 + 8 - 1 		; end address is start address + (line_length - 1)
	for b4 = b2 to b3			; for 8 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
 

afb

Member
Hippy - thank you for your swift response and efforts to amend and test the code. I'll try it out once the demo is safely out of the way and report back.

Best regards

Alan
 
Top