How to display dot on 7-seg , 4 digit


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Red face

    Quote Originally Posted by paul borgmeier View Post
    I do not need help ... the OP does Anyone is welcome to contribute and chime in.
    Maybe I do need help - I need to sharpen/review my PNP circuit abilites a bit and will comment soon.

    Others welcome to comment.

    EDIT:
    based on an offlist conversation with another member
    Last edited by paul borgmeier; - 28th December 2006 at 19:10.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Sayzer - where did you go ... I thought you were helping me here? .

    Chai98a,
    As Sayzer was hinting at in his "Large" post, if you are using a "standard" common-sized common anode display, you might want to simplify your circuit and follow something like figure 6 of the below link. Your schematic as draw is not correct and makes little sense (to me).

    http://picbasic.com/resources/articles/ledart.htm

    Is this an option or are you locked into your hardware as shown in your earlier post?
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  3. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    We had a long holiday here in Turkey.

    Sorry Paul. I was busy with my .... (fill in the blank).


    I will post some concept schematics, using PNP, NPN and ULN type of drivers.

    -----------------

  4. #4
    Join Date
    May 2005
    Posts
    70


    Did you find this post helpful? Yes | No

    Default

    Now we finish 7 seg display temp form ds1820 about 90%
    But we stil have porblem with display fashing and i have try at 20 Mhz cannot resolve it



    Code:

    Define LOADER_USED 1
    DEFINE OSC 4
    @ Device pic16F877A, 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

    ' Allocate variables
    command var byte ' Storage for command
    J var byte ' Storage for loop counter
    temp var word ' Storage for temperature
    T VAR WORD
    DQ var PORTd.4 ' Alias DS1820 data pin
    DQ_DIR var TRISd.4 ' Alias DS1820 data direction pin
    read_done var byte
    Lastdata var word


    TRISc = $00 ' Set segment pins to output
    TRISd = $f0 ' Set digit pins to output
    TrisB = $00
    Portb = $00
    portd = $ff

    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:
    'goto display
    'Goto 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]
    'T = ((temp>> 1)*100)+((TEMP.0*5)*10)
    'HSEROUT ["Temp = ",dec T ,13,10]
    value = ((temp>> 1)*100)+((TEMP.0*5)*10)
    GOTO DISPLAY
    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 i = 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 i
    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 i = 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 i
    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 ==============================
    display:
    'value = ((temp>> 1)*100)+((TEMP.0*5)*10)

    PORTC = $39
    LOW DIGITS.0
    PAUSEUS 1500
    PORTC = $0

    'value = 125
    For i = 1 To 4 ' 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

    If i = 2 then segments = segments + 128 'Digit 2 show dot

    Digits = ~Dcd i

    NEXT I
    goto mainloop
    End

  5. #5
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    If you have more then 2ms pause in total during the whole process, you will see blinking.

    Have your calculator and start adding your pauses.
    See what the total is.

    Also, remove any repeat routines if any.

    I have no time to check your code.

    Why don't you use an easier DS1820 code by the way?


    ----------------------

  6. #6
    Join Date
    May 2005
    Posts
    70


    Did you find this post helpful? Yes | No

    Default

    Hi sayzer thank you we done after try remove 2 ms out.


    Buy the way we will post this code in exampls code for share with other peple

Similar Threads

  1. Hdsp 21xx display
    By Original in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th June 2012, 20:07
  2. LED Machine Tach For Tired Eyes
    By Archangel in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 27th January 2010, 14:55
  3. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 08:42
  4. DS1820 display with 7-seg 4 digits
    By chai98a in forum Code Examples
    Replies: 12
    Last Post: - 10th April 2008, 13:12
  5. 7 segment digit problem (using Mister E's code)
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th September 2005, 20:25

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts