AXE113 code tutorial?

Axel87

Senior Member
Code:
	init: pause 500 			; wait for screen to initiate
	main: serout C.0,N2400,(254,128) ; move to start of first line
		serout c.0, N2400,(254,1)
		pause 30
		serout c.0, N2400,("Hello WORLD!!!")
		wait 5
		serout c.0, N2400,(254,1)
		pause 30
		pause 100
		serout c.0, N2400,(254,128)
		serout c.0, N2400,(254,14)
		serout c.0, N2400,("P")
		pause 100
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("C")
		pause 100
		serout c.0, N2400,(254,20)
		serout c.0, N2400,("L")
		pause 100
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("O")
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("A")
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("D")		
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,(254,20)
		serout c.0, N2400,(254,192)
		serout c.0, N2400,("L")
		pause 100
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("E")
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("TT")
		pause 100
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("E")
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("R!?!?")
		pause 200
		serout c.0, N2400,(254,1)
		pause 30
		serout c.0, N2400,(254,128)
		serout c.0, N2400,("TEST")
		pause 500
		serout c.0, N2400,(254,8)
		pause 500
		serout c.0, N2400,(254,12)
		pause 500
		serout c.0, N2400,(254,8)
		pause 500
		serout c.0, N2400,(254,12)
		pause 500	
		serout c.0, N2400,(254,8)
		pause 30
		serout c.0,n2400,(254,192)
		pause 500
		serout c.0, N2400,(254,8)
		pause 500
		serout c.0, N2400,(254,12)
		pause 500
		serout c.0,n2400,("TEST")
		wait 1
		serout c.0, N2400,(254,1)
		pause 30
		serout c.0, N2400,(254,128)
		serout c.0,n2400, ("TEST")
		pause 500
		serout c.0,n2400, (254,1)
		pause 30
		serout c.0,n2400,(254,136)
		serout c.0,n2400,("TEST")
		pause 500
		serout c.0,n2400,(254,1)
		pause 30
		serout c.0, n2400, (254,140)
		serout c.0, n2400,("TEST")
		pause 500
		serout c.0,n2400, (254,1)
		pause 30
		serout c.0,n2400,(254,192)
		serout c.0,n2400,("TEST")
		pause 500
		serout c.0,n2400,(254,1)
		pause 30
		serout c.0, n2400, (254,197)
		serout c.0, n2400,("TEST")
		pause 500
		serout c.0,n2400, (254,1)
		pause 30
		serout c.0,n2400,(254,200)
		serout c.0,n2400,("TEST")
		pause 500
		serout c.0,n2400,(254,1)
		pause 30
		serout c.0, n2400, (254,204)
		serout c.0, n2400,("TEST")
		pause 500	
		end
Just got my first LCD hooked up and working!
Pretty exciting stuff, and a good practice working with this code.
Looking through the manual (IE sec 3 pg 34) It talks about "shifting" the screen to allow for up to 40 characters.
If I were to add the following-

serout c.0,n2400,(254,128)
serout c.o,n2400,("HELLO WORLD THIS IS A TEST)
serout c.0,n2400,(254,192)
serout c.0,n2400,("TEST TEST TEST TEST")

How do I go about "scrolling" this last screen? As I have multiple characters assigned in different addresses?
Hopefully that question makes sense :/
Thanks guys!
 

Rick100

Senior Member
Code:
How do I go about "scrolling" this last screen? As I have multiple characters assigned in different addresses?
Hopefully that question makes sense :/
Thanks guys![/QUOTE]

I believe the screen you have is an AXE133Y but correct me if I'm wrong . Do you want to scroll the screen up and down or left and right . Also the simulator will simulate the AXE033 screen . See manual 1 page 68 . You have to look under  View - Options - Simulation and check the lcd checkbox and choose the output pin 0 . I'm not sure how compatible it is with your screen but it ran the code you posted . It didn't recognize one command though . It still looks like a useful tool .

Good luck,
Rick
 

Axel87

Senior Member
http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCsQFjAA&url=http%3A%2F%2Fwww.picaxe.com%2Fdocs%2Fled008.pdf&ei=rhVzUqiuCqrwyAHJ5YCoCA&usg=AFQjCNEPoPJhxwSK_p-C-Qp4YhU6JEFDBg&bvm=bv.55819444,d.aWc

Correct, this is the AXE113.
At this point, I would like the screen to shift to the right. Down will come later probably :)
I did see on the datasheet- pg 5. It does mention a command "Cursor/Display shift" but I dont grasp what the code is that I should use?
serout c.0,n2400,db2? or R???

Rick-
I did try that simulation program to try and make characters but with no luck.
Also, it programs serout 7- which my 08m2 doesnt have. switch it to c.0 and it doesnt error but none of the code works, doesnt display any of the shapes.
(not my main concern at this point, was just putzing around.)
 

bfgstew

