📄 big.psm
字号:
; ///////////////
; // //
; // Constants //
; // //
; ///////////////
;-----------------------------------------------------------------------
;
; General constants
;
; CONSTANT ENC_ADR, 54 ; board rev A encoder address
; CONSTANT DEC_ADR, 88 ; board rev A decoder address
; CONSTANT ENC_ADR, 56 ; board rev B encoder address
; CONSTANT DEC_ADR, 8B ; board rev B decoder address
;-----------------------------------------------------------------------
;
; Output port assignments (i.e. port addresses)
;
CONSTANT SCL_pid, 00 ; read or write
CONSTANT SDA_pid, 01 ; read or write
CONSTANT load_bank_adr, 02 ; write only
; 3 isn't used
CONSTANT debug_rg, 04 ; write only
CONSTANT debug_trig, 05 ; write only
CONSTANT I2C_done_pulse, 06 ; write only
;-----------------------------------------------------------------------
;
; Input port assignments (i.e. port addresses)
;
; CONSTANT SCL_pid, 00 read or write
; CONSTANT SDA_pid, 01 read or write
CONSTANT PAL_EN, 02 ; read only
CONSTANT COLOR_BAR_EN, 03 ; read only
CONSTANT GAMMA_SELECT, 04 ; read only
CONSTANT GAMMA_EN, 05 ; read only
CONSTANT SVIDEO_EN, 06 ; read only
CONSTANT uP_DOA, 07 ; read only
CONSTANT yellow_pb, 08 ; read only
CONSTANT blue_pb, 09 ; read only
; ///////////////////////////
; // //
; // Main Driving Routine //
; // //
; ///////////////////////////
address_zero: LOAD s00,00
OUTPUT s00,I2C_done_pulse
CALL chipscope_on
CALL find_I2C_address
CALL encoder_NTSC
CALL decoder_part1_NTSC
CALL decoder_part2_NTSC
CALL read_switches
update_values: CALL switch_changes
CALL wait_for_change
CALL wait_for_stable
JUMP update_values
; /////////////////////////////////////
; // //
; // There are two versions of video //
; // demo board. This code finds //
; // which is correct. //
; /////////////////////////////////////
find_I2C_address: LOAD s0F,00 ; initialize error holder
LOAD s0E,54 ; old board
CALL I2C_start ;
CALL I2C_write ;
CALL I2C_stop ;
XOR s0F,00 ; 00 = PASS AA = FAIL
JUMP Z,old_board ;
LOAD s10,8B ; new board decoder
LOAD s11,56 ; new board encoder
JUMP find_I2C_return ;
old_board: LOAD s10,88 ; old board decoder
LOAD s11,54 ; old board encoder
find_I2C_return: RETURN
; ////////////////////////////////
; // //
; // Values used to put Encoder //
; // chip into color bars //
; // display mode //
; // //
; ////////////////////////////////
encoder_NTSC: LOAD s0A,s11 ; device address
LOAD s0B,01 ; sub address
LOAD s0C,3F ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,02 ; sub address
LOAD s0C,60 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,04 ; sub address
LOAD s0C,40 ; write data value COLORBARS ON
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,05 ; sub address
LOAD s0C,09 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,06 ; sub address
LOAD s0C,01 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0A ; sub address
LOAD s0C,08 ; write data value
CALL I2C_wr_rd ; write and then verify with read
;-----------------------------------------------------------------------
;
; The addresses below must be loaded with the auto increment address
; feature, as suggested in the analog devices data sheet
;
LOAD s0E,s11 ; device address
CALL I2C_start ;
CALL I2C_write ;
LOAD s0E,0C ; sub address
CALL I2C_write ;
LOAD s0E,16 ; data value
CALL I2C_write ;
LOAD s0E,7C ; data value
CALL I2C_write ;
LOAD s0E,F0 ; data value
CALL I2C_write ;
LOAD s0E,21 ; data value
CALL I2C_write ;
CALL I2C_stop ;
RETURN
; ////////////////////////////////
; // //
; // Values used to initialize //
; // decoder (part one) //
; // //
; ////////////////////////////////
decoder_part1_NTSC: LOAD s0A,s10 ; device address
LOAD s0B,00 ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,01 ; sub address
LOAD s0C,80 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,02 ; sub address
LOAD s0C,04 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,03 ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,04 ; sub address
LOAD s0C,8C ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,05 ; sub address
LOAD s0C,40 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,06 ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,07 ; sub address
LOAD s0C,90 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,08 ; sub address
LOAD s0C,80 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,09 ; sub address
LOAD s0C,80 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0A ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0B ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0C ; sub address
LOAD s0C,12 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0D ; sub address
LOAD s0C,88 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0E ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,0F ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,10 ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,11 ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,12 ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,13 ; sub address
LOAD s0C,45 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,14 ; sub address
LOAD s0C,18 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,15 ; sub address
LOAD s0C,60 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,16 ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,17 ; sub address
LOAD s0C,01 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,18 ; sub address
LOAD s0C,00 ; write data value
CALL I2C_wr_rd ; write and then verify with read
LOAD s0B,19 ; sub address
LOAD s0C,10 ; write data value
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -