PDA

View Full Version : Hdsp 21xx display



Original
- 8th October 2003, 02:57
Hello Melanie

I'm trying to figure out how to use your DS1307 clock code, at the melabs site, to display hh:mm:ss on the hp hdsp 211x display. The Rentron site has the hdsp example to scroll a message and I've been successful with ascii characters. The clock display format is very confusing to me. Could you please steer me in the right direction or anyone else. I've been trying to get some result for a while now. Bruce Reynolds code is below:

DEFINE OSC 20 ' 20MHz oscillator
DEFINE LOADER_USED 1' Using boot-loader for initial prototype
TRISA = 0 ' Setup PortA = output for Address Bus
TRISB = 0 ' Setup PortB = output for Data Bus
TRISC = $80 ' RC.7 = input, rest outputs [used for loader]
ADCON1 = 7 ' A/D OFF
A_Bus VAR PortA ' PortA Address Bus
D_Bus VAR PortB ' PortB = Data Bus
W_Pin VAR PortC.0 ' HDSP-2112 write strobe pin #13
A3 VAR PortC.1 ' HDSP-2112 mode select pin #6
RST VAR PortC.2 ' HDSP-2112 reset pin #1
Digit VAR BYTE[8] ' 8-byte digit array
DigPat VAR BYTE ' Digit pattern from lookup table
LP_Cnt VAR BYTE ' Loop counter
LowDig VAR BYTE ' Holds "low" digit # to lookup
LowDig = 0 ' 1st digit = 0
HiDig VAR BYTE ' Holds "high" digit # to lookup
HiDig = 7 ' Last digit = 7
J VAR BYTE ' Array index pointer
J = 0 ' 1st byte in array
S_Speed VAR WORD ' Holds display scroll speed
S_Speed = 300 ' Set display scroll speed here
LOW D_Bus.7 ' Set display for normal operation
EOM CON "~" ' Character used as "End of Message" marker
'* // Initialize display - then set brightness * //'
Init_Display:
' * // Initialize Display Here * //'
HIGH W_Pin : LOW RST : PAUSE 10 : HIGH RST : PAUSE 10

' * // Set Display Brightness Here * //'
' To change display brightness
' D_Bus = | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
' Bright =| 100% | 80% | 53% | 40% | 27% | 20% | 13% |
'
' Set 27% | mode.bit | strobe settings into display |
D_Bus = 4 : LOW A3 : LOW W_Pin : HIGH W_Pin
HIGH A3 ' A3 used only for setting display brightness

'* // Get 8 digits into "Digit Array" for display * //'
GetDig:
FOR LP_Cnt = LowDig TO HiDig
LOOKUP LP_Cnt,[" Hello.! ~"],DigPat
Digit[J] = DigPat ' Load all 8 digits into array
J = J + 1 ' Increment array index pointer
NEXT ' Loop until we have all 8 digits loaded
J=0 ' Re-set array index pointer
LowDig = LowDig + 1 ' Increment to next "low" digit
HiDig = HiDig + 1 ' Increment to next "high" digit

' * // We're using the "~" character in EOM to tag the end of message * //'
IF Digit[7] = EOM THEN ' End-of-message indicator..?
Digit[7] = " " ' Then load a "blamk space" character
LowDig = 0 ' Re-load 0-7 MAX digit count
HiDig = 7 '
ENDIF
'* // Display 8 digits on display then return for more // *'
DisplayDigit:
FOR LP_Cnt = 0 TO 7 ' Scroll right-to-left
A_Bus = LP_Cnt ' Place digit address on address bus
D_Bus = Digit[J] ' Place digit data on data bus
LOW W_Pin : HIGH W_Pin' Strobe data into display
J = J + 1 ' Increment array pointer to next digit
NEXT
J = 0 ' Re-set array index pointer
PAUSE S_Speed ' Set display scroll speed
GOTO GetDig

