Open Source CDROM controller , soft and stuff - diyAudio
Go Back   Home > Forums > Source & Line > Digital Source

Digital Source Digital Players and Recorders: CD , SACD , Tape, Memory Card, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 21st June 2012, 08:35 AM   #1
Jempie is offline Jempie  Indonesia
diyAudio Member
 
Join Date: Jan 2008
Default Open Source CDROM controller , soft and stuff

Danzup, dit you still have some schematic and source
For an cd rom controller

Thanks
  Reply With Quote
Old 21st June 2012, 08:45 AM   #2
danzup is offline danzup  Romania
diyAudio Member
 
danzup's Avatar
 
Join Date: Oct 2007
Location: Bucuresti
Quote:
Originally Posted by Jempie View Post
Danzup, dit you still have some schematic and source
For an cd rom controller

Thanks
For that controller i have only .hex and schematics and NOT the source , but I have on my desk working on a variant of my own with atmega16 , but very very basic and not ready and with bugs . When i will finish the software i do not know now.
I think I will post after finish on diyaudio the firmware for atmega cdrom controller.
__________________
There are not better tube than 6P3S and 6N2P for my ears !
  Reply With Quote
Old 21st June 2012, 08:50 AM   #3
Jempie is offline Jempie  Indonesia
diyAudio Member
 
Join Date: Jan 2008
Danzup, i have some source for cd rom controller
written in bascom there are some bugs mabey you can
use these. Must i post it here
  Reply With Quote
Old 21st June 2012, 08:55 AM   #4
danzup is offline danzup  Romania
diyAudio Member
 
danzup's Avatar
 
Join Date: Oct 2007
Location: Bucuresti
Quote:
Originally Posted by Jempie View Post
Danzup, i have some source for cd rom controller
written in bascom there are some bugs mabey you can
use these. Must i post it here
So cool : i want to see something like this , to compare with my own as I write also firmware in Bascom.
I propose to use this and what I have write myself to make an "Open Source CDROM controller" for diy people .
Ok with you ? Is this a good ideea ?
Sorry MacDLSA1970 for lurking in your thread .
If it is not ok we can make a new thread about it .
__________________
There are not better tube than 6P3S and 6N2P for my ears !
  Reply With Quote
Old 21st June 2012, 09:02 AM   #5
Jempie is offline Jempie  Indonesia
diyAudio Member
 
Join Date: Jan 2008
here the code I have

$regfile = "m8515.dat" ' specify the used micro
$crystal = 8000000 ' used crystal frequency
$hwstack = 60 ' default use 32 for the hardware stack
$swstack = 60 ' default use 10 for the SW stack
$framesize = 60 ' default use 40 for the frame space

Config Rc5 = Pind.2
Config Watchdog = 1024
Stop Watchdog
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.3 , Db5 = Portb.2 , Db6 = Portb.1 , Db7 = Portb.0 , E = Portb.4 , Rs = Portd.4
Config Porta = Input
Config Portc = Input
Config Pinb.0 = Output
Config Pinb.5 = Input
Config Pinb.6 = Input
Config Pinb.7 = Input
Config Pind.0 = Output
Config Pind.1 = Output
Config Pind.3 = Input
Config Pind.5 = Output
Disable Interrupts



Cursor Off

Dim Address As Byte , Command As Byte

Config Portd.3 = Input
Config Rc5 = Pind.2

Enable Interrupts
Do
Getrc5(address , Command)
Command = Command And &B01111111
Cls
Locate 1 , 1
Lcd "ADDRESS " ; Address ; " "
Locate 2 , 1
Lcd "COMMAND " ; Command ; " "
Waitms 50
Loop
End











Diow Alias Portd.0
Dior Alias Portd.1
Zat Alias Portd.5
Intrq Alias Pind.3
W1 Alias Pinb.5
W2 Alias Pinb.6
W3 Alias Pinb.7