Senior Member
This thread may give you some understanding of what you require. There is plenty of reading in the forum if you do a search for it.
 

hippy

Senior Member
How do I go about "scrolling" this last screen?
A 2 line x 16 character LCD usually has 2 lines of 40 ( sometimes 64 ) character memory internally, though you can only see the first 16 characters of each line on the display.

A 'shift left' slides both internal memory lines to the left, the first on line one goes to the last on line two and the first of line two becomes the last of line one.

Using 16 shift left commands; what were characters 17 to 32 will have become characters 1 to 16 on each line, effectively showing a second screen. 16 shift right commands will revert things back to how they were.

Code:
SerOut B.7, N2400, ( 254, $80, "0123456789ABCDEF" )
SerOut B.7, N2400, ( 254, $C0, "This is screen 1" )

SerOut B.7, N2400, ( 254, $90, "FEDCBA9876543210" )
SerOut B.7, N2400, ( 254, $D0, "This is screen 2" )
16 x Shift Left will switch from screen 1 to screen 2
 

Axel87

Senior Member
I apologize for the redundant post. Tried searching but guess I didnt use the right terms.
Thank you for the links, I did look at this-http://www.picaxe.com/docs/led008.pdf
On pg 30 it discusses shifting the screen, but I dont know if I am properly grasping how to comprehend what they are discussing.
Please correct me if I am wrong-
The binary values are, DB7 to DB0, with DB3 being S/C and DB2 being R/L;

0 0 0 1 S/C R/L 0 0

Then for instance to shift the entire display to the left the table says S/C = 1 and R/L = 0, so putting these values into DB3 and DB2 gives you in binary, DB7 to DB0;

0 0 0 1 1 0 0 0 = 24
So if I send-
serout c.0,n2400, (254,0010000) - this should shift to the right?
serout c.0,n2400, (254,0011000)- Shift back to the left?

On pg. 29/30 it talkes about B controls the blink of the cursor.
When B is set to '1", the character specified by the cursor blinks.
But looking at this graph-
RS R/WB DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 0 1 I/D S

I do not see a B assignment, I do see a WB?

Please have patience, this is my first experimentation with these displays.
 

hippy

Senior Member
I did look at this-http://www.picaxe.com/docs/led008.pdf
On pg 30 it discusses shifting the screen, but I dont know if I am properly grasping how to comprehend what they are discussing.
Please correct me if I am wrong-
The binary values are, DB7 to DB0, with DB3 being S/C and DB2 being R/L;

0 0 0 1 S/C R/L 0 0

Then for instance to shift the entire display to the left the table says S/C = 1 and R/L = 0, so putting these values into DB3 and DB2 gives you in binary, DB7 to DB0;

0 0 0 1 1 0 0 0 = 24
So if I send-
serout c.0,n2400, (254,0010000) - this should shift to the right?
serout c.0,n2400, (254,0011000)- Shift back to the left?
Almost but not quite; bits are always numbered from zero on the right and binary numbers need to specified with a % prefix.

So for a shift right "0 0 0 1 S/C R/L 0 0", you need to drop a 1 into S/C for shift, "0 0 0 1 1 R/L 0 0", and a 1 into R/L for right, "0 0 0 1 1 1 0 0". Compact that all together, "00011100", prefix the %, "%00011100", and then ...

serout c.0,n2400, ( 254, %00011100 ) ; Shift right

and

serout c.0,n2400, ( 254, %00011000 ) ; Shift left

On pg. 29/30 it talkes about B controls the blink of the cursor.
I can only see 8 pages in my copy of led008.pdf so am not sure what document you are referring to.

"0 0 0 0 0 1 I/D S" is the Entry Mode command.

"0 0 0 0 1 D C B" is the Display On/Off command you should be looking at to control the cursor blinking.
 

Axel87

Senior Member
I believe it is page 29 and 30 in this document that was being referred to:
http://www.picaxe.com/docs/oled.pdf
Correct Westaust, I apologize for the confusion.
Please correct me if I am wrong on this-
%000000111- To turn on the blink
but
%000000110- (the cursor) has to be enabled first and foremost? (edit)
Sorry, xxx111 enables both cursor and blink. durr ;/
How does this command specify the address for the cursor and blink? As the (254,136) assigns

If DB= Data Bit
R/WB= Read/Write Bit
what does RS stand for?

