After entirely too many hours of work . . . behold! The first ever picture taken from a picaxe:
Attachments
-
55 KB Views: 219
setfreq em16
'gameboy camera software
'clk=out7
'Vout on camera = adc0
'reset = out6
'load = out5
'serial_in = out4
'start = out3
symbol gbdata = b0
symbol gbaddr = b1
symbol clk = outpin7
symbol rst = outpin6
symbol load = outpin5
symbol serial = outpin4
symbol start = outpin3
symbol ready = input5
start = 0
w7 = 0
clk = 0
rst = 1
clk = 1
clk = 0
clk = 1
clk = 0
rst = 0
clk = 1
clk = 0
clk = 1
rst = 1
clk = 0
'0x00=z1-z0,O5-O0
'0x04=N,VH1-VH0,G4-G0
'0x0A=C17-C10
'0xFF=C07-C00
'0x01=P7-P0
'0x00=M7-M0
'0x01=X7-X0
'0x07=E3-E0,I,V2-V0
'Set Reg 1 = N,VH1-VH0,G4-G0
gbdata = %00000111
gbaddr = %00000001
gosub send_data
'set Reg 2 = C1 Register (shutter speed)
'gbdata = %00001010
gbdata = 0
gbaddr = %00000010
gosub send_data
'set Reg 3 = C0 Register (shutter speed)
'gbdata = %11111111
gbdata = 20
gbaddr = %00000011
gosub send_data
'set Reg 4 = P7-P0
gbdata = %00000001
gbaddr = %00000100
gosub send_data
'set Reg 5 = M7-M0
gbdata = %00000000
gbaddr = %00000101
gosub send_data
'set Reg 6 = X7-X0
gbdata = %00000001
gbaddr = %00000110
gosub send_data
'set Reg 7 = E3-E0,I,V2-V0
gbdata = %00000111
gbaddr = %00000111
gosub send_data
'set Reg 0 = Z1-Z0,O5-O0
gbdata = %00000000 'no calibration (10=+ calib, 01=- calib), offset of -15*32mV for output
gbaddr = %00000000
gosub send_data
clk =0
clk =1
clk =0
clk =1
start = 1
clk = 1
clk = 0
clk = 1
clk = 0
start = 0
sertxd("waiting...") 'wait for ready signal to go high
waiting:
clk = 1
clk = 0
if ready = 0 then waiting
clk = 1
clk = 0
ptr = 0
for b8 = 0 to 127
for b7 = 0 to 127
clk = 1
readadc 0,@ptrinc
clk = 0
next b7
ptr = 0
for b9=0 to 7
sertxd(#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf,#@ptrinc,cr,lf)
next b9
next b8
sertxd("done")
end
send_data:
load = 0
serial = bit10
clk = 1
clk = 0
serial = bit9
clk = 1
clk = 0
serial = bit8
clk = 1
clk = 0
serial = bit7
clk = 1
clk = 0
serial = bit6
clk = 1
clk = 0
serial = bit5
clk = 1
clk = 0
serial = bit4
clk = 1
clk = 0
serial = bit3
clk = 1
clk = 0
serial = bit2
clk = 1
clk = 0
serial = bit1
clk = 1
clk = 0
serial = bit0
load = 1
clk = 1
clk = 0
load = 0
clk = 1
clk = 0
return
Yup, especially as you are sending as ASCII text with CRLF's. I can understand why you're doing that and it is sensible during debugging and developing and no doubt easier to get the pixel data displayed at present.I think the serial comms are what is killing me time-wise.
You have a point there. The problem is quantifying how much time any particular code combination takes.For the nested for-loops, i was going under the assumption (may be false) that there was some "setup" time assocated with a serout command (had completely forgotten about hser!), so by doing a couple big serouts