Dim Conf As Byte
Dim Dane_l As Byte
Dim Dane_h As Byte
Dim Error As Byte
Dim Status As Byte
Dim Dlug_pak As Byte
Dim I As Byte
Dim J As Byte
Dim Flaga1 As Bit
Dim Flaga2 As Bit
Dim Flaga3 As Bit
Dim Flaga4 As Bit
Dim Pakiet(16) As Byte
Dim Ilosc_track As Byte
Dim P_m As Byte
Dim P_s As Byte
Dim P_f As Byte
Dim K_m As Byte
Dim K_s As Byte
Dim K_f As Byte
Dim Track As Byte
Dim Track_temp As Byte
Dim Track_odtw As Byte
Dim Temp1 As Byte
Dim Temp2 As Byte
Dim Temp3 As Byte
Dim Temp4 As Byte
Dim Abs_m As Byte
Dim Abs_s As Byte
Dim Abs_f As Byte
Dim Rel_m As Byte
Dim Rel_s As Byte
Dim Rel_f As Byte
Dim Aud_stat As Byte
Dim Pause_s As Byte
Dim Pause_f As Byte
Dim Tmp1_m As Byte
Dim Tmp2_s As Byte
Dim Tmp3_f As Byte
Dim Tmp4_m As Byte
Dim Tmp5_s As Byte
Dim Tmp6_f As Byte
Dim Kon_m As Byte
Dim Kon_s As Byte
Dim Kon_f As Byte
Dim Fr_c As Byte
Dim Kod_kl As Byte
Dim N As Byte
Dim Tmp_w1 As Byte
Dim Tmp_w2 As Byte
Dim Tmp_w3 As Byte
Dim Tmp_w4 As Byte
Dim Napis As String * 5
Dim Z_nap As Bit
Dim Czas As Bit
Dim S_czyt As Bit
Dim Zm_pause As Byte
Dim Zm_track As Bit
Dim K_tr As Byte
Dim Przewin As Byte
Dim Address As Byte
Dim Command As Byte

Declare Sub Write_1b
Declare Sub Write_2b
Declare Sub Read_1b
Declare Sub Read_2b
Declare Sub Pob_h_r
Declare Sub Pob_l_r
Declare Sub Wys_h_r
Declare Sub Wys_l_r
Declare Sub Wys_kom_reg
Declare Sub Pob_dane
Declare Sub Wys_dane2b
Declare Sub Wys_dane1b
Declare Sub Wys_wyb_nap
Declare Sub Pob_wyb_nap
Declare Sub Pob_err
Declare Sub Pob_int
Declare Sub Pob_stat
Declare Sub Init_cd
Declare Sub Bsy_czek
Declare Sub Bsy_drdy_czek
Declare Sub Csa
Declare Sub Ident_nap
Declare Sub Czek_int
Declare Sub Blad_cd
Declare Sub Reszt_dan
Declare Sub Czek_az_got
Declare Sub Test_got_cmd
Declare Sub Zer_pak
Declare Sub Drq_czek
Declare Sub Ndrq_czek
Declare Sub Wysl_pak
Declare Sub Odczyt_toc
Declare Sub Blad_pak
Declare Sub Odczyt_dan_toc
Declare Sub Pob_msf
Declare Sub Odczyt_subchan
Declare Sub Pob_dan_subchan
Declare Sub Pause_track
Declare Sub Play_track
Declare Sub Stop_track
Declare Sub Odejmij_czas
Declare Sub Forma_czas
Declare Sub Klawiatura
Declare Sub Wyswietl
Declare Sub Warunki_play
Declare Sub Zatrzasnij

Porta = 0
Portc = 0
Set Portb.5
Set Portb.6
Set Portb.7
Reset Zat

Status = 0
Error = 0
Conf = 0
Track = 1
Zm_pause = 1
Zm_track = 0
K_tr = 1

Set Diow
Set Dior
Set Portd.2
Cls
Cursor Off
Wait 1
Cls
Call Init_cd 'initaliseren drive
Call Ident_nap 'identificatie drive