Also, were does the % in our serout,n2400,(254,%xxxx come from? (edit)
binary numbers need to specified with a % prefix
Thanks again guys
 
Last edited:

Axel87

Senior Member
Hi Axel87,
RS stands for Register Select
RS=0 Command mode
RS=1 Character mode
When 254 is sent command mode is selected it then expects another number like 128
which sets the cursor to line 1 start position.

% just identifies we are using a binary number
just like $ identifies we are using a hex number

http://www.picaxeforum.co.uk/showthread.php?19474-Learning-to-Drive-an-LCD-DISPLAY you may also be interested at looking at this link
marks, Thanks for the info and link!
Took a long glance through your thread, but I fear I am not quiet there yet :/. But I am sure I will be in contact with you soon, as using non-serial LCD's does seem appealing!
Thanks again!
 

Axel87

Senior Member
Code:
init: pause 500 			; wait for screen to initiate
	main: serout C.0,N2400,(254,128) ; move to start of first line
		serout c.0, N2400,(254,1)
		pause 30
		serout c.0, N2400,("Hello WORLD!!!")
		wait 5
		serout c.0, N2400,(254,1)
		pause 30
		pause 100
		serout c.0, N2400,(254,128)
		serout c.0, N2400,(254,14)
		serout c.0, N2400,("P")
		pause 100
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("C")
		pause 100
		serout c.0, N2400,(254,20)
		serout c.0, N2400,("L")
		pause 100
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("O")
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("A")
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("D")		
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,(254,20)
		serout c.0, N2400,(254,192)
		serout c.0, N2400,("L")
		pause 100
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("E")
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("TT")
		pause 100
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("E")
		serout c.0, N2400,(254,20)
		pause 100
		serout c.0, N2400,("R!?!?")
		pause 200
		serout c.0, N2400,(254,1)
		pause 30
		serout c.0, N2400,(254,128)
		serout c.0, N2400,("TEST")
		pause 500
		serout c.0, N2400,(254,8)
		pause 500
		serout c.0, N2400,(254,12)
		pause 500
		serout c.0, N2400,(254,8)
		pause 500
		serout c.0, N2400,(254,12)
		pause 500	
		serout c.0, N2400,(254,8)
		pause 30
		serout c.0,n2400,(254,192)
		pause 500
		serout c.0, N2400,(254,8)
		pause 500
		serout c.0, N2400,(254,12)
		pause 500
		serout c.0,n2400,("TEST")
		wait 1
		serout c.0, N2400,(254,1)
		pause 30
		serout c.0, N2400,(254,128)
		serout c.0,n2400, ("TEST")
		pause 500
		serout c.0,n2400, (254,1)
		pause 30
		serout c.0,n2400,(254,136)
		serout c.0,n2400,("TEST")
		pause 500
		serout c.0,n2400,(254,1)
		pause 30
		serout c.0, n2400, (254,140)
		serout c.0, n2400,("TEST")
		pause 500
		serout c.0,n2400, (254,1)
		pause 30
		serout c.0,n2400,(254,192)
		serout c.0,n2400,("TEST")
		pause 500
		serout c.0,n2400,(254,1)
		pause 30
		serout c.0, n2400, (254,197)
		serout c.0, n2400,("TEST")
		pause 500
		serout c.0,n2400, (254,1)
		pause 30
		serout c.0,n2400,(254,200)
		serout c.0,n2400,("TEST")
		pause 500
		serout c.0,n2400,(254,1)
		pause 30
		serout c.0, n2400, (254,204)
		serout c.0, n2400,("TEST")
		pause 500
		serout c.0,n2400,(254,128)
		serout c.0,n2400,("HELLO WORLD THIS IS A TEST")
		serout c.0,n2400,(254,192)
		serout c.0,n2400,("TEST TEST TEST TEST")
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011100 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 100
		serout c.0,n2400, ( 254, %00011000 )
		pause 500
		serout c.0,n2400, (254,128)
		serout c.0,n2400, ("HELLO WORLD THIS IS A TEST")		
		end
Sorry for the length here, I realize its a bit repetitive. Just want to make sure I am grasping this correctly.
The last two lines have me concerned I am missing something. the last (254,128) should move the screen back to first line first address correct from my understanding.
 

Rick100

Senior Member
The last two lines have me concerned I am missing something. the last (254,128) should move the screen back to first line first address correct from my understanding.
The (254,128) will set the address where the next character will be written to 0 . If the display has been shifted this address may not be at the upper left , or even visible . Use (254,2) to restore the cursor to the address 0 and set the display to the original position .

Good luck,
Rick
 
Last edited:

westaust55

Moderator
The last two lines have me concerned I am missing something. the last (254,128) should move the screen back to first line first address correct from my understanding.
If you look at page 5 on the LED008 datasheet (or in the Winstar OLED datasheet,) you will see the command table
254 follows by the value 1 will Clear Display (see the first/top line in the table)

Further down is the line for DDRAM address which has DB7 (bit7) set to 1 one the the remaining bits will reflect where you want the cursor to be located to display the next character.
So if you sent 254,128 then it will set the cursor at the firs character (left side) of the top line
If you want the first character in the second line you must add 64 ($40) to the 128 so we use the sequence 254,192.

If you go to page 17 in the OLED dastsheet you originally looked at for cursor and blink bits information there is a diagram showing the address positions for each character on a 2 line display.
Note that those address values are in hexadecimal so the 40 in the second row left position means $40 ==> 64.
 
Top