Melanie
- 8th October 2003, 10:35
I've not met this display before so without looking at it's datasheet (which I don't have) I can't immediately give you an answer. If nobody else answers this thread I'll try to find some time and look into it by the weekend.

Original
- 8th October 2003, 17:03
Melanie

Thank you for the quick reply. Thae data sheet can be found at:
www.rentron.com/Files/hdsp-2112.pdf if you need.

Original
- 14th November 2003, 04:36
Well I was able to write a test code for the clock function if anyone is intrested. Works very good!

srspinho
- 7th June 2012, 17:55
Hi friends,

I know that this is a really old topic, but, last week I got 3 of this display for free from a friend.

They are nice, bright, and has a good "retro" looking.

I did many many tests and I was unable to get a stable result from the display. They are brand new, never used.

I test the Rentron´s Hello moving message an the clock published here.

Both, I get ramndom characters and a strange behavior.

I´m using a 16F877 @ 10 Mhz (I did tests @ 20 Mhz also)




6516

I´m using the wiring suggested by rentron :

'* // Display connections * //'
' PortB Display | PortA Display | PortC Display
' B0 #19 | A0 #3 | C0 #13
' B1 #20 | A1 #4 | C1 #6
' B2 #23 | A2 #5 | C2 #1
' B3 #24
' B4 #25
' B5 #26
' B6 #27
' * // Display GND, VCC and N.C. [no connection] * //'
' GND 15,16,17,28
' VCC 2,7,8,9,10,11,14,18
' N.C. 12


and the source code :


DEFINE OSC 10 ' 4MHz oscillator
@ ERRORLEVEL -306 ; Retira o erro de crossing page boundary
;@ __CONFIG _CP_OFF & _DEBUG_OFF & _CP_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF & _HS_OSC
@ __CONFIG _HS_OSC & _CP_OFF & _DEBUG_OFF & _CPD_OFF & _LVP_OFF & _PWRTE_ON & _WDT_OFF

TRISA = 0 ' Setup PortA = output for Address Bus
TRISB = 0 ' Setup PortB = output for Data Bus
TRISC = 0 ' RC.7 = input, rest outputs [used for loader]
ADCON1 = 7 ' A/D OFF

A_Bus VAR PORTA
D_Bus VAR PORTB ' PortB = Data Bus
W_Pin VAR PortC.0 ' HDSP-2112 write strobe pin #13
A3 VAR PortC.1 ' HDSP-2112 mode select pin #6
FL VAR PortC.4 'Flash mode select
RST VAR PortC.2 ' HDSP-2112 reset pin #1
Digit VAR BYTE[8] ' 8-byte digit array
DigPat VAR BYTE ' Digit pattern from lookup table
LP_Cnt VAR BYTE ' Loop counter
LowDig VAR BYTE ' Holds "low" digit # to lookup
LowDig = 0 ' 1st digit = 0
HiDig VAR BYTE ' Holds "high" digit # to lookup
HiDig = 7 ' Last digit = 7
J VAR BYTE ' Array index pointer
J = 0 ' 1st byte in array
S_Speed VAR WORD ' Holds display scroll speed
S_Speed = 200 ' Set display scroll speed here
Low D_Bus.7 ' Set display for normal operation
EOM CON "~" ' Character used as "End of Message" marker
hour VAR BYTE ' Define hour variable
dhour VAR word ' Define display hour variable
minute VAR BYTE ' Define minute variable
second VAR BYTE ' Define second variable
ticks VAR BYTE ' Define pieces of seconds variable
update VAR BYTE ' Define variable to indicate update of LCD

second10 var byte
min10 VAR BYTE
hour10 VAR BYTE

i var word
ADCON1 = 7
second10 = 0
hour = 0 ' Set initial time to 01:00:00
hour10 = 6
minute = 0
min10 = 0
second = 0
ticks = $00


update = 0

OPTION_REG = $55 ' Set TMR0 configuration and enable PORTB pullups
INTCON = $a0 ' Enable TMR0 interrupts
On Interrupt GoTo tickint
'
'* // Initialize display - then set brightness * //'
Init_Display:
' * // Initialize Display Here * //'
High W_Pin : Low RST : Pause 20 : High RST : High FL : Pause 20

' * // Set Display Brightness Here * //'
' To change display brightness
' D_Bus = | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
' Bright =| 100% | 80% | 53% | 40% | 27% | 20% | 13% |
'
' Set 27% | mode.bit | strobe settings into display |
D_Bus = %0001100 : Low A3 : Low W_Pin : High W_Pin
High A3 ':HIGH FL' A3 used only for setting display brightness




'* // Get 8 digits into "Digit Array" for display * //'
GetDig:



For LP_Cnt = LowDig TO HiDig
LookUp LP_Cnt,[" : : "],DigPat
Digit[J] = DigPat ' Load all 8 digits into array
J = J + 1 ' Increment array index pointer
Next ' Loop until we have all 8 digits loaded
J=0 ' Re-set array index pointer
LowDig = LowDig ' Increment to next "low" digit
HiDig = HiDig ' Increment to next "high" digit



'* // Display 8 digits on display then return for more // *'
DisplayDigit:
For LP_Cnt = LowDig TO HiDig ' Scroll right-to-left


A_Bus = LP_Cnt ' Place digit address on address bus

D_Bus = Digit[J] ' Place digit data on data bus
Low W_Pin : High W_Pin' Strobe data into display
J = J + 1 ' Increment array pointer to next digit
DigPat = DigPat

Next
J = 0

chkup:
'While hour = 1 and hour10 = 3
' hour = 0
' hour10 = 1
' wend

A_Bus = 7
D_Bus = 48 + second10
Low W_Pin : High W_Pin
Pause 10

A_Bus = 6
D_Bus = 48 + second
Low W_Pin : High W_Pin
Pause 10

A_Bus = 4
D_Bus = 48 + min10
Low W_Pin : High W_Pin
Pause 10

A_Bus = 3
D_Bus = 48 + minute
Low W_Pin : High W_Pin
Pause 10

A_Bus = 1
D_Bus = 48 + hour10
Low W_Pin : High W_Pin
Pause 10

A_Bus = 0
D_Bus = 48 + hour
Low W_Pin : High W_Pin
Pause 10

IF update = 1 Then

update = 0
endif
Goto chkup

Disable
tickint:
ticks = ticks + 1 ' Count pieces of seconds

IF ticks < 165 Then tiexit


' One second elasped - update time

ticks = 0
second10 = second10 + 1
IF second10 >= 10 Then
second10 = 0
second = second + 1

IF second >= 6 Then
second = 0
min10 = min10 +1
IF min10 > 9 THEN
min10 = 0
minute = minute + 1
IF minute >= 6 Then
minute = 0
hour10 = hour10 + 1
IF hour10 > 9 THEN
hour10 = 0
hour = hour + 1
IF hour > 2 Then
hour = 0



ENDIF
ENDIF

EndIF
EndIF
EndIF

ENDIF
update = 1 ' Set to update LCD

tiexit:
INTCON.2 = 0 ' Reset timer interrupt flag

Resume
End



Have someone here ever used this kind of display ?

thanks !

Sérgio

srspinho
- 7th June 2012, 21:07
Hi friends !

I did find my problem.

I was using a really noisy power supply.

Afeter changing it to another one, everything is working fine !

Thank you !