Poczatek: 'main program
Tmp_w1 = 0
Tmp_w2 = 0
Tmp_w3 = 0
Tmp_w4 = 0
Fr_c = 1
Cls
Wait 1
Track = 1
Call Czek_az_got 'read drives
If Flaga1 = 0 Then 'read disk read1=0 to stop
Lcd "No Disc1"
End If
Do
Call Czek_az_got
Loop Until Flaga1 = 1
Cls
Call Odczyt_toc 'reading content on cd
Pause_s = P_s 'time between song
Pause_f = P_f
Track = Ilosc_track 'number of tracks
Call Odczyt_toc
Kon_m = K_m 'record end of cd
Kon_s = K_s
Kon_f = K_f
Tmp1_m = Kon_m
Tmp2_s = Kon_s
Track_odtw = Ilosc_track
Czas = 1
Call Wyswietl 'display date on cd
Wait 2 'total numbers of songs
Tr_1: 'total time cd
Przewin = 0 '2 sec
S_czyt = 0
Zm_pause = 1
Zm_track = 0
Track = 1
Call Odczyt_toc
Call Odczyt_subchan
Track_odtw = Track
Z_nap = 1
Czas = 0
Napis = "Stop"
Call Wyswietl
Do 'main loop program
If S_czyt = 0 Then
Call Odczyt_subchan 'reading sub channel of date song
If Aud_stat = &H11 Then 'and the time path of relative and absolute
Call Stop_track
End If
Track_odtw = Track
End If
Call Klawiatura 'keybord support
Enable Interrupts
Command = 0
Getrc5(address , Command) 'remote control RC5
Command = Command And &B10111111
Select Case Command
Case 1 : Kod_kl = 53 '163
Case 2 : Kod_kl = 195
Case 3 : Kod_kl = 162
Case 4 : Kod_kl = 99
Case 5 : Kod_kl = 161
Case 6 : Kod_kl = 194
Case 7 : Kod_kl = 98
Case 8 : Kod_kl = 193
Case 9 : Kod_kl = 97
End Select
Disable Interrupts
If Temp4 <> Kod_kl Then 'manual press button
Temp4 = Kod_kl
If Kod_kl = 53 Then 'support play button
Przewin = 0
Call Odczyt_subchan
If S_czyt = 0 Then
Call Play_track
Call Odczyt_subchan
If Aud_stat = &H11 Then
Z_nap = 1
S_czyt = 1
Napis = "Play "
Tmp_w1 = 100
Tmp_w2 = 100
Tmp_w3 = 100
Tmp_w4 = 100
Czas = 1
End If
End If
If Aud_stat = &H12 And S_czyt = 1 Then
Zm_pause = 1
Call Pause_track
Call Odczyt_subchan
If Aud_stat = &H11 Then
Z_nap = 1
Napis = "Play "
If Zm_track = 1 Then
Zm_track = 0
Call Play_track
End If
End If
End If
End If
If Kod_kl = 161 Then 'staff time display select key
Incr Fr_c
If Fr_c = 5 Then
Fr_c = 1
End If
End If
If Kod_kl = 193 Then 'staff to select the parameters playing a key paths

Incr K_tr
Z_nap = 1
If K_tr = 4 Then
K_tr = 1
End If
End If
If Kod_kl = 97 And S_czyt = 1 Then 'fast forward
Przewin = 1
End If
If Kod_kl = 98 And S_czyt = 1 Then 'fast backward
Przewin = 2
End If
If Kod_kl = 162 Then 'STOP
Call Odczyt_toc
Przewin = 0
Call Stop_track
Call Odczyt_subchan
If Aud_stat = &H12 Then
If S_czyt = 0 Then
Goto Tr_1
End If
Z_nap = 1
S_czyt = 0
Napis = "Stop "
Czas = 0
End If
End If
If Kod_kl = 195 Then 'PAUSE
Call Odczyt_subchan
Track_odtw = Track
If Aud_stat = &H11 Then
Zm_pause = 0
Call Pause_track
Z_nap = 1
Napis = "Pause"
End If
If Aud_stat = &H12 And S_czyt = 1 Then
Zm_pause = 1
Call Pause_track
Call Odczyt_subchan
If Aud_stat = &H11 Then
Z_nap = 1
Napis = "Play "
If Zm_track = 1 Then
Zm_track = 0
Call Play_track
End If
End If
End If
End If
If Kod_kl = 194 Then 'next track
Incr Track
If Track > Ilosc_track Then
Track = Ilosc_track
Else
Przewin = 0
Call Odczyt_toc
Track_odtw = Track
If S_czyt = 1 And Zm_pause = 1 Then
Call Play_track
End If
End If
If Zm_pause = 0 Then
Call Play_track
Do
Call Odczyt_subchan
Loop Until Track = Track_odtw
Call Stop_track
Zm_track = 1
End If
End If
If Kod_kl = 99 Then 'previous track
If Rel_s <= 1 Or S_czyt = 0 Then
Decr Track
End If
If Track = 0 Then
Track = 1
End If
Przewin = 0
Call Odczyt_toc
Track_odtw = Track
If S_czyt = 1 And Zm_pause = 1 Then
Call Play_track
End If
If Zm_pause = 0 Then
Call Play_track
Do
Call Odczyt_subchan
Loop Until Track = Track_odtw
Call Stop_track
Zm_track = 1
End If
End If
End If
If Aud_stat = &H11 And S_czyt = 0 Then
Call Stop_track
Czas = 0
End If
If S_czyt = 1 Then
Call Odczyt_subchan
Call Forma_czas
End If
If Przewin <> 0 And Zm_pause = 1 Then 'instruction fast
If Przewin = 1 Then
Incr P_s 'forward
Incr P_s
Incr P_s
P_f = 0
If P_s >= 59 Then
Incr P_m
P_s = 0
End If
If P_s >= K_s And P_m >= K_m Then
Call Stop_track
Aud_stat = &H15
Else
Call Play_track
Czas = 1
End If
Else
Decr P_s 'rewind
Decr P_s
Decr P_s
If P_s > 59 Then
Decr P_m
P_s = 59
End If
If P_m > 100 Then
P_m = 0
P_s = 0
P_f = 0
End If
Call Play_track 'scrol back
Call Odczyt_subchan 'settings
If Track <> Track_odtw Or P_m = 0 Then 'button typ libary
If Track <> Track_odtw Then
P_m = 0
P_s = 0
P_f = 0
End If
If P_s < 4 Or P_s > 100 Then
Call Stop_track
If K_tr = 3 Then
Track = Rnd(ilosc_track)
Incr Track
Else
Decr Track
If Track = 0 Then
If K_tr = 1 Then
Track = 1
Goto Tr_1
End If
If K_tr = 2 Then
Track = Ilosc_track
End If
End If
End If
Call Odczyt_toc
P_m = K_m
P_s = K_s - 1
P_s = P_s - Pause_s
End If
Else
Call Play_track
Czas = 1
End If
End If
Waitms 50
End If
Call Warunki_play 'procedure for handling different modes of play and play correctly

