EmbeddedRelated.com
Forums
Memfault Beyond the Launch

LED displays, synchronous serial?

Started by tadaosystems September 11, 2003
I'm using a PIC16F627 to hopefully control an Osram SCDQ 4 character,
5x5 matrix display.

It uses 5 inputs, being gnd, vcc, sdclk, sdata, and load.

I've been trying to set up the 16F627 to use synchronous master
serial to send characters to the display, but haven't been successful.

I assume that RB2/TX/CK goes to the sdclk pin, RB1/RX/DT goes to the
sdata pin. vdd and gnd are obvious, but what about load?

I also don't know what the baud rate generator should be set at, as
there's no mention in the datasheet for the display. I'm using the
internal oscillator on the PIC at 4Mhz.

Should RB1 and RB2 be inputs or outputs? Also, as far as I know, to
send data to the display I should do the following:

Set the BRG: SPBRG = ?
Enable the sync master serial port by setting SYNC, SPEN, and CSRC
Set TXEN to enable the transmission
And start the transmission by loading TXREG

What about multiple transmissions? Do I have to watch a flag?



--- tadaosystems <> escribi
> I'm using a PIC16F627 to hopefully control an Osram
> SCDQ 4 character,
> 5x5 matrix display.
>
> It uses 5 inputs, being gnd, vcc, sdclk, sdata, and
> load.
>
> I've been trying to set up the 16F627 to use
> synchronous master
> serial to send characters to the display, but
> haven't been successful.
>
> I assume that RB2/TX/CK goes to the sdclk pin,
> RB1/RX/DT goes to the
> sdata pin. vdd and gnd are obvious, but what about
> load?
>
> I also don't know what the baud rate generator
> should be set at, as
> there's no mention in the datasheet for the display.
> I'm using the
> internal oscillator on the PIC at 4Mhz.
>
> Should RB1 and RB2 be inputs or outputs? Also, as
> far as I know, to
> send data to the display I should do the following:
>
> Set the BRG: SPBRG = ?
> Enable the sync master serial port by setting SYNC,
> SPEN, and CSRC
> Set TXEN to enable the transmission
> And start the transmission by loading TXREG
>
> What about multiple transmissions? Do I have to
> watch a flag? >
Hello, im using this display without any troubles, but
it seems that you are driving the display input
signals incorrectly.
The Data, SDclk and Ldata pins of the display must be
driven by outputs in the pic (you can of course
multiplex this pins as inputs but this dont matter the
display) the bits of each row of each character needs
to be loaded in sync with the sdclk pin transitions,
this is eight bits for each row and five rows per
character and at the end of each 8 bits gruop (this is
each row)the ldata signal needs to be changed of
state. in the datasheet there is a timing chart that
displays the correct transitions of each signal.The
display operates in the range of nanoseconds so a 4
Mhz PIC drives it perfectly without the need of delay
loops.
An important question is that the SCDQ has no reset
pin (the SCDV has)so you MUST send the reset and clear
code before anithing else or the display just dont
displays nothing!!!!
If you are interested i can send the code im use to
drive the display. In this code i have included the
routines to generate the characters (the display is
romless so it comes with no character tables included)
I use now the SCDQ5542 and SCDV5542 displays
(4characters 5x5 dots each character) but the code is
universal you just may need to adjust the address of
the character to match your display size.Regards

___________________________________________________
Yahoo! Messenger - Nueva versi GRATIS
Super Webcam, voz, caritas animadas, y m...
http://messenger.yahoo.es




--- In , omar cusce <ocusce@y...> wrote:
> Hello, im using this display without any troubles, but
> it seems that you are driving the display input
> signals incorrectly.
> The Data, SDclk and Ldata pins of the display must be
> driven by outputs in the pic (you can of course
> multiplex this pins as inputs but this dont matter the
> display) the bits of each row of each character needs
> to be loaded in sync with the sdclk pin transitions,
> this is eight bits for each row and five rows per
> character and at the end of each 8 bits gruop (this is
> each row)the ldata signal needs to be changed of
> state. in the datasheet there is a timing chart that
> displays the correct transitions of each signal.The
> display operates in the range of nanoseconds so a 4
> Mhz PIC drives it perfectly without the need of delay
> loops.
> An important question is that the SCDQ has no reset
> pin (the SCDV has)so you MUST send the reset and clear
> code before anithing else or the display just dont
> displays nothing!!!!
> If you are interested i can send the code im use to
> drive the display. In this code i have included the
> routines to generate the characters (the display is
> romless so it comes with no character tables included)
> I use now the SCDQ5542 and SCDV5542 displays
> (4characters 5x5 dots each character) but the code is
> universal you just may need to adjust the address of
> the character to match your display size.Regards
>

