Upload
alcenhelmiyo
View
215
Download
0
Embed Size (px)
Citation preview
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 1/10
LENNARD 5 Digit LED Display Module data sheet May
2002
Table of contents:
Pinouts Talking to the Module Creating a Character Character Map Displaying a Character Circuit Diagram Basic Sample Software Scrolling Text character - Hex - ascii converter Javelin Stamp Software java class for driving the display
Pinouts Pin Function
1 Strobe digit 2
2 Vdd (5Vdc)
3 Vss
4 N/C
5 Strobe digit 0
6 Strobe digit 4
7 Strobe digit 1
8 Clock
9 Strobe digit 3
10 Data
Talking to the Module
To display a character, you need to send a byte to the module, then strobe the digit youwant that character displayed on.
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 2/10
Creating a Character
To display a character on any digit, a 8 bit code is sent to that digit. One bit for eachsegment.
The format of the byte is as follows:
1 BYTE
Segment . G F E D C B A
Bit 8 7 6 5 4 3 2 1
For example, to display "8." send 11111111 to the display (255 decimal, FF
hexadecimal).
To display "8" send 01111111 to the display (127 decimal, 7F hexadecimal).
The byte is sent to the module MSB first.
Character Map
Character Binary Decimal Hex0 00111111 63 3F
1 00000110 6 06
2 01011011 91 5B
3 01001111 79 4F
4 01100110 102 66
5 01101101 109 6D
6 01111101 125 7D
7 00000111 7 07
8 01111111 127 7F9 01101111 111 6F
A 01110111 119 77
b 01111100 124 7C
C 00111001 57 39
c 01011000 88 58
d 01011110 94 5E
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 3/10
E 01111001 121 79
F 01110001 113 71
G 00111101 61 3D
H 01110110 118 76
h 01110100 116 74I 00110000 48 30
J 00001110 14 0E
L 00111000 56 38
N 00110111 55 37
o 01011100 92 5C
P 01110011 115 73
R 00110001 49 31
t 01111000 120 78
U 00111110 62 3E
u 00011100 28 1C
Y 01101110 110 6E
Blank digit 00000000 0 00
DecimalPoint
1000000 128 80
Displaying a Character.
Once you have sent the byte to the module, you will need to strobe the digit/s you wishthe character to be displayed on.
For example, to display a character on digit 0, pulse pin 5 high then low. To display thesame character on digits 0 and 1, pulse both pins 5 and 7 high then low.
Circuit Diagram.
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 4/10
Software Samples.
The following samples are written in PBasic for the Parallax BS2.
Scrolling text:
A simple demonstration to show that almost anything is possible with the LENNARDDisplay Module, including a fancy effect as animated displaying of characters.
'{$STAMP BS2}
'April 2002. Ben Lennard.
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 5/10
'Quick demo which scrolls "LENNARD" across my 5
'digit display
'The display would be like this:
'____L
'___LE'__LEN
'_LENN
'LENNA
'ENNAR
'NNARD
'NARD_
'ARD__
'RD___
'D____
'_____
'Thats 12 steps in total
'Therfore, we will need a For loop for starters, that counts
from 1 to 12
'and another For loop within that loop, along with conditionalstatements
'to determine what we need to display on each digit...
'*****DECLARE VARIABLES*****
'DATA for the Display's Character Lookup Table, EEPROM address
0 to 7
data 56,121,55,55,119,49,94,0 'LENNARD
'CONSTANTS
clock CON 6 'P6 = clock to 4094's pin 3
datapack CON 5 'P5 = Data to 4094's pin 2
'VARIABLESstrobedigit var nib 'a four bit variable used to determine
which digit to update
character var byte 'the data to send to the display
a var nib 'a for loop variable
b var nib 'a for loop variable
startletter var nib 'determines which character to start with
endletter var nib 'determines which character to finish with
spaces var nib 'used to make sure the correct digit is strobed
'*****MAIN PROGRAM*****
start:
Gosub blankdisplay
startletter = 0
endletter = 0spaces=0
for b = 1 to 12
for a = startletter to endletter
read a, character
strobedigit = spaces + endletter - a
gosub loadregisters
next
'determine the speed of scrolling by the pause statement
pause 200
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 6/10
endletter = endletter + 1
'as we only have 5 digits, we need to check if we
'need to change the start letter...
if endletter > 4 then incrementstartletter
goto endofroutine
incrementstartletter:if endletter > 7 then endlettermax
startletter=startletter + 1
goto endofroutine
endlettermax:
endletter = 7
spaces = spaces + 1
startletter=startletter + 1
endofroutine:
next
goto start
blankdisplay:
SHIFTOUT datapack, clock, msbfirst, [0] 'blank display
for a = 0 to 4pulsout a,1 'Strobe each digit
next
return
loadregisters:
SHIFTOUT datapack, clock, msbfirst, [character] 'Send data to
the display
PULSOUT strobedigit,1 'Strobe required digit to display the
data
return
CHARACTER - HEX ASCII converter
Use a terminal emulator such as Hyperterminal or Clarisworks data transfer tocommunicate with the Stamp Microcontroller. Set to 2400, 8, N, 1.
'{$STAMP BS2}
'March 2002. Ben Lennard.'Program to demonstrate how to interface to the LENNARD5 Digit'LED display module. Plus, how to communicate with a PC, and display the'Hexadecimal ASCII code of any keys pressed on the keyboard.
'The outputs from the 4094 registers correspond to the Digit segments asfollows:'MSB -> .GFEDCBA <-LSB
'To write to a digit, do the following:'1. Send data.
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 7/10
'2. Strobe the digit/s you want to display the data
'What this program does:'Receives data from the PC everytime a key is pressed, and displays the
'Decimal and Hexadecimal value of that Key's ASCII code.'Data received from the PC will be 8 bits, so we need to translate that 8 bits'in to two sets of nibbles. Then, we use those nibbles to look up the actual byte'we need to send to the 4094's to display the correct data.'Example: If we send "Z" via the serial port, we will receive the following byte: 01011010'Which is "5A" in Hexaedecimal.'To display that value on the "LENNARD Display module": Split the byte into two nibbles.'The lower nibble, 1010 (Hexadecimal = "A", Decimal "10")'will make the program look up position 10 in the table, and then sends that
data'in the table to the display, digit A.'The upper nibble, 0101 (Hexadecimal and Decimal = "5") will make the program look up'position 5 in the table, and then sends that data in the table to the display,digit B.
'*****DECLARE VARIABLES*****'DATA for the Display Character Lookup Table (EEPROM address 0 to 20)data 63,6,91,79,102,109,125,7,127,111 '0-9data
%01110111,%01111100,%00111001,%01011110,%01111001,%01110001'A-Fdata 63,%00111000,%00111000,%01111001,%01110110 'O,L,L,E,H("HELLO")
'CONSTANTSclock CON 6 'P6 = clock to 4094's pin 3datapack CON 5 'P5 = Data to 4094's pin 2
'VARIABLESstrobedigit var nib 'a four bit variable used to determine which digit to update
'5 digits, 0 to 4character var byte 'the data to send to the displaydatafromPC var byte 'the data from the PCa var byte 'just a FOR loop variablenibble var nib 'used to store the lower or upper 4 bits of "datafromPC"divider var byte
'*****MAIN PROGRAM*****
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 8/10
'Set up the displayGosub blankdisplay
'display "HELLO"
for a = 16 to 20'go to EEPROM address "a" and store the data at that address in "Character"read a, character 'Send "character" to the display module, and display on the digit'determined by "strobedigit"strobedigit=a-16gosub loadregistersnext
pause 3000
'blank display againGosub blankdisplay
ReadSerialPort:SERIN 16, 396, [datafromPC] 'Using builtin serial port, 2400baud, 8, N, 1if not datafromPC = 27 then keepgoing 'If ESC pressed, send a message back to the PCSEROUT 16, 396, [" Microcontroller demo. Ben Lennard 3/2002"]keepgoing:
if datafromPC = 27 then ReadSerialPortGOSUB DisplayASCIIcodeGOTO ReadSerialPort
DisplayASCIIcode:nibble = datafromPC 'transfer lower 4 bits of byte to nibble'NOTE: As "nibble" is a nibble, and "datafromPC" is a byte,'then only the lower half of "datafromPC" will be passed to "nibble"read nibble, character 'lookup data in table to send to the display'load that data in to Digit Astrobedigit=0
gosub loadregisters
nibble = datafromPC >> 4 'transfer upper 4 bits of byte to nibbleread nibble, character 'lookup data in table to send to the display'load that data in to Digit Bstrobedigit = 1gosub loadregisters
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 9/10
DisplayDECIMALcode: '(this code added 25/3/2002)'This is a little more difficult than working out'the HEX code (simply spliting the byte in to two nibbles)'as we can have up to 3 digits. So, we need to split the
'decimal version of the character in to 3 parts to display...'The following code takes advantage of the fact that the Stamp'and similar Microcontrollers only do Integer maths without'an external floating point coprocessor attached.
'Figure out hundreds unit (doing 100's then 10's then 1's, rather 'than 1's, 10's, 100's saves 6 bytes of EEPROM! As this way you don't need torepeat code)nibble = datafromPC / 100 'eg: 214 / 100 = 2.14 (integer maths drops the .14)strobedigit = 4read nibble, character
gosub loadregisters 'eg: load 01011011 in to digit 4, which displays a 2.
'Figure out tens unitdivider = nibble * 100 'eg: 2 * 100 = 200divider = datafromPC - divider 'eg: 214 - 200 = 14nibble = divider / 10 'eg: 14 / 10 = 1.4 (integer maths drops the .4), so nibble =1strobedigit = 3read nibble, character gosub loadregisters 'eg: load 00000110 in to digit 3, which displays a 1.
'Figure out ones unitdivider = datafromPC / 10 'eg: 214 / 10 = 21.4 (integer maths drops the .4)divider = divider * 10 'eg: 21 * 10 = 210nibble = datafromPC - divider 'eg: 214 - 210 = 4strobedigit = 2read nibble, character 'eg: read EEPROM address 4 (which has 01100110stored in it)'store value in EEPROM address 4 in character '(turn on decimal point to seperate Dec from Hex on the display, eg: 188.BC)character = character + %10000000gosub loadregisters 'eg: load 01100110 in to digit 2, which displays a 4.
return
blankdisplay:SHIFTOUT datapack, clock, msbfirst, [0] 'blank displayfor a = 0 to 4 pulsout a,1 'Strobe each digitnext
8/7/2019 5 Digit LED Display Module data sheet May 2002
http://slidepdf.com/reader/full/5-digit-led-display-module-data-sheet-may-2002 10/10
return
loadregisters:SHIFTOUT datapack, clock, msbfirst, [character] 'Send data to the display
PULSOUT strobedigit,1 'Strobe required digit to display the datareturn