Call Wyswietl 'displays data on the playing song
Call Czek_az_got 'checks whether the disc is not removed it
If Flaga1 = 0 Then
Goto Poczatek
End If
Loop

End

Sub Warunki_play '
If Aud_stat = &H15 And S_czyt = 1 Then 'The procedure for realizing various functions of play and taking care of the correct order of the tracks

If Przewin <> 0 Then
Waitms 800
End If
If K_tr = 1 Then 'mode 1
Incr Track
If Track > Ilosc_track Then
Goto Tr_1
End If
End If
If K_tr = 2 Then 'mode 2
Incr Track
If Track > Ilosc_track Then
Track = 1
End If
End If
If K_tr = 3 Then 'mode 3
Track = Rnd(ilosc_track)
Incr Track
End If
Call Odczyt_toc
Call Play_track
Czas = 1
End If
End Sub

Sub Wyswietl 'display data
If Track_odtw <> Tmp_w1 Then
Locate 1 , 1
Lcd "Track:"
Locate 1 , 8
If Track_odtw < 10 Then
Lcd Bcd(track_odtw)
Else
Lcd Track_odtw
End If
Tmp_w1 = Track_odtw
End If
If Czas = 1 Then
If Fr_c <> Tmp_w4 Then
Locate 1 , 11
If Fr_c = 2 Or Fr_c = 4 Then
Lcd "-"
Else
Lcd " "
End If
Tmp_w4 = Fr_c
End If
If Tmp1_m <> Tmp_w3 Then
Locate 1 , 12
If Tmp1_m < 10 Then
Lcd Bcd(tmp1_m)
Else
Lcd Tmp1_m
End If
Lcd ":"
Tmp_w3 = Tmp1_m
End If
If Tmp2_s <> Tmp_w2 Then
Locate 1 , 15
If Tmp2_s < 10 Then
Lcd Bcd(tmp2_s)
Else
Lcd Tmp2_s
End If
Tmp_w2 = Tmp2_s
End If
Else
Locate 1 , 11
Lcd " "
End If
If Z_nap = 1 Then
Locate 2 , 1
Z_nap = 0
Lcd Napis
Locate 2 , 11
Select Case K_tr
Case 1 : Lcd "Normal"
Case 2 : Lcd "Repeat"
Case 3 : Lcd "Random"
End Select
End If
End Sub

Sub Klawiatura 'key support
Conf = Conf Or &B11100000
Kod_kl = 0
For N = 1 To 3
Select Case N
Case 1:
Reset Conf.5
Case 2:
Set Conf.5
Reset Conf.6
Case 3:
Set Conf.6
Reset Conf.7
End Select
Ddra = &B11111111
Porta = Conf
Set Zat
Waitms 1
Reset Zat
Ddra = &B00000000
If W1 = 0 Then
Kod_kl = 1
Exit For
Elseif W2 = 0 Then
Kod_kl = 2
Exit For
Elseif W3 = 0 Then
Kod_kl = 3
Exit For
End If
Next N
If Kod_kl <> 0 Then
N = Conf And &B11100000
Kod_kl = Kod_kl + N
End If
Waitms 10
End Sub

