Antona Application Note
ANC-3052B for I2C Control

wavey line 2

  This BASIC program listing is the complete application software to perform the I2C transmissions to control the Sony 1762SBX.   You can use this software as a basis of your own I2C program.   The software has been tested and debugged on our ANC-3052B embedded adapter®, but Antona Corporation makes no warrenty on the code operation nor do we offer support of the code.   It is offered as sample code only to demonstrate an application of the specified Antona product.

10     REM
20     REM  I2C DRIVER TO INIT SONY 1762SBX
30     REM
40     REM  FOR ANC-3052 BASIC CARD - REV B
50     REM
60    A=0F000H
65    S=80H : K=40H : M=0
68    P=128 : T=232 : Z=68 : H=60H
120    REM
130    REM  INITALIZE SONY SBX1762 TO NOMINAL VALUES
140    REM
155    REM  START CONDITION
160   PORT1=K+S+7 : PORT1=K+7 : PORT1=7
165   XBY(A)=0FFH
170    REM  SET I2C ADDRESS
180   Q=40H :  GOSUB 2000
190   Q=0 :  GOSUB 2000
195   Q=80H :  GOSUB 2000
198   Q=0 :  GOSUB 2000
200   Q=P :  GOSUB 2000
210   Q=T :  GOSUB 2000
220   Q=Z :  GOSUB 2000
230   Q=H :  GOSUB 2000
232    REM
234    REM STOP CONDITION
236    REM
238   PORT1=K+7 : PORT1=K+S+7
240    REM PRINT "SET", : PH0. M,H,P,T,Z
250   XBY(A)=0FFH-M
320    REM READ MODE BUTTON
322   B=PORT1 :  IF (B.AND.7)=7 THEN  GOTO 322
324    IF (B.AND.01H)=0 THEN  GOSUB 3030 ELSE  GOTO 328
325   B=PORT1
326    IF (B.AND.01H)=0 THEN  GOTO 325
328    IF M=0 THEN  GOTO 322
400    IF (B.AND.02H)<>0 THEN  GOTO 700
500    REM
510    REM INCREASE SELECTED MODE VALUE
520    REM
550    IF M=1 THEN H=(H+4).AND.0FCH :  GOTO 600
560    IF M=2 THEN P=(P+4).AND.0FCH :  GOTO 600
570    IF M=4 THEN T=(T+4).AND.0FCH :  GOTO 600
590    IF M=8 THEN Z=(Z+4).AND.0FCH 
600   B=PORT1 :  IF (B.AND.02H)=0 THEN  GOTO 600 ELSE  GOTO 160
700    IF (B.AND.04H)<>0 THEN  GOTO 322
705    REM
710    REM DECREASE SELECTED MODE VALUE
720    REM
750    IF M=1 THEN H=(H+0FCH).AND.0FCH :  GOTO 800
760    IF M=2 THEN P=(P+0FCH).AND.0FCH :  GOTO 800
770    IF M=4 THEN T=(T+0FCH).AND.0FCH :  GOTO 800
790    IF M=8 THEN Z=(Z+0FCH).AND.0FCH
800   B=PORT1 :  IF (B.AND.04H)=0 THEN  GOTO 800 ELSE  GOTO 160
1990   REM
1992   REM  WRITE BYTE IN 'Q' TO I2C PORT
1994   REM
2000  PORT1=7
2010   FOR X=0 TO 7
2015  V=(Q.AND.S).OR.7
2020  PORT1=V : PORT1=V+K :  IF X=7 THEN PORT1=S+7 ELSE PORT1=V
2030  Q=Q*2
2040   NEXT X
2050  PORT1=S+7 : PORT1=S+K+7 : PORT1=S+7
2060   RETURN 
3000   REM
3010   REM  ADVANCE MODE LED
3020   REM
3030   IF M=0 THEN M=1 :  GOTO 3300
3040  M=M*2
3050   IF M>=10H THEN M=0
3300  XBY(A)=0FFH-M
3320   RETURN 

Wavey line 1
Related Links
Back to Homepage

  If you need more information on Antona's products and services, please Contact Us for a quick response.



Updated 05/27/02 12:00
Copyright © 1998-2002 Antona Corporation, L.A., CA., U. S. A.