Here is the full list of Common Cathode:
Starting from 0 to 9.
$c0, $F9, $A4, $B0, $99, $92, $82, $F8, $80, $90
------------------------------
Here is the full list of Common Cathode:
Starting from 0 to 9.
$c0, $F9, $A4, $B0, $99, $92, $82, $F8, $80, $90
------------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Sayzer,
You bolded Common Cathode as if it is for sure - you must mean Common Anode. Common Cathode requires the segment to be high to be on while Common Anode requires Segments to be low to be on. His buffer is non-inverting. (Your set looks correct though - I left a little for the OP to work out as a learning exercise but now he is close to set).
EDIT:
Oh, for thoroughness, have you considered testing DT's suggested gif animator at 1/4 scale?![]()
![]()
Last edited by paul borgmeier; - 26th December 2006 at 19:35.
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Hi Paul,
My set is for Common Cathode.
I now see what you meant.
Let me check for Common Anode...Should be somewhere in my HDDs.
BTW; I am just testing the animator and will remove it now. I think is is slowing down the CPU when there is more then one running.
-----------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Sayzer,
You have it correct for Common Anode in post #10 (at least the first three are correct - I didn't check your others). The OP should be grateful for your help because you probably saved him hours of work and frustration)
Best Wishes
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Paul,
Ok, here is the clarification.
(from 0 to 9)
Common Anode : $c0, $F9, $A4, $B0, $99, $92, $82, $F8, $80, $90
Common Cathode : $3F, $06, $5B, $4F, $66, $6D, $7D, $07, $7F, $6F
Using Dot or not changes from set to set.
These are what I use.
----------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Hi paul borgmeier
I'm not understand for item 1
1) On your buffer, tie 1 and 19 low so they do not float.
For item 4 , as you advise with modify some hard were right, Do you have other way with out modify hard or not.
1) On U2, pins 1 and 19 both must be connected to GND (or held low) in order for the input to be placed on the output of the buffer. If either pin is high, then the entire output of U2 will be tri-stated (high impedance). Floating means leaving pins NOT or unconnected, which is not good because they can "do what they want" - stay low, drift high, or worse go somewhere in-between. Just connect both 1 and 19 to GND and you will be set.
4) The DP can be set entirely in software using the added line of code OR it can be set in hardware. If you cannot change your circuit, then use the software version. Just add the IF-THEN statement shown in 4) and you should have a DP turned on.
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Hi paul borgmeier
Thank for you reply..
Soory! for circuit not clear for you.. , we used 7 seg COM Cathode..
This circuit i have test with time counter alredly done no problem.
But after we apply Display sub to 1820 reading ,so got problem display cannot show reading on 7 seg display..
Pls any xepert advise >> very confiuse for me
code: time conter
DEFINE LOADER_USED 1
DEFINE OSC 4
@ Device pic16F877, xt_OSC, BOD_OFF, PWRT_ON, WDT_OFF, PROTECT_OFF,WRT_ON
Segments Var PORTC
Digits Var PORTD
i Var Byte
n Var Byte
J var byte
Value Var WORD
Hr var byte
Minute var BYTE ' Define minute variable
Second var BYTE ' Define second variable
Ticks var byte ' Define pieces of seconds variable
D_up var byte
clear ' clear all RAM (sets all VAR declarations to zero)
TRISc = $00 ' Set segment pins to output
TRISd = $f0 ' Set digit pins to output
TrisB = $00
Portb = $00
OPTION_REG = $55 ' Set TMR0 configuration 1:64
INTCON = $A0 ' Enable TMR0 interrupts
On Interrupt Goto int0
mainloop:
goto display
goTo mainloop ' Do it forever
disable
int0:
Ticks = Ticks + 1 ' Count pieces of seconds
If Ticks < 61 Then goto ExitInterrupt ' 61 ticks per second
' One second elasped - update time
Ticks = 0
Second = Second + 1
If Second >= 60 Then
Second = 0
Minute = Minute + 1
If Minute >= 60 Then
D_up =1
Minute = 0
Hr =hr + 1
If Hr >= 60 Then
Hr = 0
endif
endif
Endif
goto mainloop
display:
If D_up = 1 then
VALUE = ((Hr*100)+Minute)
goto dup
else
VALUE = ((minute*100)+second)
endif
dup:
For i = 0 To 3 ' Loop through 4 digits
n = Value Dig i ' Get digit to display
' Gosub display1 ' Display the value
Digits = $ff
Lookup n, [$3F, $06, $5B, $4F, $66, $6D, $7D, $07, $7F, $6F,_
$77, $7C, $39, $5E, $79, $71, $0FF], Segments
Digits = ~Dcd i
NEXT I
goto mainloop
ExitInterrupt:
INTCON.2 = 0 'clear the interrupt flag
Resume
enable
code : 1820 reading
Define LOADER_USED 1
DEFINE OSC 4
@ Device pic16F877, xt_OSC, BOD_OFF, PWRT_ON, WDT_OFF, PROTECT_OFF,WRT_ON
Segments Var PORTC
Digits Var PORTD
i Var Byte
n Var Byte
Value Var Word
TRISc = $00 ' Set segment pins to output
TRISd = $f0 ' Set digit pins to output
' Allocate variables
command var byte ' Storage for command
J var byte ' Storage for loop counter
temp var word ' Storage for temperature
DQ var PORTd.4 ' Alias DS1820 data pin
DQ_DIR var TRISd.4 ' Alias DS1820 data direction pin
TRISc = $00 ' Set segment pins to output
TRISd = $f0 ' Set digit pins to output
TrisB = $00
Portb = $00
OPTION_REG = $55 ' Set TMR0 configuration 1:64
INTCON = $A0 ' Enable TMR0 interrupts
On Interrupt Goto display
ADCON1 = 7 ' Set PORTA and PORTE to digital
'debug ====
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_SPBRG 12 ' 19200 Bauds ,4 m
'debug ====
' Mainloop to read the temperature and display on LCD
mainloop:
Gosub init1820 ' Init the DS1820
command = $cc ' Issue Skip ROM command
Gosub write1820
command = $44 ' Start temperature conversion
Gosub write1820
Pause 2000 ' Wait 2 seconds for conversion to complete
Gosub init1820 ' Do another init
command = $cc ' Issue Skip ROM command
Gosub write1820
command = $be ' Read the temperature
Gosub write1820
Gosub read1820
'Display the decimal temperature
HSEROUT ["Temp = ",dec (temp>>1),".", dec (temp.0*5)," C",13,10]
Goto mainloop ' Do it forever
' Initialize DS1820 and check for presence
init1820:
Low DQ ' Set the data pin low to init
Pauseus 500 ' Wait > 480us
DQ_DIR = 1 ' Release data pin (set to input for high)
Pauseus 100 ' Wait > 60us
If DQ = 1 Then
'Lcdout $fe, 1, "DS1820 not present"
Pause 500
Goto mainloop ' Try again
Endif
Pauseus 400 ' Wait for end of presence pulse
Return
' Write "command" byte to the DS1820
write1820:
For j = 1 to 8 ' 8 bits to a byte
If command.0 = 0 Then
Gosub write0 ' Write a 0 bit
Else
Gosub write1 ' Write a 1 bit
Endif
command = command >> 1 ' Shift to next bit
Next j
Return
' Write a 0 bit to the DS1820
write0:
Low DQ
Pauseus 60 ' Low for > 60us for 0
DQ_DIR = 1 ' Release data pin (set to input for high)
Return
' Write a 1 bit to the DS1820
write1:
Low DQ ' Low for < 15us for 1
@ nop ' Delay 1us at 4MHz
DQ_DIR = 1 ' Release data pin (set to input for high)
Pauseus 60 ' Use up rest of time slot
Return
' Read temperature from the DS1820
read1820:
For J = 1 to 16 ' 16 bits to a word
temp = temp >> 1 ' Shift down bits
Gosub readbit ' Get the bit to the top of temp
Next J
Return
' Read a bit from the DS1820
readbit:
temp.15 = 1 ' Preset read bit to 1
Low DQ ' Start the time slot
@ nop ' Delay 1us at 4MHz
DQ_DIR = 1 ' Release data pin (set to input for high)
If DQ = 0 Then
temp.15 = 0 ' Set bit to 0
Endif
Pauseus 60 ' Wait out rest of time slot
Return
'================== 7 seg ment display ==============================
disable
display:
VALUE = (temp >>1)
For i = 0 To 3 ' Loop through 4 digits
n = Value Dig i ' Get digit to display
' Gosub display1 ' Display the value
Digits = $ff
Lookup n, [$3F, $06, $5B, $4F, $66, $6D, $7D, $07, $7F, $6F,_
$77, $7C, $39, $5E, $79, $71, $0FF], Segments
Digits = ~Dcd i
NEXT I
INTCON.2 = 0 'clear the interrupt flag
goto mainloop
Resume
enable
End
Bookmarks