View previous topic :: View next topic |
Author |
Message |
Joshua314
Joined: 23 Oct 2006 Posts: 15
|
Posted: Fri Mar 07, 2008 10:43 am Post subject: Need Help MAX7456 |
|
|
Hello @ all,
i have a MAX7456 OSD from Maxim.
I wrote a simple Source for it.
But the source doesn't work.
Have everyone a Idee ???
Thank's Thomas
Code: | '------------------------------------------------------------------
' MAX7456
' (c) DG5MPQ 01/2008
'------------------------------------------------------------------
$regfile = "M8def.dat"
$crystal = 8000000
$baud = 38400
Const Vm0 = &H00 ' Video Mode 0
Const Vm1 = &H01 ' Video Mode 1
Const Hos = &H02 ' Horizontal Offset
Const Vos = &H03 ' Vertical Offset
Const Dmm = &H04 ' Display Memory Mode
Const Dmah = &H05 ' Display Memory Address High
Const Dmal = &H06 ' Display Memory Address Low
Const Dmdi = &H07 ' Display Memory Data In
Const Cmm = &H08 ' Character Memory Mode
Const Cmah = &H09 ' Character Memory Address High
Const Cmal = &H0A ' Character Memory Address Low
Const Cmdi = &H0B ' Character Memory Data In
Const Osdm = &H0C ' Osd Insertion Mux
Const Rb0 = &H10 ' Row 0 Brightness
Const Rb1 = &H11 ' Row 1 Brightness
Const Rb2 = &H12 ' Row 2 Brightness
Const Rb3 = &H13 ' Row 3 Brightness
Const Rb4 = &H14 ' Row 4 Brightness
Const Rb5 = &H15 ' Row 5 Brightness
Const Rb6 = &H16 ' Row 6 Brightness
Const Rb7 = &H17 ' Row 7 Brightness
Const Rb8 = &H18 ' Row 8 Brightness
Const Rb9 = &H19 ' Row 9 Brightness
Const Rb10 = &H1A ' Row 10 Brightness
Const Rb11 = &H1B ' Row 11 Brightness
Const Rb12 = &H1C ' Row 12 Brightness
Const Rb13 = &H1D ' Row 13 Brightness
Const Rb14 = &H1E ' Row 14 Brightness
Const Rb15 = &H1F ' Row 15 Brightness
Const Osdbl = &H6C ' Osd Black Level
Const Stat = &HA0 ' Status
Const Dmdo = &HB0 ' Display Memory Data Out
Const Cmdo = &HC0 'Character Memory Data Out
Mosi Alias Portc.0
Config Mosi = Output
Miso Alias Pinc.1
Config Miso = Input
Sck Alias Portc.2
Config Sck = Output
Cs Alias Portc.3
Config Cs = Output
Res Alias Portb.0
Config Res = Output
Los Alias Pinb.1
Config Los = Input
Declare Sub Max7456out(daten As Byte) ' Schreibt 8 bit zum OSD
Declare Sub Max7456outb(byval Daten_b As Byte)
Declare Sub Max7456cs(byval Was As Byte)
Declare Function Max7456in() As Byte
Print "{013}MAX7456 Test"
Dim Help As Byte
Dim T As Byte
'Do
Print "Reset low"
Reset Res
Waitms 10
Set Res
Waitms 200
Print "Reset hi"
Call Max7456cs(0)
Call Max7456outb(vm0)
'Call Max7456outb(&B01001000) ' 1001100
Call Max7456outb(&H4c) ' 1001100
Call Max7456cs(1)
'(
Call Max7456cs(0)
Call Max7456outb(osdbl)
Print Max7456in() ' 00001001
Call Max7456cs(1)
')
Call Max7456cs(0)
Call Max7456outb(osdbl)
Call Max7456outb(&H07) ' 00001001
Call Max7456cs(1)
Call Max7456cs(0)
Call Max7456outb(dmah)
Call Max7456outb(&H00)
Call Max7456cs(1)
'(
Call Max7456cs(0)
Call Max7456outb(dmm)
Call Max7456outb(&B01000000)
Call Max7456cs(1)
')
Call Max7456cs(0)
Call Max7456outb(dmal)
Call Max7456outb(&H20)
Call Max7456cs(1)
Call Max7456cs(0)
Call Max7456outb(dmdi)
Call Max7456outb(&H0b)
Call Max7456cs(1)
Waitms 5000
'Loop
End
Sub Max7456outb(byval Daten_b As Byte)
Call Max7456out(daten_b) ' Schreibt 8 bit zum OSD
End Sub
Function Max7456in() As Byte ' Schreibt 8 bit zum OSD
For Help = 7 To 0 Step -1 ' Wir haben 8 Bit MSB zu LSB
Set Sck ' Clock anmachen
Print "^";
Reset Sck
Print "!"; ' Clock wieder ausmachen
If Miso > 0 Then ' Ist das Bit gesetzt
Set T.help
Print "1";
Else
Reset T.help
Print "0"; ' oder loeschen
End If
Next Help ' Und weiter
Print ":" ; T ; ":" ; Hex(t);
Max7456in = T
End Function
Sub Max7456out(daten As Byte) ' Schreibt 8 bit zum OSD
Print Daten ; ":" ; Hex(daten) ; ":";
For Help = 7 To 0 Step -1 ' Wir haben 8 Bit MSB zu LSB
If Daten.help > 0 Then ' Ist das Bit gesetzt
Set Mosi ' Dann bit high machen
Print "1";
Else
Reset Mosi
Print "0"; ' oder loeschen
End If
Set Sck ' Clock anmachen
Print "^";
'For T = 1 To 5 : Next T
'Waitms 10
Reset Sck
Print "!"; ' Clock wieder ausmachen
'For T = 1 To 5 : Next T
'Waitms 10
Next Help ' Und weiter
Print " "
End Sub
Sub Max7456cs(byval Was As Byte)
Local I As Byte ' Dummy
If Was = 0 Then
Reset Sck ' Erst mal den Clk nach unten
Reset Cs
Print "!."
Else
Set Cs
Print "'"
End If
End Sub
End |
|
|
Back to top |
|
|
yah996
Joined: 24 Sep 2006 Posts: 31 Location: Bergkirchen
|
|
Back to top |
|
|
pseddon
Joined: 20 Oct 2006 Posts: 84
|
Posted: Sun Aug 10, 2008 4:14 pm Post subject: |
|
|
I don't see a config spi or spiinit statement for a start.
I would suggest you look at the examples for using SPI to see how to read from and write to the SPI port.
regards Peter |
|
Back to top |
|
|
yah996
Joined: 24 Sep 2006 Posts: 31 Location: Bergkirchen
|
Posted: Sun Aug 10, 2008 8:23 pm Post subject: |
|
|
Here is my first code...
I tried to keep it simple. Also i tried SHIFTOUT command. No sucess yet.
$regfile = "M644def.dat"
$crystal = 18432000
$hwstack = 32
$swstack = 32
$framesize = 32
Declare Sub Send_spi
Open "com1:115200,8,n,1" For Binary As #1
Dim B As Byte
Dim Regaddr As Byte
Dim Regdata As Byte
' MAX7456 PIN.8 = Porta.7 ' SPI_CS
' MAX7456 PIN.9 = Porta.4 ' Dion
' MAX7456 PIN.10 = Porta.6 ' SPI_CK
' MAX7456 PIN.11 = Porta.5 ' Dout
Config Spi = Soft , Din = Porta.4 , Dout = Porta.5 , Ss = Porta.7 , Clock = Porta.6
Spiinit ' Init SPI
Print "MAX7456 DEMO"
'01001000' ; 0 , 1=PAL, 00=Auto Sync, 1=Enable OSD, 0=Enable OSD immer, 0=SW RST, 0=Enable Video Buffer
Regaddr = &H00
Regdata = &B01001000
Call Send_spi
'00010100' ; 0 = NA, 001=Background MODE Brightness 7%, 11=Blinking Time 160ms, 00=Blinking Duty Cycle BT:BT
Regaddr = &H01
Regdata = &B00010100
Call Send_spi
'00100000' ; 00=NA, 100000=No Horitzontal offset
Regaddr = &H02
Regdata = &B00100000
Call Send_spi
'00010000' ; 000=NA, 100000=No Vertical Offset
Regaddr = &H03
Regdata = &B00010000
Call Send_spi
Waitms 500
Regaddr = &H05
Regdata = &B00000000
Call Send_spi
Regaddr = &H06
Regdata = &B00000001
Call Send_spi
Regaddr = &H07
Regdata = &B00000001
Call Send_spi
Do
Loop
End
Sub Send_spi
B = Regaddr
Spiout B , 1
B = Regdata
Spiout B , 1
End Sub |
|
Back to top |
|
|
Antony(uk)
Joined: 26 Jun 2006 Posts: 275 Location: Devon UK
|
Posted: Tue Aug 12, 2008 9:18 pm Post subject: |
|
|
Hi
Did you get this working as I have just sent off for my samples.
This would offer a cheap and easy method of On Screen Display.
There are a lot of software samples out there all in "C".
I will wait for my samples before I start on this one.
Regards Antony(UK) |
|
Back to top |
|
|
steffus
Joined: 19 Aug 2007 Posts: 30
|
Posted: Tue Oct 21, 2008 9:33 pm Post subject: |
|
|
Any good news?
Reg
Steffen |
|
Back to top |
|
|
yah996
Joined: 24 Sep 2006 Posts: 31 Location: Bergkirchen
|
Posted: Wed Oct 22, 2008 1:22 pm Post subject: |
|
|
It pretty simple (Here is my basic code to get this working...)
$regfile = "M644def.dat"
$crystal = 18432000
$hwstack = 32
$swstack = 32
$framesize = 32
'** Configuration ****************************************
Declare Sub Send_spi
Declare Sub Read_spi
Open "com1:57600,8,n,1" For Binary As #1
$baud = 115200
Dim In_str As Byte
Dim B As Byte , X As Byte , I As Byte
Dim Regaddr As Byte
Dim Regdata As Byte
Print "MAX7456 ASM SPI-Mode"
Print "www.silicon-racing.com"
print "mail to yah996@yahoo.com to get the complete code""
Config Spi = Hard , , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 128 , Noss = 0
Spiinit
'01001000' ; 0 , 1=PAL, 00=Auto Sync, 1=Enable OSD, 0=Enable OSD immer, 0=SW RST, 0=Enable Video Buffer
Regaddr = &H00
Regdata = &B01001100
Call Send_spi
'00010100' ; 0 = NA, 001=Background MODE Brightness 7%, 11=Blinking Time 160ms, 00=Blinking Duty Cycle BT:BT
Regaddr = &H01
Regdata = &B01110100
Call Send_spi
''00100000' ; 00=NA, 100000=No Horitzontal offset
Regaddr = &H02
Regdata = &B00100000
Call Send_spi
'00010000' ; 000=NA, 100000=No Vertical Offset
Regaddr = &H03
Regdata = &B00100000
Call Send_spi
For I = 1 To 100
Regaddr = &H05
Regdata = &H00
Call Send_spi
Regaddr = &H06
Regdata = I
Call Send_spi
Regaddr = &H07
Regdata = I
Call Send_spi
Next I
Do
Loop ' never reached
End
Sub Send_spi
$asm
lds r17,{Regaddr}
Out Spdr , R17
Waitspi_1:
sbis spsr,7
rjmp WaitSPI_1
lds r17,{Regdata}
Out Spdr , R17
Waitspi_2:
sbis spsr,7
rjmp WaitSPI_2
$end Asm
End Sub
Sub Read_spi
End Sub |
|
Back to top |
|
|
tolisn
Joined: 02 Jul 2005 Posts: 123 Location: Greece
|
Posted: Wed Oct 22, 2008 5:20 pm Post subject: |
|
|
I'm trying to overlay a scale for comparison on a parking camera that I just installed in my car.
I would like it to look something like the photo.
Do you think that it can be done with this chip and Bascom using a ATmega8? |
|
Back to top |
|
|
yah996
Joined: 24 Sep 2006 Posts: 31 Location: Bergkirchen
|
Posted: Wed Oct 22, 2008 6:08 pm Post subject: |
|
|
Yes!
Your Mega needs to have a Hardware SPI and some bytes of RAM. |
|
Back to top |
|
|
tolisn
Joined: 02 Jul 2005 Posts: 123 Location: Greece
|
Posted: Wed Oct 22, 2008 6:50 pm Post subject: |
|
|
Thanks for the reply.
1. Looking at your code above, is the "For I... loop responsible for putting the characters on the screen?
2. Can you put the characters into a desired location on the screen and how ?
While I'm waiting for the sample I though I should do a little homework |
|
Back to top |
|
|
mextal
Joined: 11 May 2006 Posts: 47 Location: The Netherlands
|
Posted: Mon Dec 15, 2008 4:34 pm Post subject: |
|
|
Hello,
I have a project with the max7456 and i have text on screen but if i use de default offset for collum/row the not all charators are visable ??
Has some one a solution for this?
Tiny |
|
Back to top |
|
|
yah996
Joined: 24 Sep 2006 Posts: 31 Location: Bergkirchen
|
Posted: Mon Dec 15, 2008 7:54 pm Post subject: |
|
|
mextal wrote: | Hello,
I have a project with the max7456 and i have text on screen but if i use de default offset for collum/row the not all charators are visable ??
Has some one a solution for this?
Tiny |
Hello,
do you have a picture? What kind of monitor are you using? Real television monitor?
I had some troubles with an PC tv-card...
Greets,
K. |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
Posted: Mon Feb 23, 2009 2:04 pm Post subject: |
|
|
For everybody how is interested i have made some routines for the MAX7456 video overlay in Bascom.
Also included a tool to make your own characters.
Read more HERE.
_________________ www.evertdekker.com Bascom code vault |
|
Back to top |
|
|
Antony(uk)
Joined: 26 Jun 2006 Posts: 275 Location: Devon UK
|
Posted: Mon Feb 23, 2009 3:01 pm Post subject: |
|
|
Hi Evert
That’s so nice...I have been playing with this for sooooo long.
I know I am a pain in the neck...But could you please do a connection drawing or point me in the right direction..
I have been using the BOB4 system But its bulky.
Regards Antony(UK)
B.T.W. is it possible to display a variable directly :- Videotext variable, y , x |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
Posted: Mon Feb 23, 2009 4:13 pm Post subject: |
|
|
Hi Anton,
Schematic is really simple, is the same as in the datasheet. Schematic that i used is attached (login to see)
Connected it with hardware SPI to an M128, so it should work with every AVR with a spi bus. Didn't tested it with software SPI bus.
Of course you can work with variable, variable and text string together must be done in 2 steps. You know that Bascom only want to do 1 think at each line.
Code: |
A= 123
Temptextstring = "Hello world " + A + " greetings"
Videotext Temptextstring , 2 , 3
|
_________________ www.evertdekker.com Bascom code vault |
|
Back to top |
|
|
|