OLED/SERIN help required

hi

so infront of me, i have, a 40x2 (and protoboard) and a 28x2 (and project board) along with a 20*4 OLED screen

ive established through use of a multimeter, the serout funtion on both chips is working, at the moment, the slave chip in the OLED screen is using the programme it initially came with, which, i understand relatively well, ive written a fairly extensive programme for the 40x2 which works perfectly when i run the simulation (it should display a few bits on the OLED screen, yet when i connect the "in" wire on the OLED screen (still with original programme in the slave chip)...nothing happens, to the screen, it continues displaying the "picaxe.com" welcome messsage

do i need to account for screen adjusment times etc?

does the serin command on the screen have to timed simultaneously with the serout command on the 40x2?

if someone would care to copy and paste a snippet of code using the serout funtion on the 40x2 that will simply make something...anything, profanity, words, french whatever, appear on the screen, and explain rounghly how it does it you will be loved for eternity.


trying to keep it short and simple, so any questions please feel free to ask
kind regards
Sean
 
hiya, they where on a different circuit when you asked, they have been in the past, and still no result, but, ill pot them both on the same power source just to check, cheers
 
just a side note, im just sticking to the 40x2 (on the proto board) and the OLED at the moment (though i do appriciate you reading the thread thoroghly)
 

srnet

Senior Member
ive established through use of a multimeter, the serout funtion on both chips is working
A multimeter might indicate if serout is doing something, but it cant tell you if the serout function is 'working', and as you say it is not.

You need to post the code you are using.
 
sorry yep that's what i meant, i just meant it was doing something...in general...god knows what...




okie doke, here's the first snippet of code im using, it's and intro screen with a little bit of branding and slogan lark, along with a completely useless, "fake" loading bar, in the form of several "."'s




Code:
let dirsB = 255
	init: pause 500 ‘ 
	
		serout B7,N2400,(254,1)
	
		serout B7,N2400,(254,134)
		serout B7,N2400,("EYES-UP")
		pause 1700
		serout B7,N2400,(254,152)
		serout B7,N2400,("live to ride")
		pause 1000
		serout B7,N2400,(254,212)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,213)serout B7,N2400,(".")pause 250
		serout B7,N2400,(254,214)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,215)serout B7,N2400,(".")pause 250
		serout B7,N2400,(254,216)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,217)serout B7,N2400,(".")pause 250
		serout B7,N2400,(254,218)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,219)serout B7,N2400,(".")pause 250
		serout B7,N2400,(254,220)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,221)serout B7,N2400,(".")pause 250
		serout B7,N2400,(254,222)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,223)serout B7,N2400,(".")pause 250
		serout B7,N2400,(254,224)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,225)serout B7,N2400,(".")pause 250
		serout B7,N2400,(254,226)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,227)serout B7,N2400,(".")pause 250
		serout B7,N2400,(254,228)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,229)serout B7,N2400,(".")pause 250
		serout B7,N2400,(254,230)serout B7,N2400,(".")pause 200 serout B7,N2400,(254,231)serout B7,N2400,(".")pause 250
		
		serout B7,N2400,(254,1)
 

nick12ab

Senior Member
Which pin is your LCD connected to?
  • B.7?
  • B.0?
Well if it's connected to B.7 then that's why it won't work - variable B7 = 0 until another value is assigned to it. You meant to use the pin constant B.7 which will work.

In addition, you don't need to reposition the cursor on the LCD before sending each '.' to the LCD as the position is remembered by the LCD until it is turned off.

Try this version of the code:
Code:
		#picaxe 40X2
		
		let dirsB = 255
	init: pause 500 ‘ 
	
		serout B.7,N2400,(254,1)
	
		serout B.7,N2400,(254,134)
		serout B.7,N2400,("EYES-UP")
		pause 1700
		serout B.7,N2400,(254,152)
		serout B.7,N2400,("live to ride")
		pause 1000
		serout B.7,N2400,(254,212)
		for b4 = 0 to 15
			serout B.7,N2400,(".")
			pause 200
		next
		serout B.7,N2400,(254,1)
