程序如下: 可以测试到1621的BZ脚输出的是2KHZ的方法,其它脚无反应,请大家给点建议 DISPLAY: BC CS_HT1621 ;CS=0 CALL YSA ;延时 BS CS_HT1621 ;CS=1 CALL YSA BC CS_HT1621 ;CS=0 CALL YSA MOV A,@0X80 ;初始化 CALL SEND_BIT3_COMMAND ;发送100 ,命令模式 MOV A,@0B00011000 ;SYSTEM RC 256K CALL SEND_BYTE_COMMAND MOV A,@0B00101001 ;BIAS 1/3 4 COMMONS CALL SEND_BYTE_COMMAND MOV A,@0B00000001 ;SYS EN CALL SEND_BYTE_COMMAND MOV A,@0B00001001 ;TONE ON CALL SEND_BYTE_COMMAND MOV A,@0B01100000 ;TONE 2K CALL SEND_BYTE_COMMAND MOV A,@0B00000011 ;LCD ON CALL SEND_BYTE_COMMAND BS CS_HT1621 ;*************************************************************** HT1621_CLR: BC CS_HT1621 MOV A,@0XA0 CALL SEND_BIT3_COMMAND ;发送101 ,写模式 MOV A,@0X00 CALL SEND_1621ADDRESS ;发送6位地址 MOV A,@0X10 MOV FORLOOP,A HT1621_CLR_LOOP1: MOV A,@0XFF ;全写1 CALL SNED_WRITE_DATA DJZ FORLOOP JMP HT1621_CLR_LOOP1 BS CS_HT1621 NOP RET ;****************************************************************** SEND_BIT3_COMMAND: MOV XS2,A MOV A,@0X03 MOV XS1,A JMP SEND_TO_1621 SEND_BYTE_COMMAND: MOV XS2,A MOV A,@0X09 MOV XS1,A JMP SEND_TO_1621 SEND_1621ADDRESS: MOV XS2,A MOV A,@0X06 MOV XS1,A JMP SEND_TO_1621 SNED_WRITE_DATA: MOV XS2,A MOV A,@0X08 MOV XS1,A JMP SEND_TO_1621 ;****************************************************************** SEND_TO_1621: BC PORT5,1 ;WR=0 JBS XS2,7 JMP DATA_0 BS PORT5,0 ;DATA=1 JMP DATA_1 DATA_0: BC PORT5,0 ;DATA=0 DATA_1: CALL YSA BS PORT5,1 ;WR=1 CALL YSA RLC XS2 DJZ XS1 JMP SEND_TO_1621 RET ;*************************************************************** YSA: MOV A,@3 ;NOP for 3 times MOV XS3,A LOP1: NOP DJZ XS3 JMP LOP1 RET |