ByVac BV4513 serial LED module

StigOfTheDump

Senior Member
Hi there

I bought a couple of these serial LED modules to try on my 18M2.

http://www.byvac.com/bv3/index.php?route=product/product&path=35_53&product_id=53

I connected it up pin 5 to ground, pin 3 to +5v, pin 1 to C.2 but cannot get it to display numbers. I tried with and without inverse, with pin 1 and with pin 4 and with lots of different serout strings. I also tried hserout on B.5.

The display shows ASI in the first 3 digits and the fourth is blank. If I put my last statement in a loop the letters A,S and I flicker brightly but not in any particular order. After the loop is finished it goes Back to "ASI ".

I found a thread on this module showthread.php?t=14381 where matherp was successful with I2C but can't find anything on serial mode.

I thought it would be as simple as using the AXE033. What am I doing wrong?

BV4513 DataSheet.pdf

Code:
;18M2

setfreq m8					'Min BAUD for display is 9600
pause 500

serout C.2,T9600_8,("cr"):pause 100	'Establish connection & set BAUD
serout C.2,T9600_8,("cr"):pause 100
serout C.2,T9600_8,("cr"):pause 100

serout C.2,T9600_8,("bn3 7")		'Write number 7 on 4th digit
 

hippy

Ex-Staff (retired)
According to the manual ( page 8 ) it can accept either N or T baud rates. Make sure you have it connected to the correct pin ( Pin 4 for Nxxxx ). If that doesn't work try pin 1 and add a HIGH C.2 at the start of the program to prime the pin for Txxxx baud rate output.
 

Technical

Technical Support
Staff member
Your CR are wrong, it needs to be the number 0x13, not the text "cr"

serout C.2,T9600_8,(CR)
pause 100

or

serout C.2,T9600_8,($13)
pause 100
 

matherp

Senior Member
Stig

Attached is code which definitely works using the display in serial mode using the 18M2 hardware serial port. Just comment out the Hi2c commands which drive a compass module and put a number (0-999) in w0 before the call to the display subroutine. Note that you have to use ASCII strings (e.g. bn1) to tell the display what to do with the data you are sending

Hope this helps

best regards

Peter

Code:
#picaxe 18M2
setfreq m8
symbol compassdata = w0
symbol readcount = b2
symbol i2crate=6
symbol refresh = 20
symbol compass = %00110010

pause 1000

HI2CSETUP I2CMASTER, compass, i2cslow_8, i2cbyte
hsersetup B9600_8,0
gosub ini_display


if pinc.2 =0 then  'Enter calibration mode
'	hi2cout (0x71)
	pause 500
	hserout 0,("bs1 39",cr)
	hserout 0,("bs2 77",cr)
	hserout 0,("bs3 38",cr)
	Do
		pause 500
	Loop until pinc.2 <> 0 
'	hi2cout (0x7E)
	pause 2000
'	hi2cout (0x82)
	pause 4000
endif 

pause 1000
' Run normally
hi2cout (0x50)
readcount=i2crate
Do
	if readcount<>0 then
		dec readcount
	else
		hi2cin (b1,b0,b11,b10,b13,b12)
		w0=w0/10
		gosub display
		readcount=i2crate
		pause refresh
		hi2cout ($50)
  	endif
Loop

ini_display:
pause 1000
hserout 0,(cr)
pause 1000
hserout 0,("bb40",cr)
hserout 0,("bc",cr)
return
 
Last edited:

StigOfTheDump

Senior Member
Thanks for your replies everybody. I now think I have my head around it.

Thanks for the code Peter, I find it so much easier to start with something that works then try to break it one piece at a time, than starting out where any or all of 10 things could be wrong.

Here is my code. It's not as efficient as it could be, but it makes the comments much more understandable this way.

Code:
;18M2


#picaxe 18M2
setfreq m8					'Min BAUD on Display 9600
symbol long=w5				'Pause long enough to view
symbol short=w6				'Pause for system
long=1000					'Increase for longer view
short=100					'Can be zero or even omitted

pause short


hsersetup B9600_8,0			'Set BAUD 
pause 1000
hserout 0,(cr)				'Synchronise BAUD (may need to repeat 3 times)
hserout 0,("bb25",cr)			'Set brightness (0=Dim 25=Bright)
hserout 0,("bc",cr)			'Clear display
pause short

