#Picaxe 08M2
#Terminal 4800
#No_Data
Symbol C1 = w1 : Symbol C1.msb = b3 : Symbol C1.lsb = b2
Symbol C2 = w2 : Symbol C2.msb = b5 : Symbol C2.lsb = b4
Symbol C3 = w3 : Symbol C3.msb = b7 : Symbol C3.lsb = b6
Symbol C4 = w4 : Symbol C4.msb = b9 : Symbol C4.lsb = b8
Symbol C5 = w5 : Symbol C5.msb = b11 : Symbol C5.lsb = b10
Symbol C6 = w6 : Symbol C6.msb = b13 : Symbol C6.lsb = b12
Symbol C7 = w9 : Symbol C7.msb = b19 : Symbol C7.lsb = b18
Symbol Pl = w7 : Symbol Pl.msb = b15 : Symbol PI.lsb = b14
Symbol Ph = w8 : Symbol Ph.msb = b17 : Symbol Ph.lsb = b16
'Symbol Tl = w9 : Symbol Tl.msb = b19 : Symbol Tl.lsb = b18
'Symbol Th = w10 : Symbol Th.msb = b21 : Symbol Th.lsb = b20
Symbol CMD_RESET = $1E
Symbol CMD_D1_256 = $40
Symbol CMD_D1_512 = $42
Symbol CMD_D1_1024 = $44
Symbol CMD_D1_2048 = $46
Symbol CMD_D1_4096 = $48
Symbol CMD_D2_256 = $50
Symbol CMD_D2_512 = $52
Symbol CMD_D2_1024 = $54
Symbol CMD_D2_2048 = $56
Symbol CMD_D2_4096 = $58
Symbol CMD_ADC = $00
Symbol CMD_PROM_0 = $A0
Symbol CMD_PROM_1 = $A2
Symbol CMD_PROM_2 = $A4
Symbol CMD_PROM_3 = $A6
Symbol CMD_PROM_4 = $A8
Symbol CMD_PROM_5 = $AA
Symbol CMD_PROM_6 = $AC
Symbol CMD_PROM_7 = $AE
PowerOnReset:
HI2cSetup I2CMASTER, %11101110, I2CSLOW, I2CBYTE
HI2cOut ( CMD_RESET )
Pause 10
HI2cOut ( CMD_PROM_1 ) : HI2cIn ( C1.msb, C1.lsb )
HI2cOut ( CMD_PROM_2 ) : HI2cIn ( C2.msb, C2.lsb )
HI2cOut ( CMD_PROM_3 ) : HI2cIn ( C3.msb, C3.lsb )
HI2cOut ( CMD_PROM_4 ) : HI2cIn ( C4.msb, C4.lsb )
HI2cOut ( CMD_PROM_5 ) : HI2cIn ( C5.msb, C5.lsb )
HI2cOut ( CMD_PROM_6 ) : HI2cIn ( C6.msb, C6.lsb )
HI2cOut ( CMD_PROM_7 ) : HI2cIn ( C7.msb, C7.lsb )
'w10 = 0
MainLoop:
Do
HI2cOut ( CMD_D1_4096 )
Pause 10
HI2cOut ( CMD_ADC )
Pause 10
HI2cIn ( Ph.msb, Ph.lsb, Pl.msb, PI.lsb)
sertxd(#Ph.msb," ",#Ph.lsb," ",#Pl.msb," ",#PI.lsb,cr,lf)
Pause 1000
Loop