I'm using the SCDQ5542, to be specific. I would VERY much appreciate
being able to see your code.

Thanks!




--- tadaosystems <> escribi
> --- In , omar cusce
> <ocusce@y...> wrote:
Well here goes the code and a gif with the schematic
for a 16f86 PIC, feel free to use and modify the code
as any other people interested in it and if you can
improve it then send me a mail.
Just for curiosity, where do yo buy the SCDQ? i ask
you because i cant find it anymore here in Argentina
and i have taked some displays from old PAIRGAIN hdsl
modems. and these displays are fantastic for the 8 pin
PICs because it can be drived with only 3 pins!
Regards

___________________________________________________
Yahoo! Messenger - Nueva versi GRATIS
Super Webcam, voz, caritas animadas, y m...
http://messenger.yahoo.es


;This program controls a 5 pin
;inteligent display scdq5542 from osram
;the display is driven just with 3 pic lines
;and the connections are:
;pin 1 of display in ra0 (load data enable)
;pin 2 of display in ra1 (data)
;pin 3 of display in ra2 (serial data clock)
;
;--------------------------------
;NOTE: THIS CODE IS FULLY FUNCTIONAL BUT VERY ROUGH
;SURELLY IT CAN BE IMPROVED AND OPTIMIZED, SPECIALLY THE METHOD TO GET
;THE DATA FOR EACH CHARACTER, SUGESTIONS AND IDEAS ARE WELCOME
;I.E. YOU CAN MODIFY THE CODE TO DRIVE 2 OR MORE DISPLAYS AT THE SAME
;TIME USING THE LDATA PIN TO ENABLE EACH AND THE OTHER SIGNALS IN A BUS
;--------------------------------
LIST PF84A ;tells which processor is used
INCLUDE "p16F84A.inc" ;defines various registers etc. Look it over.
__CONFIG _PWRTE_ON & _XT_OSC & _WDT_OFF ;config bits
;configured poweron timer and osc cristal
;--------------------------------
;Set vars
CONVERT equ 0ch ;auxiliar for parallel to serial conversion
COUNTER equ 0dh ;auxiliar counter
COUNT2 equ 0eh ;auxiliar counter 2
CHARPOS equ 0fh ;character position in the display
CHAR equ 10h ;character to show
LDATA equ 0 ;pin 1 display in ra0 (load data enable)
BDATA equ 1 ;pin 2 display in ra1 (data)
SDCLK equ 2 ;pin 3 display in ra2 (serial clock)
;--------------------------------
;Set ports
bsf STATUS,RP0
movlw 00h
movwf TRISA
bcf STATUS,RP0
movlw .255 ;puts all pins 1 for safe
movwf PORTA
movlw b'11000000' ;initializing the display sending a clear, to do this
call Conversion ;loads clear in w and call serial conversion rutine
;--------------------------------
;begins main loop
;THIS IS JUST AN EXAMPLE, IT DRAWS CONTINUOSLY THE SAME CHARS AND DO NOTHING
;MORE THAN THIS.
;--------------------------------
Start
movlw b'10100000' ;char0 address
movwf CHARPOS
clrf CHAR ;shows first character in table (in this code a 0 number)
call Drwchar
incf CHARPOS ;char1 address
movlw .3 ;shows char 3 in table (the number 3)
movwf CHAR
call Drwchar
incf CHARPOS ;char2 address
movlw .10 ;shows char 10 in table (the A letter)
movwf CHAR
call Drwchar
incf CHARPOS ;char3 address
movlw .15 ;showsw char 15 in table (the F letter)
movwf CHAR
call Drwchar
goto Start
;End of main loop
;--------------------------------
;Begin of the paralel to serial routine that drives the display
Conversion
movwf CONVERT ;takes the data in W and puts in the CONVERT register
movlw 08h ;initializes the 8 events counter to make the
movwf COUNTER ;conversion of the byte in CONVERT register to serie
bcf PORTA,LDATA ;pulls down LDATA enables data write in the display
bcf PORTA,SDCLK ;pull down data clock
bcf PORTA,BDATA ;puts 0 in output data
btfsc CONVERT,0 ;if the bit to transmit was not zero then
bsf PORTA,BDATA ;it changes, if it was zero just leaves unchanged
bsf PORTA,SDCLK ;pull up data clock, display loads data (just that bit)
rrf CONVERT ;rotate CONVERT register to right
decfsz COUNTER ;decrements counter, if there is more bits to transmit
goto $-7 ;goes back again
bsf PORTA,LDATA ;pulls up LDATA, the display shows the data
return
;End of conversion routine
;--------------------------------
;Begin routine that gets data and draws each character (6 bytes)
Drwchar
movlw .5 ;load counter with number of read cicles
movwf COUNT2 ;
movf CHARPOS,W ;loads character position in w and send it to the
call Conversion ;parallel to serial routine
movf CHAR,W ;loads character to be drawed in W
bcf STATUS,C ;clear the carry bit
rlf CHAR ;multiplies the register CHAR x2
rlf CHAR ;multiplies register CHAR x2 again
addwf CHAR,F ;completes multiplication x5 adding CHAR one more time
call Dselect ;call routine that load data of characters from tables
call Conversion ;and begins to draw into display
incf CHAR,F ;increments register CHAR
decfsz COUNT2 ;decrements register COUNT2 an exits if zero
goto $-4 ;go back to search more data in tables
return
;End of data and draw routine
;--------------------------------
;Begin routine that loads bits to be drawed
Dselect
movf CHAR,W
addwf PCL ;adss w to PCL to get each row of the character
;From here goes the tables that stores the data for each character
;these tables will be readed incrementing in a calculated form the program
;counter, for this reason the practical limit is 49 diferent characters
;this is 49*5 bytes to be read without bank switching
Data0 dt b'00001110',b'00110011',b'01010101',b'01111001',b'10001110'
Data1 dt b'00000100',b'00101100',b'01000100',b'01100100',b'10001110'
Data2 dt b'00001110',b'00110001',b'01000110',b'01101000',b'10011111'
Data3 dt b'00011110',b'00100001',b'01001110',b'01100001',b'10011110'
Data4 dt b'00000110',b'00101010',b'01011111',b'01100010',b'10000010'
Data5 dt b'00011111',b'00110000',b'01011110',b'01100001',b'10011110'
Data6 dt b'00000110',b'00101000',b'01011110',b'01110001',b'10001110'
Data7 dt b'00011111',b'00100010',b'01000100',b'01101000',b'10001000'
Data8 dt b'00001110',b'00110001',b'01001110',b'01110001',b'10001110'
Data9 dt b'00001110',b'00110001',b'01001111',b'01100010',b'10001100'
DataA dt b'00000100',b'00101010',b'01011111',b'01110001',b'10010001'
DataB dt b'00011110',b'00101001',b'01001110',b'01101001',b'10011110'
DataC dt b'00001111',b'00110000',b'01010000',b'01110000',b'10001111'
DataD dt b'00011110',b'00101001',b'01001001',b'01101001',b'10011110'
DataE dt b'00011111',b'00110000',b'01011110',b'01110000',b'10011111'
DataF dt b'00011111',b'00110000',b'01011110',b'01110000',b'10010000'
DataG dt b'00001111',b'00110000',b'01010011',b'01110001',b'10001111'
DataH dt b'00010001',b'00110001',b'01011111',b'01110001',b'10010001'
DataI dt b'00001110',b'00100100',b'01000100',b'01100100',b'10001110'
DataJ dt b'00000001',b'00100001',b'01000001',b'01110001',b'10001110'
DataK dt b'00010011',b'00110100',b'01011000',b'01110100',b'10010011'
DataL dt b'00010000',b'00110000',b'01010000',b'01110000',b'10011111'
DataM dt b'00010001',b'00111011',b'01010101',b'01110001',b'10010001'
DataN dt b'00010001',b'00111001',b'01010101',b'01110011',b'10010001'
DataO dt b'00001110',b'00110001',b'01010001',b'01110001',b'10001110'
DataP dt b'00011110',b'00110001',b'01011110',b'01110000',b'10010000'
DataQ dt b'00001100',b'00110010',b'01010110',b'01110010',b'10001101'
DataR dt b'00011110',b'00110001',b'01011110',b'01110100',b'10010010'
DataS dt b'00001111',b'00110000',b'01001110',b'01100001',b'10011110'
DataT dt b'00011111',b'00100100',b'01000100',b'01100100',b'10000100'
DataU dt b'00010001',b'00110001',b'01010001',b'01110001',b'10001110'
DataV dt b'00010001',b'00110001',b'01010001',b'01101010',b'10000100'
DataW dt b'00010001',b'00110001',b'01010101',b'01111011',b'10010001'
DataX dt b'00010001',b'00101010',b'01000100',b'01101010',b'10010001'
DataY dt b'00010001',b'00101010',b'01000100',b'01100100',b'10000100'
DataZ dt b'00011111',b'00100010',b'01000100',b'01101000',b'10011111'
;End of data tables
return
;End of data load routine
;--------------------------------
end



Attachment (not stored)
SCDQ5542Schematic.gif
Type: image/gif


I buy the displays through www.arrow.com. I've only used them once,
so I don't know how reliable they are, but I was able to buy just a
few parts and not worry about ordering in huge quantities.

Thanks for the example code!



Memfault Beyond the Launch