Click here to load reader

Zx relay16

  • View
    240

  • Download
    4

Embed Size (px)

DESCRIPTION

 

Text of Zx relay16

  • 1

    !"#$%&'()*+ ,-./$0+#$%& '() 1)2(345$6-$ !"7$5$$86"9 :&6-$+$& 9( ;&"9

  • 2

    !

    !

    ""

    ""

    ##

    !

    !

    !

    !

    !

    $

    $

    $

    $

    $

    $!

    $

    $

    %

    !

    !

    !

    $

    $

    $

    $

    $

    $!

    $

    $

    !

    %

    &

    &!

    '

    ()*

    !

    &!

    !&!

    &!

    (*+,-./,0. 1)2(34 5*6+

  • 3

    !"#$%&%'(')&'*+&(, -1)2(34 ./$0+K0!+$+0!+$K+#$%& '()&$"$?75$6,6-

    K0!+6=$+0!+.-$K&% *"!&-"97.$0+86"7R;%5$,6-&$"$? !"8 + .-"8+7$+K+*&!8

    MO&5$&+K+7./1)2(34 0=75$6*6"-"9M(O&5$&0=+K+7;K&+'UC'4M:&4Z4OM3O75$6,[email protected]+$$+0!+*$]4^,6-7!7K+;K&+'UC'4M_O&5$&0=+K+7;K&+'UC'M:&4Z4`OMWO75$6,[email protected]+$+0!+*$]4^,6-7!7K+;K&+'UC'MO&5$&0=+K+&-"97;K&+$0+.+$:&4Z44M`O&5$&0=+K+&-"97;K&+$0+.+:&4Z4

    ;$78+7$+K+&$"$?5$"$*:7"[$a$)*,-\EbGH)".00=&7$5$$:&,*:7"

  • 4

    char I2CInit_=0;char y;int i,j;void Relay16(unsigned int x){

    if (I2CInit_==0){

    I2C_Init(100000); // Call initial L2CI2C_Start(); // Start communicationI2C_Wr(0x40); // Address MCP23016 and Write CommandI2C_Wr(0x06); // Command for access IODIR0I2C_Wr(0x00); // Set DIR0 to OUTPUTI2C_Stop(); // Stop communication

    I2C_Start(); // Start communicationI2C_Wr(0x40); // Address MCP23016 and Write CommandI2C_Wr(0x07); // Command for access IODIR1I2C_Wr(0x00); // Set DIR0 to OUTPUTI2C_Stop(); // Stop communicationI2CInit_=1;

    }y=x%256;I2C_Start(); // Issue I2C start signalI2C_Wr(0x40); // Send byte via I2C (device address + W)I2C_Wr(0x00); // Send byte (data address)I2C_Wr(y); // Send byte (data address)I2C_Stop();

    x=x/256;I2C_Start(); // Issue I2C start signalI2C_Wr(0x40); // Send byte via I2C (device address + W)I2C_Wr(0x01); // Send byte (data address)I2C_Wr(x); // Send byte (data address)I2C_Stop();

    }void main(){ while(1) // Loop { i=1; // Start value while(i5$6-$

    +K+7&5$6Qc7deVfMO;%75$6,6-$0+86"$+0!+;$78$+ :Z-$"$:[email protected]+$:%@[email protected]+$&.:&4Z440=?>@:%[email protected]+&.:&4Z40=&.g?>

  • 5

    01%+&/&2_h+ ;,93,-."**2')[email protected]``6=2')[email protected]`` $"?&AA$

  • 6

    34(,(5&6789:"');!/Q+: 0p$*:7"[$a$ ) &5$6."** 2') #9-0p$=

    +,-./012-3./4,-56+,-./078889+,-./29:/+;\EbGH).-;!="=0=5$ $"&% 7,7$0p$*:7". -"$7"$+ :*:7"[$a$)6=)FH\JEedG"9:7$5$$-$7.-7TB')"$+q$".$7$+K+7!7

Search related