Also consider using the block character instead of . for the loading bar - the character code for the block character is usually 255, so you'd just replace "." with 255.
 
okie doke, i still just got the welcome message provided by the 18m2 slave chip... but...a few seconds after starting up, the display dimmed momentarily, and that was it, :S could it, have anything to do with the serout voltage being just shy of 5v, having trouble getting an even voltage to the board and the OLED while maintaining a common ground
 
nope still no use, (no offense) the display just comes up with the welcome message off the slave chip (18m2) , dimms slightly a few seconds in for a moment and continues displaying the welcome message, im having trouble evently distributing the power supply while maintaining a common ground, does it matter the serout voltage is somewhere close to 5v?
 

nick12ab

Senior Member
Have you ensured that B7 has been replaced with B.7 in all of your serout commands? Try copying and pasting my version of the code, where all of the B7s have been replaced with B.7.

The serout voltage should have a maximum of just below 5V but should be 0V or just above once the PICAXE has stopped transmitting. If the serout voltage stays at 5V then try using a different pin on the PICAXE - you might have busted B.7 doing something else.

Now what's this about maintaining a common ground? All a common ground is is where the Vss or GND connections on all the devices are connected to each other.
 
yup (sorry for doubling my reply, hadn't seen the second page formed so thought the first had been lost) yup i copied your code direct (your code alone), and tried replacing all of my B7's with B.7's, going to try again with your code just for the hell of it,
 

eclectic

Moderator
From post #1
"so infront of me, i have, a 40x2 (and protoboard) and a 28x2 (and project board) along with a 20*4 OLED screen"

Which protoboard?
Which project board?

Please provide

1. A high-quality photograph.

2. A schematic.

3. The full code.

e
 
quick snapshot might help?

IMAG0939.jpg

ok there's a quick snap shot of what i have, sorry for the poor quality (and rotation) the mass of tape along with the red and black rubbish is simply power supply the uppermost white wire is the serial wire the other two white's are power to the OLED
 

nick12ab

Senior Member
What are all those red and black wires for?

BTW: Your My code works when I tried it and shows the 'EYES-UP' message.
 
IMAG0944.jpgIMAG0943.jpg

ok unfortunately brilliant images aren't quite possible due to it being dark at the moment

the protoboard: http://www.picaxe.com/Hardware/Project-Boards/PICAXE-2840-Proto-Board/

the screen: http://www.picaxe.com/Hardware/Add-on-Modules/Serial-OLED-Module-20x4/

(using the standard picaxe usb cable also had plenty of other programmes work before)

at the moment i simply the a 9v power supply powering both units (i did this in order to maintain a high enough voltage to power both units while also maintaining a common ground)
 
i'd stated in the post above the red and black wired at just power supply, (there are plenty of them as im using a few battery snap conectors for ease of modification)

(sorry if i'd referenced your code as my own somewhere, completely unintentional, unless you just meant to say that my code is...crap... which, is, a very fair statement :D )

ok, nick12ab: if your code works, what are you doing that is different to me? what type of screen are you using, how have you connected it to the rest of your circuit, and im assuming if youre using a slave chip on the screen it has the original PICAXE code still uploaded?
 

nick12ab

Senior Member
ok, nick12ab: if your code works, what are you doing that is different to me? what type of screen are you using, how have you connected it to the rest of your circuit, and im assuming if youre using a slave chip on the screen it has the original PICAXE code still uploaded?
I am doing...
  • Using the same regulated 5V power supply for both display and PICAXE
  • Using a 16x2 LCD with AXE033 (shouldn't make a difference, but you could try adding a pause after 'serout B.7,N2400,(254,1)' in the code as the AXE133 is probably slower)
  • using an AC adaptor rather than weedy 9V batteries
I don't think I'm doing anything else different.
 
just incase anyone was interested this is an addition to a school project, ive already build most of it, it's a motorcycle head up display, at the moment the control box uses a radio transmission to relay data to the helmet display unit, it works pretty well if i may say so, i'd just like a little extra telemetry on the control box (currently situated on the handle bars of a 600bandit) :)
 
doesnt seem you are doing much different, im going to fart around with the power supply a little i think, ill also give the pause a go, thanks for all your help this evening by the way :)
 

nick12ab

Senior Member
YESSSSSSSSSSS you're a legend, i parralled up the power supplies and it works!!!
So does that mean that there was no common ground beforehand?

P.S. In my version of the code which I posted earlier, that FOR loop needs to have 0 to 15 replaced with 0 to 19 as you're using a 20 character per line display not 16 characters per line.
 
there was but the board and the screen where in series thus there was an un even distribution of voltage....just used the find and replace tool on the rest of that programme (2800 bytes) it took less time for me to figure out how to use and xbox...
 

eclectic

Moderator
there was but the board and the screen where in series thus there was an un even distribution of voltage....just used the find and replace tool on the rest of that programme (2800 bytes) it took less time for me to figure out how to use and xbox...
Please see post #15,
points 1, 2 and 3.

FULL information
is much more likely to produce

fuller answers.
 
in reply to your post script, yup i tweaked it just after i got it working, thanks for that (improved my understanding a little more) :)
 