Sub Ident_nap 'drive identification
Dane_l = &H02
Call Wys_h_r
Dane_l = &H00
Call Wys_l_r
Dane_l = &HA1
Call Wys_kom_reg
Call Czek_int
Call Pob_dane 'reading the data packet length
If Dane_l.0 = 0 And Dane_l.1 = 0 Then
Dlug_pak = 12
End If
If Dane_l.0 = 0 And Dane_l.1 = 1 Then
Dlug_pak = 16
End If
For I = 1 To 26 'Data collection and display the model name of the CD-ROM
Call Pob_dane
Next I
Cls
Locate 1 , 16
For I = 1 To 20
Call Pob_dane
If Dane_h <> 0 Then
Lcd Chr(dane_h)
Else
Lcd " "
End If
Waitms 150
Shiftlcd Left
If Dane_l <> 0 Then
Lcd Chr(dane_l)
Else
Lcd " "
End If
Waitms 150
Shiftlcd Left
Next I
Cls
Call Reszt_dan
Call Bsy_drdy_czek
End Sub

Sub Czek_int 'wait until the line break will be a high state
Do
Set Portd.3
Loop Until Intrq = 1
End Sub

Sub Reszt_dan 'Get the rest of unnecessary data
Do
Call Pob_stat
If Status.3 = 0 Then
Exit Do
End If
Call Pob_dane
Loop
End Sub

Sub Csa 'choise of line
Reset Conf.3
Set Conf.4
End Sub

Sub Init_cd 'Ini drive
Call Bsy_czek
Call Pob_wyb_nap
Reset Dane_l.4
Call Wys_wyb_nap
Call Bsy_czek
Call Pob_l_r
If Dane_l <> &H14 Then
Call Blad_cd
End If
Call Pob_h_r
If Dane_l <> &HEB Then
Call Blad_cd
End If
Dane_l = &H90 'sending commands drive diagnostics

Call Wys_kom_reg
Call Bsy_czek
Call Pob_err
If Error.0 = 0 Then
Call Blad_cd
End If
End Sub

Sub Bsy_czek 'Wait until busy bit BSY status register will be low
Do
Delay
Call Pob_stat
Loop Until Status.7 = 0
End Sub

Sub Pob_stat 'get status register
Set Conf.0 'setting line da0
Set Conf.1 'da1
Set Conf.2 'da2
Call Csa
Call Zatrzasnij
Call Read_1b
Status = Dane_l
End Sub

Sub Pob_int 'download registry causes interrupt
Reset Conf.0
Set Conf.1
Reset Conf.2
Call Csa
Call Zatrzasnij
Call Read_1b
End Sub

Sub Pob_err 'download registry errors
Set Conf.0
Reset Conf.1
Reset Conf.2
Call Csa
Call Zatrzasnij
Call Read_1b
Error = Dane_l
End Sub

Sub Pob_wyb_nap 'register read selection drive
Reset Conf.0
Set Conf.1
Set Conf.2
Call Csa
Call Zatrzasnij
Call Read_1b
End Sub

Sub Wys_wyb_nap 'Writing to the registry drive choice
Reset Conf.0
Set Conf.1
Set Conf.2
Call Csa
Call Zatrzasnij
Call Write_1b
End Sub

Sub Wys_dane1b 'wyslanie 1 bajta danych
Reset Conf.0
Reset Conf.1
Reset Conf.2
Call Csa
Call Zatrzasnij
Call Write_1b
End Sub

Sub Wys_dane2b 'wyslanie slowa danych (slowo = 2 bajty)
Reset Conf.0
Reset Conf.1
Reset Conf.2
Call Csa
Call Zatrzasnij
Call Write_2b
End Sub

Sub Pob_dane 'Pobranie slowa danych
Reset Conf.0
Reset Conf.1
Reset Conf.2
Call Csa
Call Zatrzasnij
Call Read_2b
End Sub

Sub Wys_kom_reg 'zapis do rejestru komend
Set Conf.0
Set Conf.1
Set Conf.2
Call Csa
Call Zatrzasnij
Call Write_1b
End Sub

Sub Wys_h_r 'Wyslanie do licznika MSB bajta slowa
Set Conf.0
Reset Conf.1
Set Conf.2
Call Csa
Call Zatrzasnij
Call Write_1b
End Sub

