[bascom] 7 segment display


From "Rich J." <rjadczak@comcast.net>
Date Wed, 14 Jul 2004 17:01:55 -0400 (Eastern Daylight Time)

Hi all
    I am using MC14489 LCD display driver chip on a Mega32 board. The problem is I can't get it to work with software SPI. The program works with Shiftout but not with Spiout.
 
Example that works:
 
'  MC14489, 7 Segment Display Driver
'  7segdisplay.bas
'  R Jadczak 07/13/04
'  Teckniks.com Maga32 board
 
$crystal = 16000000
$regfile = "m32def.dat"
 
Dim A(3) As Byte , C As Byte
Config Portc = Output
 
C = &B00000001
Reset Portc.6
Shiftout Portc.7 , Portc.5 , C , 1
Set Portc.6
A(1) = &H85                                                 'Upper nibble is brightness and dec point, lower nibble is digit 5
A(2) = &H43                                                 'Upper nibble is digit 4 and lower nibble is digit 3
A(3) = &H21                                                 'Upper nibble is digit 2 and lower nibble is digit 1
Reset Portc.6
Shiftout Portc.7 , Portc.5 , A(1) , 1
Shiftout Portc.7 , Portc.5 , A(2) , 1
Shiftout Portc.7 , Portc.5 , A(3) , 1
Set Portc.6
End
 
 
Example that doesn't work:
 
$regfile = "m32def.dat"
$crystal = 16000000
Config Spi = Soft , Dout = Portc.4 , Ss = Portc.6 , Clock = Portc.5
Config Portc = Output
Dim A(3) As Byte , C As Byte
C = &B00000001
Spiinit
Spiout C , 1
A(1) = &H85                                                 'Upper nibble is brightness and dec point, lower nibble is digit 5
A(2) = &H43                                                 'Upper nibble is digit 4 and lower nibble is digit 3
A(3) = &H21                                                 'Upper nibble is digit 2 and lower nibble is digit 1
Spiinit                                                     'Init SPI state and pins.
Do
Spiout A(1) , 3                                             'send 3 byte
Loop
 
End
 
I know that it must be somethink I did wrong but I can't find it.
 
Bascom AVR 1.11.7.4 Reg.
 
Rich J.
____________________________________________________
  IncrediMail - Email has finally evolved - Click Here