nick12ab

Senior Member
there was but the board and the screen where in series thus there was an un even distribution of voltage....just used the find and replace tool on the rest of that programme (2800 bytes) it took less time for me to figure out how to use and xbox...
Having them in series is not using a common ground. You're lucky you didn't fry the PICAXE on the serial OLED module since depending on which way you had the things wired, you'd either be feeding 10V or -5V into that input pin on the serial module.

And 2800 bytes? It's 323 according to the syntax checker. Or if you use my version, 93 bytes.
 
ah yeah... um there's a little more to the programme than i mentioned at the moment.... well here it is

there are: plenty of problems yet to be ironed out, (sorry i just oped the file to im yet to pop in your addtion (you'll probably end up being credited in the final report (you may remain a "forum member if you wish")

Code:
#picaxe 40X2

	let dirsB = 255



	init: pause 500 ‘ 
	
		let dirsB = 255
	
		serout B.7,N2400,(254,1)
	
		serout B.7,N2400,(254,134)
		serout B.7,N2400,("EYES-UP")
		pause 1700
		serout B.7,N2400,(254,152)
		serout B.7,N2400,("live to ride")
		pause 1000
		serout B.7,N2400,(254,212)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,213)serout B.7,N2400,(".")pause 250
		serout B.7,N2400,(254,214)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,215)serout B.7,N2400,(".")pause 250
		serout B.7,N2400,(254,216)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,217)serout B.7,N2400,(".")pause 250
		serout B.7,N2400,(254,218)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,219)serout B.7,N2400,(".")pause 250
		serout B.7,N2400,(254,220)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,221)serout B.7,N2400,(".")pause 250
		serout B.7,N2400,(254,222)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,223)serout B.7,N2400,(".")pause 250
		serout B.7,N2400,(254,224)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,225)serout B.7,N2400,(".")pause 250
		serout B.7,N2400,(254,226)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,227)serout B.7,N2400,(".")pause 250
		serout B.7,N2400,(254,228)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,229)serout B.7,N2400,(".")pause 250
		serout B.7,N2400,(254,230)serout B.7,N2400,(".")pause 200 serout B.7,N2400,(254,231)serout B.7,N2400,(".")pause 250
		
		serout B.7,N2400,(254,1)
		goto main
		
		
		
	main:
		
	
		if pinC.0 = 1 then
		goto TRACK ; jump to TRACK if pin0 is high
		end if
		goto ROAD ; else go to ROAD MODE 
		
	TRACK:
		
		serout B.7,N2400,(254,128) 

		serout B.7,N2400,("MODE:T")
		
	STATS:	
		
		if pinC.1 = 1 then
		goto ROLLY ; go and display Y on roll?
		end if
		goto ROLLN ; go and display N on roll?
	
	
	ROLLY:	
		Serout B.7,N2400,(254,192)  
		
		serout B.7,N2400,("ROLL:Y")
		
		goto ACCEL
		
	ROLLN:
		Serout B.7,N2400,(254,192)
		
		serout B.7,N2400,("ROLL:N")
		
		goto ACCEL
		
		
	
	
	
	ACCEL:
		if pinC.2 = 1 then
		goto HUNDRED
		end if
		goto SIXTY

  
	SIXTY:
		Serout B.7,N2400,(254,148)
		
		serout B.7,N2400,("0-060")
		
		goto EOPD
		
	HUNDRED:		
		Serout B.7,N2400,(254,148)
		
		serout B.7,N2400,("0-100")
	
		goto EOPD
		
		
		
		
		
	ROAD:
		
		serout B.7,N2400,(254,128)
		
		serout B.7,N2400,("MODE:R")
		
		serout B.7,N2400,(254,192)
	
		if pinC.4 = 1 then
		goto STATS
		end if
		
		
		serout B.7,N2400,("      ")
		
		serout B.7,N2400,(254,148)
		
		serout B.7,N2400,("     ")
		
		
	EOPD:
		goto BAT	
		
	BAT:	
	
		serout B.7,N2400,(254,212)
		
		serout B.7,N2400,("    ")
		
		
		if pinC.6 = 1 then
		goto BATL
		end if
		goto BATCHECK
		
	BATL:
		serout B.7,N2400,(254,212)
		
		serout B.7,N2400,("BAT!")
		
		pause 200
		
		goto BATCHECK
	BATCHECK:
	
		if pinC.5 = 1 then
		goto BATCHECKY
		end if 
		goto BATEND
	
	BATCHECKY:	
	
	serout B.7,N2400,(254,212) serout B.7,N2400,("BAT:")
	
	BLV1:	serin [20,BLV2],D.1,N2400,(1) serout B.7,N2400,(254,216) serout B.7,N2400,("-        F") goto BATCHECK
	BLV2:	serin [20,BLV3],D.1,N2400,(2) serout B.7,N2400,(254,216) serout B.7,N2400,("--       F") goto BATCHECK	
	BLV3:	serin [20,BLV4],D.1,N2400,(3) serout B.7,N2400,(254,216) serout B.7,N2400,("---      F") goto BATCHECK
	BLV4:	serin [20,BLV5],D.1,N2400,(4) serout B.7,N2400,(254,216) serout B.7,N2400,("----     F") goto BATCHECK	
	BLV5:	serin [20,BLV6],D.1,N2400,(5) serout B.7,N2400,(254,216) serout B.7,N2400,("-----    F") goto BATCHECK	
	BLV6:	serin [20,BLV7],D.1,N2400,(6) serout B.7,N2400,(254,216) serout B.7,N2400,("------   F") goto BATCHECK	
	BLV7:	serin [20,BLV8],D.1,N2400,(7) serout B.7,N2400,(254,216) serout B.7,N2400,("-------  F") goto BATCHECK
	BLV8:	serin [20,BLV9],D.1,N2400,(8) serout B.7,N2400,(254,216) serout B.7,N2400,("-------- F") goto BATCHECK
	BLV9: serin [20,BLV1],D.1,N2400,(9) serout B.7,N2400,(254,216) serout B.7,N2400,("---------F") goto BATCHECK
	
		
		
	BATEND:
		serout B.7,N2400,(254,212) serout B.7,N2400,("              ")
		goto CONT
		
		
	CONT:																			; contrast section					
	
	CONT1:serin [20,CONT2],D.2,N2400,(1) serout B.7,N2400,(254,135) serout B.7,N2400,("C      ") goto CONTIN		; read level
	CONT2:serin [20,CONT3],D.2,N2400,(2) serout B.7,N2400,(254,135) serout B.7,N2400,("C-     ") goto CONTIN
	CONT3:serin [20,CONT4],D.2,N2400,(3) serout B.7,N2400,(254,135) serout B.7,N2400,("C--    ") goto CONTIN	
	CONT4:serin [20,CONT5],D.2,N2400,(4) serout B.7,N2400,(254,135) serout B.7,N2400,("C---   ") goto CONTIN
	CONT5:serin [20,CONT6],D.2,N2400,(5) serout B.7,N2400,(254,135) serout B.7,N2400,("C----  ") goto CONTIN	
	CONT6:serin [20,CONT7],D.2,N2400,(6) serout B.7,N2400,(254,135) serout B.7,N2400,("C----- ") goto CONTIN	
	CONT7:serin [20,CONT1],D.2,N2400,(7) serout B.7,N2400,(254,135) serout B.7,N2400,("C------") goto CONTIN	
	
		
	CONTIN:																		; auto/manual contrast
		if pinC.7 = 1 then
		serout B.7,N2400,(254,142)
		serout B.7,N2400,("A")	
		goto RECAll
		end if
		serout B.7,N2400,(254,142)
		serout B.7,N2400,("M")	
		goto RECALL																	;end of contrast section


	RECALL:
		if pinC.3 = 1 then
		goto BEST
		end if
		GOTO LAST
		
	BEST: 
		serout B.7,N2400,(254,208)
	
		serout B.7,N2400,("R:B ")
		goto RECALLT
	
	LAST:	 	
	
		serout B.7,N2400,(254,208)
		
		serout B.7,N2400,("R: L")
		goto RECALLT				;recall button actually pressed 
		
	RECALLT:
	
		if pinC.4 = 1 then
		goto RECALLTY
		end if
		goto RECALLTN
	
	RECALLTY:
			
		serout B.7,N2400,(254,208)
		
		serout B.7,N2400,("    ")
		
		serout B.7,N2400,(254,199)
	
		serout B.7,N2400,("RECALL")
		goto INSTRUCTION
	
	RECALLTN: 
		serout B.7,N2400,(254,199)
		
		serout B.7,N2400,(" SPEED")
		goto INSTRUCTION
		
	INSTRUCTION:

	
				serin [100,INROLL],D.3,N2400,(1) goto INSTOPY
	INSTOPY:		serout B.7,N2400,(254,228) serout B.7,N2400,("STOP") 
				goto INSTRUCTIONEND
					
	INROLL:		serin [100,INGO],D.3,N2400,(2) goto INROLLY	
	INROLLY:		serout B.7,N2400,(254,228) serout B.7,N2400,("ROLL")	
				goto INSTRUCTIONEND
				
	INGO:			serin [100,NOINSTRUCTION],D.3,N2400,(3) goto INGOY				
	INGOY:		serout B.7,N2400,(254,228) serout B.7,N2400,("!GO!")
				goto INSTRUCTIONEND
				
				
	NOINSTRUCTION:	serin [100,INSTRUCTIONEND],D.3,N2400,(4) goto NOINSTRUCTIONY		
	NOINSTRUCTIONY:	serout B.7,N2400,(254,228) serout B.7,N2400,("    ")
				goto INSTRUCTIONEND
				
							
	INSTRUCTIONEND:		
	
				goto SPEEDREAD
still not finished

all the recall and accel. crap is part of the devices 0-60/0-100 timer (will rolling or stationary start) which is used in "Track mode" there's a little more i havent put in there tha't still being edited so it'll come out a little under 2800
 

nick12ab

Senior Member
One more thing to get you started on your optimizations:
Code:
	ACCEL:
		if pinC.2 = 1 then
		goto HUNDRED
		end if
		goto SIXTY

  
	SIXTY:
		Serout B.7,N2400,(254,148)
		
		serout B.7,N2400,("0-060")
		
		goto EOPD
		
	HUNDRED:		
		Serout B.7,N2400,(254,148)
		
		serout B.7,N2400,("0-100")
	
		goto EOPD
The above can be replaced with the below, and look how much nicer it looks:
Code:
	ACCEL:
		Serout B.7,N2400,(254,148)
		if pinC.2 = 1 then
			serout B.7,N2400,("0-100")
		else
			serout B.7,N2400,("0-060")
		end if
		goto EOPD
If you try really hard, you'll probably end up with only 2 or 3 gotos in your entire program, and that way it's much easier to follow, which is important for your coursework.
 
great cheers thanks ver much indeed, bits like that are esspecially useful for showing development (in this case optimisation) :) the exam board are quite fussy and really want to see the project progress
 
Top