Sub Wys_l_r 'Wyslanie do licznika LSB bajta slowa
Reset Conf.0
Reset Conf.1
Set Conf.2
Call Csa
Call Zatrzasnij
Call Write_1b
End Sub

Sub Pob_l_r 'Pobranie od licznika LSB bajta slowa
Reset Conf.0
Reset Conf.1
Set Conf.2
Call Csa
Call Zatrzasnij
Call Read_1b
End Sub

Sub Pob_h_r 'Pobranie od licznika MSB bajta slowa
Set Conf.0
Reset Conf.1
Set Conf.2
Call Csa
Call Zatrzasnij
Call Read_1b
End Sub

Sub Zatrzasnij 'Zatrzasniecie danych w zatrzasku U3
Ddra = &B11111111
Porta = Conf
Set Zat
Waitms 1
Reset Zat
Ddra = &B00000000
End Sub

Sub Read_1b 'Odczyt 1 bajta danych
Porta = 0
Reset Dior
Delay
Dane_l = Pina
Set Dior
End Sub

Sub Read_2b 'Odczyt slowa
Porta = 0
Portc = 0
Reset Dior
Dane_l = Pina
Dane_h = Pinc
Set Dior
End Sub

Sub Write_1b 'Wyslanie 1 bajta danych
Ddra = &B11111111
Porta = Dane_l
Reset Diow
Delay
Set Diow
Ddra = &B00000000
Porta = 0
End Sub

Sub Write_2b 'Wyslanie slowa
Ddra = &B11111111
Ddrc = &B11111111
Porta = Dane_l
Portc = Dane_h
Reset Diow
Delay
Set Diow
Ddra = &B00000000
Ddrc = &B00000000
Porta = 0
Portc = 0
End Sub

Sub Bsy_drdy_czek 'czekaj az bsy=0 oraz drdy=1
Do
Delay
Waitms 50
Call Pob_stat
Loop Until Status.7 = 0 And Status.6 = 1
End Sub

Sub Czek_az_got 'Czekaj az naped gotowy do odtwarzania
For I = 1 To 2 'warunek spelniony jezeli wlozona zostanie plyta CD
Call Test_got_cmd
Next I
End Sub

Sub Drq_czek 'czekaj az drq=1
Do
Waitms 1
Call Pob_stat
Loop Until Status.7 = 0 And Status.3 = 1
End Sub

Sub Ndrq_czek 'czekaj az drq=0
Do
Delay
Call Pob_stat
Loop Until Status.7 = 0 And Status.3 = 0
End Sub

Sub Test_got_cmd 'testuje gotowosc napedu do odtwarzania plyty CD
Call Zer_pak
Call Wysl_pak
If Status.0 = 0 Then
Flaga1 = 1
Else
Flaga1 = 0
End If
End Sub

Sub Zer_pak 'zeruje dane pakietu do wyslania
For J = 1 To 16 'oraz inicjalizuje przesylanie pakietu
Pakiet(j) = 0
Next J
Call Ndrq_czek
Dane_l = &HA0
Call Wys_kom_reg
End Sub

Sub Wysl_pak 'wyslanie pakietu danych
'If Przewin <> 0 Then
'Call Drq_czek
'End If
For J = 1 To Dlug_pak Step 2
Dane_l = Pakiet(j)
Dane_h = Pakiet(j + 1)
Call Wys_dane2b
Next J
Call Czek_int
Call Pob_stat
End Sub

Sub Odczyt_subchan 'odczyt podkanalu
Dane_l = &HFF
Call Wys_l_r
Call Wys_h_r
Call Zer_pak
Pakiet(1) = &H42
Pakiet(2) = &H02
Pakiet(3) = &H40 ' Subq = 1
Pakiet(4) = &H01
Pakiet(8) = &HFF
Pakiet(9) = &HFF
Call Wysl_pak
If Status.0 = 1 Then
'Call Blad_pak
Reset Flaga3
Exit Sub
End If
If Status.3 = 1 Then
Call Pob_dan_subchan
Else
Reset Flaga3
End If
End Sub

Sub Pob_dan_subchan 'Pobiera dane podkanalu
Call Pob_dane
Aud_stat = Dane_h
Call Pob_dane
Call Pob_dane
Call Pob_dane
Track_odtw = Dane_l
Call Pob_msf
Abs_m = Temp1
Abs_s = Temp2
Abs_f = Temp3
Call Pob_msf
Rel_m = Temp1
Rel_s = Temp2
Rel_f = Temp3
Call Reszt_dan
Set Flaga3
End Sub

Sub Odczyt_toc 'odczyt tablicy zawartoci wlozonego CD
Dane_l = &HFF
Call Wys_l_r
Call Wys_h_r
Call Zer_pak
Pakiet(1) = &H43
Pakiet(2) = &H02
Pakiet(8) = &HFF
Pakiet(9) = &HFF
Call Wysl_pak
If Status.0 = 1 Then
'Call Blad_pak
Reset Flaga2
'Exit Sub
End If
If Status.3 = 1 Then
Call Odczyt_dan_toc
Else
Reset Flaga2
End If
End Sub

Sub Odczyt_dan_toc 'odczyt danych z tablicy zawartosci
Call Pob_dane
Call Pob_dane
Ilosc_track = Dane_h
Do
Call Pob_dane
Call Pob_dane
Track_temp = Dane_l
Call Pob_msf
Loop Until Track = Track_temp
P_m = Temp1
P_s = Temp2
P_f = Temp3
Call Pob_dane
Call Pob_dane
Call Pob_dane
K_m = Dane_h
Call Pob_dane
K_s = Dane_l
K_f = Dane_h
Call Bsy_czek
Do
If Status.3 = 1 Then
Call Pob_dane
Call Pob_dane
Call Pob_dane
Call Pob_dane
End If
Call Bsy_czek
Loop Until Status.3 = 0
Flaga2 = 1
If K_f < Pause_f Then
If K_s = 0 Then
Decr K_m
K_s = K_s + 60
End If
Decr K_s
K_f = K_f + 75
End If
K_f = K_f - Pause_f
If K_s < Pause_s Then
Decr K_m
K_s = K_s + 60
End If
K_s = K_s - Pause_s
End Sub

Sub Pob_msf 'pobranie danych typu MSF
Call Pob_dane
Temp1 = Dane_h
Call Pob_dane
Temp2 = Dane_l
Temp3 = Dane_h
Call Bsy_czek
End Sub

Sub Blad_pak 'Procedura okreslajaca blad podczas wysylania pakietu danych
Cls 'byla wykorzystywana tylko podczas testowania
Lcd "Blad pak nr: " 'programu
Call Pob_err
Locate 1 , 14
Lcd Hex(error) : Lcd "h"
Wait 3
End Sub

Sub Blad_cd 'Blad komunikacji z CD-ROM
Cls
Lcd "Blad komunikacji"
Wait 2
Goto Poczatek
End Sub

Sub Play_track 'Odtwarzanie okreslonej sciezki
Call Zer_pak
Pakiet(1) = &H47
Pakiet(4) = P_m 'poczatek sciezki
Pakiet(5) = P_s
Pakiet(6) = P_f
Pakiet(7) = K_m 'koniec sciezki
Pakiet(8) = K_s
Pakiet(9) = K_f
Call Wysl_pak
If Status.0 = 0 Then
Set Flaga4
Else
Reset Flaga4
End If
End Sub

Sub Pause_track 'wyslanie pakietu danych pausy
Call Zer_pak
Pakiet(1) = &H4B
Pakiet(9) = Zm_pause
Call Wysl_pak
If Status.0 = 0 Then
Set Flaga4
Else
Reset Flaga4
End If
End Sub

Sub Stop_track 'Wyslanie pakietu stop sciezki
Call Zer_pak
Pakiet(1) = &H4E
Call Wysl_pak
If Status.0 = 0 Then
Set Flaga4
Else
Reset Flaga4
End If
End Sub

Sub Odejmij_czas 'procedura odejmowania dwoch czasow
If Tmp1_m = Tmp4_m And Tmp5_s => Tmp2_s Then
Tmp1_m = 0
Tmp2_s = 0
Tmp3_f = 0
Else
Tmp1_m = Tmp1_m - Tmp4_m
If Tmp3_f < Tmp6_f Then
If Tmp2_s = 0 Then
Decr Tmp1_m
Tmp2_s = Tmp2_s + 60
End If
Decr Tmp2_s
Tmp3_f = Tmp3_f + 75
End If
Tmp3_f = Tmp3_f - Tmp6_f
If Tmp2_s < Tmp5_s Then
Decr Tmp1_m
Tmp2_s = Tmp2_s + 60
End If
Tmp2_s = Tmp2_s - Tmp5_s
End If
End Sub

Sub Forma_czas 'Procedura wyboru formatu pokazywanego czasu
Select Case Fr_c
Case 1:
Tmp1_m = Rel_m
Tmp2_s = Rel_s
Tmp3_f = Rel_f
Case 2:
Tmp1_m = K_m
Tmp2_s = K_s
Tmp3_f = K_f
Tmp4_m = Abs_m
Tmp5_s = Abs_s
Tmp6_f = Abs_f
Call Odejmij_czas
Case 3:
Tmp1_m = Abs_m
Tmp2_s = Abs_s - 1
Tmp3_f = Abs_f
Case 4:
Tmp1_m = Kon_m
Tmp2_s = Kon_s
Tmp3_f = Kon_f
Tmp4_m = Abs_m
Tmp5_s = Abs_s
Tmp6_f = Abs_f
Call Odejmij_czas
End Select
End Sub
  Reply With Quote
Old 21st June 2012, 01:01 PM   #6
danzup is offline danzup  Romania
diyAudio Member
 
danzup's Avatar
 
Join Date: Oct 2007
Location: Bucuresti
Default Open Source CDROM controller , soft and stuff

I open another thread for people to build their own cd rom controller for clone :
DIY CD-Player "Audio Analogue - like" or Unison Unico CD player like , wich use computer CD rom unit and some microcontroller to have CD player function. Output in spdif form .
On e-bay there are a lot of various CDROM Controller Kit for sale but this will be with software open source, for people to change the firmware for their whishes.
We will try to do our best here but in the end expect nothing....
So let`s begin.
Some threads that are related to this :
Open Source CDROM controller , soft and stuff
__________________
There are not better tube than 6P3S and 6N2P for my ears !

Last edited by danzup; 21st June 2012 at 01:10 PM.
  Reply With Quote
Old 18th July 2012, 09:15 PM   #7
danzup is offline danzup  Romania
diyAudio Member
 
danzup's Avatar
 
Join Date: Oct 2007
Location: Bucuresti
Default Schematics used by me and firmware with RC5 rewrited

I have modified a little the schematics used and also i do replaced the Bascom AVR rc5 routines with another using Timer0 for remote RC5 to work.
Click the image to open in full size.
I am using Spdif attenuator : 2 x 75 ohm one in series with signal one to ground.
CD-ROM used : TEAC CD-54 and TEAC CD-52W .
Attached Images
File Type: jpg ide controller.jpg (260.8 KB, 384 views)
Attached Files
File Type: zip Odt_cd2NEW.zip (42.6 KB, 139 views)
__________________
There are not better tube than 6P3S and 6N2P for my ears !

Last edited by danzup; 18th July 2012 at 09:21 PM.
  Reply With Quote
Old 11th September 2012, 02:06 AM   #8
diyAudio Member
 
Join Date: Mar 2007
Location: Bandung
Default PCB

My PCB layout, single side with many jumper

Didiet
Attached Files
File Type: pdf Danzup PCB.pdf (63.2 KB, 146 views)
  Reply With Quote
Old 4th December 2012, 07:33 AM   #9
diyAudio Member
 
Join Date: Mar 2007
Location: Bandung
Sorry to brought up old thread. Danzup do you have additional code for eject/close cdrom tray ?

Didiet
  Reply With Quote
Old 4th December 2012, 07:58 AM   #10
danzup is offline danzup  Romania
diyAudio Member
 
danzup's Avatar
 
Join Date: Oct 2007
Location: Bucuresti
Quote:
Originally Posted by didiet78 View Post
Sorry to brought up old thread. Danzup do you have additional code for eject/close cdrom tray ?

Didiet
This schematics not ,as the uC Atmega8515 flash is full and nothing cannot be added to firmware.
Here i was using the switch of CD-Rom for eject/close tray of CD.
I am working for some time on a Atmega16 version with more enhancements but still on halt and no time to finish.
Now I am involved in some other projects and do not know when I will be ready with the new firmware .
Maybe next year ?
__________________
There are not better tube than 6P3S and 6N2P for my ears !

Last edited by danzup; 4th December 2012 at 08:02 AM.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Another CDROM Controller Kit pradit_p Swap Meet 173 3rd January 2014 08:46 AM
Samsung 1602VFD For CDROM Controller & Remote Volume Controller slowgay Swap Meet 2 22nd November 2008 02:44 PM
CDROM controller muka Swap Meet 17 11th January 2006 08:12 PM
Help with Multi-cdrom controller lapda Digital Source 4 8th February 2004 12:49 AM


New To Site? Need Help?

All times are GMT. The time now is 11:39 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2