Trouble with 0LED

#1
Hi,
Hi I am using an OLED but it is not recieving any information from B.0 , it is just displaying 'serial OLED, www.picaxe.com. Can you help?

;128|129|130|131|132|133|134|135|136|137|138|139|140|141|142|143|
;192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207|
#picaxe 18m2

;output B0 - LCD
;output B6 - LED
;output B4 - LED
;output B5 - LED
;output B3 - LED
;output B2 - not using
;output B1 - buzzer
;output B0 - Piezobuzzer

;input C0 - button reset
;input C1 - BUTTON LAP
;input C2 - BUTTON COUNTDOWN
;input C3 - NOT USING
;input C4 - 10k RES TO 0V
;input C5 - NOT USING
;input C6 - button countup
;input C7 - not using

serout B.0,N2400,(254,1);set B.0, as output for LCD
let dirsC = %00000000 ;set pinsC as inputs or outputs
let dirsB = %11111111 ;set pinsB as inputs or outputs(pin B.0
symbol lappos = b0 ; number of keys pressed
symbol count_down = b4 ; value of key pressed
symbol start_time = b6
; *** reset position to zero ***

init:
let lappos = 0
let count_down = 0
let start_time = 0
pause 500 ; wait for display to initialise
serout B.0,N2400,(254,1) 'clear display
pause 30
serout B.0,N2400,(254,129) ; move to end of first line
serout B.0,N2400,("Press Button") ;first line of code
serout B.0,N2400,(254,193) ; move to end of first line
serout B.0,N2400,(" To Start ") ;first line of code

; *** now scan each row in turn ***
; *** by setting only 1 row (and LED) high ***
; *** if a switch is hit jump call score sub below ***

Buttons:
if pinC.0 = 0 then init 'clear display'
if pinC.1 = 0 then lap
if pinC.2 = 0 then countdown
if pinC.6 = 0 then starttime
goto Buttons

starttime:
pause 500 ; wait for display to initialise
serout B.0,N2400,(254,1) 'clear display
pause 30
serout B.0,N2400,(254,131) ; move to end of first line
serout B.0,N2400,("START TIME") ;first line of code
serout B.0,N2400,(254,197) ; move to end of first line
serout B.0,N2400,("000") ;first line of code
pause 500

starttime2:
let start_time = start_time+1
bintoascii start_time,b1,b2,b3
pause 1000
if pinC.0 = 0 then init 'clear display'
if pinC.1 = 0 then lap
if pinC.2 = 0 then countdown
if pinC.6 = 0 then starttime
serout B.0,N2400,(254,197) ; move to end of first line
serout B.0,N2400,(b1,b2,b3) ;first line of code
goto starttime2

lap:
let lappos = lappos +0
serout B.0,N2400,(254,1) 'clear display
pause 30
serout B.0,N2400,(254,133) ; move to end of first line
serout B.0,N2400,("LAPS") ;first line of code
lap2:
let lappos = lappos+1 ;add 1 to a lap
bintoascii lappos,b1,b2,b3
serout B.0,N2400,(254,192) ; move to end of first line
serout B.0,N2400,("Total Laps:",b1,b2,b3)
pause 500

Buttons2:
if pinC.0 = 0 then init 'clear display'
if pinC.1 = 0 then lap2
if pinC.2 = 0 then countdown
if pinC.6 = 0 then starttime
goto Buttons2

countdown:
let count_down = count_down+10 ;add 10 to count_down
serout B.0,N2400,(254,1) 'clear display
pause 30
serout B.0,N2400,(254,130) ; move to end of first line
serout B.0,N2400,("Count down") ;first line of code
bintoascii count_down,b1,b2,b3
serout B.0,N2400,(254,192) ; move to end of first line
serout B.0,N2400,("Total:",b1,b2,b3)
pause 500
goto Buttons3

countdown2:
let count_down = count_down-1 ;minus 1 from Count down
serout B.0,N2400,(254,130) ; move to end of first line
serout B.0,N2400,("Count down") ;first line of code
bintoascii count_down,b1,b2,b3
serout B.0,N2400,(254,192) ; move to end of first line
serout B.0,N2400,("Total:",b1,b2,b3)
If count_down =0 then Buttons
pause 500


Buttons3:
if pinC.0 = 0 then init 'clear display'
if pinC.1 = 0 then lap
if pinC.2 = 0 then countdown2
if pinC.6 = 0 then starttime
goto Buttons3
 

hippy

Technical Support
Staff member
#2
Welcome to the PICAXE Forum

Can you let us know which PICAXE board to are using and how you have the OLED wired to the board. It could be you are using the wrong connection pin, or are driving it through a Darlington Array.

It would probably be better to start with a simpler program, something like -
Code:
#Picaxe 18M2
Init:
  Pause 1000
  SerOut B.0, N2400, ( 254,1 )
  Pause 10
MainLoop:
  Do
    SerOut B.0, N2400, ( "U" )
    Pause 1000
  Loop
 

Technical

Technical Support
Staff member
#3
Your input/output program comments are probably incorrect as you have two B.0s described, should the OLED serout commands be on B.7 instead?
 
#4
I am using a 18m2, I have the same programme working on another circuit which works fine. This circuit is not sending anything to pin B.0 (0LED). I tried the circuit above and nothing worked I am still getting 'serial OLED, www.picaxe.com. It is like it is not clearing the 0LED?

;128|129|130|131|132|133|134|135|136|137|138|139|140|141|142|143|
;192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207|
#picaxe 18m2

;output B0 - LCD
;output B6 - LED
;output B4 - LED
;output B5 - LED
;output B3 - LED
;output B2 - not using
;output B1 - buzzer
;output B7 - Piezobuzzer

;input C0 - button reset
;input C1 - BUTTON LAP
;input C2 - BUTTON COUNTDOWN
;input C3 - NOT USING
;input C4 - 10k RES TO 0V
;input C5 - NOT USING
;input C6 - button countup
;input C7 - not using

serout B.0,N2400,(254,1);set B.0, as output for LCD
let dirsC = %00000000 ;set pinsC as inputs or outputs
let dirsB = %11111111 ;set pinsB as inputs or outputs(pin B.0
symbol lappos = b0 ; number of keys pressed
symbol count_down = b4 ; value of key pressed
symbol start_time = b6
; *** reset position to zero ***

init:
let lappos = 0
let count_down = 0
let start_time = 0
pause 500 ; wait for display to initialise
serout B.0,N2400,(254,1) 'clear display
pause 30
serout B.0,N2400,(254,129) ; move to end of first line
serout B.0,N2400,("Press Button") ;first line of code
serout B.0,N2400,(254,193) ; move to end of first line
serout B.0,N2400,(" To Start ") ;first line of code

; *** now scan each row in turn ***
; *** by setting only 1 row (and LED) high ***
; *** if a switch is hit jump call score sub below ***

Buttons:
if pinC.0 = 0 then init 'clear display'
if pinC.1 = 0 then lap
if pinC.2 = 0 then countdown
if pinC.6 = 0 then starttime
goto Buttons

starttime:
pause 500 ; wait for display to initialise
serout B.0,N2400,(254,1) 'clear display
pause 30
serout B.0,N2400,(254,131) ; move to end of first line
serout B.0,N2400,("START TIME") ;first line of code
serout B.0,N2400,(254,197) ; move to end of first line
serout B.0,N2400,("000") ;first line of code
pause 500

starttime2:
let start_time = start_time+1
bintoascii start_time,b1,b2,b3
pause 1000
if pinC.0 = 0 then init 'clear display'
if pinC.1 = 0 then lap
if pinC.2 = 0 then countdown
if pinC.6 = 0 then starttime
serout B.0,N2400,(254,197) ; move to end of first line
serout B.0,N2400,(b1,b2,b3) ;first line of code
goto starttime2

lap:
let lappos = lappos +0
serout B.0,N2400,(254,1) 'clear display
pause 30
serout B.0,N2400,(254,133) ; move to end of first line
serout B.0,N2400,("LAPS") ;first line of code
lap2:
let lappos = lappos+1 ;add 1 to a lap
bintoascii lappos,b1,b2,b3
serout B.0,N2400,(254,192) ; move to end of first line
serout B.0,N2400,("Total Laps:",b1,b2,b3)
pause 500

Buttons2:
if pinC.0 = 0 then init 'clear display'
if pinC.1 = 0 then lap2
if pinC.2 = 0 then countdown
if pinC.6 = 0 then starttime
goto Buttons2

countdown:
let count_down = count_down+10 ;add 10 to count_down
serout B.0,N2400,(254,1) 'clear display
pause 30
serout B.0,N2400,(254,130) ; move to end of first line
serout B.0,N2400,("Count down") ;first line of code
bintoascii count_down,b1,b2,b3
serout B.0,N2400,(254,192) ; move to end of first line
serout B.0,N2400,("Total:",b1,b2,b3)
pause 500
goto Buttons3

countdown2:
let count_down = count_down-1 ;minus 1 from Count down
serout B.0,N2400,(254,130) ; move to end of first line
serout B.0,N2400,("Count down") ;first line of code
bintoascii count_down,b1,b2,b3
serout B.0,N2400,(254,192) ; move to end of first line
serout B.0,N2400,("Total:",b1,b2,b3)
If count_down =0 then Buttons
pause 500


Buttons3:
if pinC.0 = 0 then init 'clear display'
if pinC.1 = 0 then lap
if pinC.2 = 0 then countdown2
if pinC.6 = 0 then starttime
goto Buttons3
 
#5
Your input/output program comments are probably incorrect as you have two B.0s described, should the OLED serout commands be on B.7 instead?
I am on B.0 everything works on the simulator but not on the PCB, I do have another circuit which works correctly so I think it must be a hard ware issue but I am not sure what?
 

hippy

Technical Support
Staff member
#6
Code:
;input C7 - not using

serout B.0,N2400,(254,1);set B.0, as output for LCD
That SEROUT is erroneously placed and will execute before the OLED completes its power-up sequence. That could be causing the OLED driver to see a corrupted data stream which messes things up from then on.

The line of code seems to be where it should be later, so perhaps delete this SEROUT command.

But it would still be best to try the simpler code suggested in Post #2.
 
#7
I have tried most things now also their is a signal coming out of B.0 and reaching the 0LED but does not clear it at all. Any ideas?
Thanks
Bean

#picaxe 18m2
let dirsC = %00000000 ;set pinsC as inputs or outputs
let dirsB = %11111111 ;set pinsB as inputs or outputs(pin B.0
symbol lappos = b0 ; number of keys pressed
symbol count_down = b4 ; value of key pressed
symbol start_time = b6
; *** reset position to zero ***

init:
let lappos = 0
let count_down = 0
let start_time = 0
serout B.0,N2400,(254,1);set B.0, as output for LCD
pause 500 ; wait for display to initialise
serout B.0,N2400,(254,1) 'clear display
pause 1000
serout B.0,N2400,(254,1) 'clear display
pause 1000
serout B.0,N2400,(254,129) ; move to end of first line
serout B.0,N2400,("Press Button") ;first line of code
serout B.0,N2400,(254,193) ; move to end of first line
serout B.0,N2400,(" To Start ") ;first line of code
pause 1000
goto init
 
#10
Hi, I thought I would let you know that it works. I went to make another PCB and when I looked at the acetate PCB noticed a small line across one of the tracks, which I could not see on the soldered PCB. Soldered it up and now works ahhh. Thanks for all your help.
Bean
 
Top