hserout 0,("bn0 15",cr)			'Write character"F" on 1st digit
hserout 0,("bn1 ",#10,cr)		'Write character"A" on 2nd digit (alt style)
hserout 0,("bn2 13",cr)			'Write character"d" on 3rd digit
hserout 0,("bn3 14",cr)			'Write character"E" on 4th digit
pause short

for b5=0 to 5
	for b4=25 to 0 step -5
		hserout 0,("bb",#b4,cr)	'Progressively dim display
		pause short
	next b4

	for b4=0 to 25 step 5
		hserout 0,("bb",#b4,cr)	'Progressively brighten display
		pause short
	next b4
next b5

'Characters 0-9, A-F are available with ascii codes 0-15

'Some additional characters can be created using ascii
'However there is some overlap when adding the segments up.
'Most of the characters that can be written are in the HEX list
'below. But there are some useful characters when you want to 
'write them from a variable. 


hserout 0,("bc",cr)			'Clear display
pause short
for b6=0 to 80 step 10			'Count tens
let b9=b6/10				'Make b9 one tenth of the tens
for b7=0 to 8				'Count units
let b8=b6+b7				'Make character tens + units
hserout 0,("bs0 ",#b8,cr)		'Write character
hserout 0,("bn2 ",#b9,cr)		'Write tens
hserout 0,("bn3 ",#b7,cr)		'Write units
pause short
next b7
next b6

'Other characters can be created using HEX

hserout 0,("bc",cr)			'Clear display

hserout 0,("bs0 3D",cr)			'Write character "G"
hserout 0,("bn2 3",cr)			'1st HEX bit "3"
hserout 0,("bn3 13",cr)			'2nd HEX bit "D"
pause long

hserout 0,("bs0 76",cr)			'Write character "H"
hserout 0,("bn2 7",cr)
hserout 0,("bn3 6",cr)
pause long

hserout 0,("bs0 06",cr)			'Write character "I"
hserout 0,("bn2 0",cr)
hserout 0,("bn3 6",cr)
pause long

hserout 0,("bs0 0E",cr)			'Write character "J"
hserout 0,("bn2 0",cr)
hserout 0,("bn3 14",cr)
pause long

hserout 0,("bs0 38",cr)			'Write character "L"
hserout 0,("bn2 3",cr)
hserout 0,("bn3 8",cr)
pause long

hserout 0,("bs0 54",cr)			'Write character "n"
hserout 0,("bn2 5",cr)
hserout 0,("bn3 4",cr)
pause long

hserout 0,("bs0 5C",cr)			'Write character "o"
hserout 0,("bn2 5",cr)
hserout 0,("bn3 12",cr)
pause long

hserout 0,("bs0 73",cr)			'Write character "P"
hserout 0,("bn2 7",cr)
hserout 0,("bn3 3",cr)
pause long

hserout 0,("bs0 50",cr)			'Write character "r"
hserout 0,("bn2 5",cr)
hserout 0,("bn3 0",cr)
pause long

hserout 0,("bs0 6D",cr)			'Write character "S"
hserout 0,("bn2 6",cr)
hserout 0,("bn3 D",cr)
pause long

hserout 0,("bs0 78",cr)			'Write character "t"
hserout 0,("bn2 7",cr)
hserout 0,("bn3 8",cr)
pause long

hserout 0,("bs0 1C",cr)			'Write character "u"
hserout 0,("bn2 1",cr)
hserout 0,("bn3 12",cr)
pause long

hserout 0,("bs0 6E",cr)			'Write character "Y"
hserout 0,("bn2 6",cr)
hserout 0,("bn3 14",cr)
pause long

'This works

hserout 0,("bc",cr)
hserout 0,("bs0 0E",cr)			'Represent letter "J" with 14 ($0E) HEX
pause long

'This doesn't

hserout 0,("bc",cr)
hserout 0,("bs0 14",cr)			'Represent letter "J" with 14 Ascii
pause long

'Count from 0000 to $FFFF in HEX

for b0=0 to 15				'Count in HEX 0 to F last digit
for b1=0 to 15				'Count in HEX 0 to F 3rd digit
for b2=0 to 15				'Count in HEX 0 to F 2nd digit
for b3=0 to 15				'Count in HEX 0 to F 1st digit
	hserout 0,("bn0 ",#b0,cr)	'Write 1st digit
	hserout 0,("bn1 ",#b1,cr)	'Write 2nd digit
	hserout 0,("bn2 ",#b2,cr)	'Write 3rd digit
	hserout 0,("bn3 ",#b3,cr)	'Write last digit
	pause short
next b3
next b2
next b1
next b0
 
Last edited:
Top