TM1640 (16 digit display) with PicBAsic Pro, possible is? How?


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Location
    Manaus - Brazil
    Posts
    24


    Did you find this post helpful? Yes | No

    Default Re: TM1640 (16 digit display) with PicBAsic Pro, possible is? How?

    [QUOTE=jefrem;121502]Possible is programing TM1640 Display with PicBasic Pro? How???


    I have this code, but does not work. Someone can help me?

    '************************************************* ***************
    '* Name : TM1640-demo.pbp *
    '* Author : Joćo Efrem *
    '* Notice : Copyright (c) 2013 JOĆO EFREM @ 2012 *
    '* : All Rights Reserved *
    '* Date : 22/7/2013 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    CLEAR ; start with clearing the
    DEFINE OSC 48
    DEFINE RESET_ORG 800h

    Seg_nr var Byte
    Seg_data var Byte
    Info var Byte
    T var Byte
    Test var Byte
    Temp var Byte
    LED1 var PORTC.5

    Pin_clk var Portb.0 ' TM1640 clock
    Pin_data var Portb.1 ' TM1640 data

    TRISA=%11111111 ' Port PortA as Input
    TRISB=%00000000 ' Port PortB as Output
    TRISC=%00000000 ' Port PortC as Output

    INTCON2.7 = 1 ; Turn Pull Up Resitor (PORTB Only) 0=Enable/1=Desable
    ADCON1 = %00001111 ; Sets all ports to digital
    PORTA = %00000000 ; Turn off all PortA
    PORTB = %00000000 ; Turn off all PortB
    PORTC = %00000000 ; Turn off all PortC

    Gosub Tm1640_init ' Light Intensity of display
    pause 100

    main:


    For Temp = 0 To 15
    Seg_nr = Temp
    Seg_data = Temp
    Gosub Tm1640
    Next Temp

    TOGGLE LED1 ' This normally functioning LED1

    goto main

    '************************************************* *****************************
    '*** Routin TM1640 ***
    '*** ***
    '*** There two variable. ***
    '*** Seg_nr = display number 0-15 (16 Displays) ***
    '*** Seg_data = Value send for display (7 Segment date) ***
    '************************************************* *****************************
    Tm1640:

    If Seg_nr > 15 Then Return
    If Seg_data > 16 Then Seg_data = 16 ' = Blank Display

    gosub DisplayNumberSegment

    Info = 68
    Gosub Tm1640_zend

    high Pin_clk : high Pin_data

    Info = Seg_nr + 192 ' Display position (+ 192)
    Gosub Tm1640_zend

    Info = Seg_data ' Number date to write in display
    Gosub Tm1640_zend


    high Pin_clk : high Pin_data

    Return

    '************************************************* *****************************
    '*** Send display date and clock Routine ***
    '************************************************* *****************************
    Tm1640_zend:

    low Pin_clk : low Pin_data ' Put low signal in Pin_clk and Pin_data

    For T = 1 To 8 ' Test bitwise and send for 'Pind_data' the state of each bit.
    Test = Info And 1
    if test = 1 then
    high pin_data
    else
    low pin_data
    endif
    info = info >> 1
    high Pin_clk ' Send the pulse clock(Pin_clk) + date(Pin_data)
    low Pin_clk
    Next T

    Return

    '************************************************* *****************************
    '*** INIT - Light Intensity of display Routine ***
    '************************************************* *****************************
    Tm1640_init:

    Info = 138 ' 143 = fully Light Intensity, 138 = 4/16e
    Gosub Tm1640_zend

    high Pin_clk : high Pin_data

    Return

    '************************************************* *****************************
    '*** Show the display numbers 0-16(F) on 16 display ***
    '************************************************* *****************************

    DisplayNumberSegment: 'Display without decimal point
    Lookup Seg_data,[$3F,$6,$5B,$4F,$66,$6D,$7D,$7,$7F,$67,$77,$7C,$58, $5E,$79,$71,0],Seg_data '
    return

    End 'end program

  2. #2
    Join Date
    Aug 2011
    Location
    Manaus - Brazil
    Posts
    24


    Did you find this post helpful? Yes | No

    Default Re: TM1640 (16 digit display) with PicBAsic Pro, possible is? How?

    This is circuit diagram.

    Name:  Esquema_TM1640_Display.JPG
Views: 8924
Size:  52.3 KB
    Last edited by jefrem; - 24th July 2013 at 17:30.

Similar Threads

  1. HSEROUT full 3 digit display of variable howto ?
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th October 2008, 14:53
  2. Replies: 2
    Last Post: - 14th July 2008, 23:11
  3. Replies: 2
    Last Post: - 22nd January 2008, 15:25
  4. How to display dot on 7-seg , 4 digit
    By chai98a in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 19th January 2007, 19:17
  5. SMART Serial 4 Digit LCD Display (SMARD4)
    By paul borgmeier in forum Adverts
    Replies: 0
    Last Post: - 5th January 2005, 06:50

Members who have read this thread : 1

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