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


Results 1 to 36 of 36

Threaded View

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

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

    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


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

    TRISA=%11111111 ' Configura o PortA como Entrada
    TRISB=%00000000 ' Configura o PortB como Saida
    TRISC=%00000000 ' Configura o PortC como Saida

    INTCON2.7 = 1 ; Turn Pull Up Resitor (PORTB Only) 0=Enable/1=Desable
    ADCON1 = %00001111 ; Sets all ports to digital
    PORTA = %11111111 ; Turn on all PortA Porta = 255
    PORTB = %11111111 ; Turn on all PortB Portb = 255
    PORTC = %11111111 ; Turn on all PortC Portc = 255

    Gosub Tm1640_init ' Ajustar o brilho
    pause 100

    main:


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

    goto main

    '************************************************* *****************************
    '*** Rotina TM1640 ***
    '*** ***
    '*** Nós usamos duas variįveis??, a saber: ***
    '*** Seg_nr com um intervalo de 0-15 ***
    '*** Seg_data com um intervalo de 0-16, que tudo> 15 = branco ***
    '************************************************* *****************************
    Tm1640:

    If Seg_nr > 15 Then Return
    If Seg_data > 16 Then Seg_data = 16 ' = Branco

    gosub DesenhaDigito

    Info = 68 ' É dobrado de dados
    Gosub Tm1640_zend

    high Pin_clk : high Pin_data

    Info = Seg_nr + 192 ' nśmero do segmento (+ 192)
    Gosub Tm1640_zend

    Info = Seg_data ' dados do segmento
    Gosub Tm1640_zend


    high Pin_clk : high Pin_data ' Barramento de alta

    Return

    '************************************************* *****************************
    '*** Enviar um byte para o display ***
    '************************************************* *****************************
    Tm1640_zend:

    low Pin_clk : low Pin_data

    For T = 1 To 8
    Test = Info And 1
    if test = 1 then
    high pin_data
    else
    low pin_data
    endif
    info = info >> 1
    high Pin_clk
    low Pin_clk
    Next T

    Return

    '************************************************* *****************************
    '*** INIT - Ajusta o brilho dos display's ***
    '************************************************* *****************************
    Tm1640_init:

    Info = 138 ' 143 = Brilho total, 138 = 4/16e
    Gosub Tm1640_zend

    high Pin_clk : high Pin_data

    Return

    '************************************************* *****************************
    '*** Exibe os nśmeros de 0-16(F) nos 16 display's ***
    '************************************************* *****************************

    DesenhaDigito: 'Sem ponto Decimal
    Lookup Seg_data,[$3F,$6,$5B,$4F,$66,$6D,$7D,$7,$7F,$67,$77,$7C,$58, $5E,$79,$71,0],Seg_data ' Sem Ponto Decimal
    return

    End 'end program


    Regard,
    Joćo Efrem
    Last edited by jefrem; - 23rd July 2013 at 15:03.

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, 13:53
  2. Replies: 2
    Last Post: - 14th July 2008, 22:11
  3. Replies: 2
    Last Post: - 22nd January 2008, 14: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, 18:17
  5. SMART Serial 4 Digit LCD Display (SMARD4)
    By paul borgmeier in forum Adverts
    Replies: 0
    Last Post: - 5th January 2005, 05: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