Re: [bascom] Driving 7 segment displays


From guy daelen <guy.daelen@skynet.be>
Date Sun, 18 Aug 2002 11:39:53 +0200

At 18/08/02 22:02, you wrote:
Hi All,
        Ok, I'll explain!  This display is for Digital Readout  on lathes /
mills etc, the segments are 1" tall for ease of viewing.  Because there are
so many displays, I did not want to multiplex them because I would loose
brightness.

this is part of a program using saa1064
maybe it can help you or maybe it is possible to make more simple

$crystal = 8000000
$baud = 9600


Config Sda = Portb.0
Config Scl = Portb.1

Sync Alias Portd.6

Serin Alias Pinb.4
Parld Alias Portb.3
Sck Alias Portb.2

Const Ad1064 = &H70             'adress i2c saa1064
Const K = "0000"
Const Tsw = &H4E                'adress i2c preset

'global variable
'-----------------
Dim Compteur As Word , Preset As Word
Dim Priorite As Byte , Micro As Byte

'-----should be local to aff1064---------------
Dim P2 As String * 8
Dim P1 As String * 1
Dim N(4) As Byte
Dim Pr As String * 4
Dim I As Byte

'--------saa1064 -------
sub aff1064(affich)
'Local I As Byte
'Local Pr As String * 4
'Local P2 As String * 8
'Local P1 As String * 1
'Local N(4) As Byte
$eeprom
Saa1064:
Data &H77 , &H12 , &H6B , &H5B , &H1E , &H5D , &H7D , &H13 , &H7F , &H5F
'I2creceive Ad1064 , i
'Print "status saa1064=" ; i
'Print "affich " ; Affich
Pr = Str(affich )
P2 = K + Pr
Pr = Right(p2 , 4)
For I = 1 To 4
P1 = Mid(pr , I , 1)
N(i) = Asc(p1)
N(i) = N(i) - 48                'ascii to value
N(i) = Lookup(n(i) , Saa1064)
Next I
'send i2c
I2cstart
I2cwbyte Ad1064
I2cwbyte 0
I2cwbyte &HF7                   'see saa1064 data sheet
I2cwbyte N(1)
I2cwbyte N(2)
I2cwbyte N(3)
I2cwbyte N(4)
I2cstop
 Return

Guy Daelen
Namur
Belgium