Download Print this page

I2C Interrupt - STC micro STC8A8K64D4 Series Reference Manual

Advertisement

STC8A8K64D4 Series Manual
MOV
MOV
MOV
MOV
MOV
MOV
ORL
ANL
ORL
ORL
SETB
JMP
END

11.5.21 I2C Interrupt

C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
sfr
P_SW2
#define
I2CCFG
#define
I2CMSCR
#define
I2CMSST
#define
I2CSLCR
#define
I2CSLST
#define
I2CSLADR
#define
I2CTXD
#define
I2CRXD
sfr
P0M1
sfr
P0M0
sfr
P1M1
sfr
P1M0
sfr
P2M1
sfr
P2M0
sfr
P3M1
sfr
P3M0
sfr
P4M1
sfr
P4M0
sfr
P5M1
sfr
P5M0
sbit
P10
void I2C_Isr() interrupt 24
{
_push_(P_SW2);
P_SW2 |= 0x80;
if (I2CMSST & 0x40)
{
I2CMSST &= ~0x40;
P10 = !P10;
}
_pop_(P_SW2);
P4M0, #00H
P4M1, #00H
P5M0, #00H
P5M1, #00H
CMPCR2,#00H
CMPCR1,#80H
CMPCR1,#30H
CMPCR1,#NOT 08H
CMPCR1,#04H
CMPCR1,#02H
EA
$
=
0xba;
(*(unsigned char volatile xdata *)0xfe80)
(*(unsigned char volatile xdata *)0xfe81)
(*(unsigned char volatile xdata *)0xfe82)
(*(unsigned char volatile xdata *)0xfe83)
(*(unsigned char volatile xdata *)0xfe84)
(*(unsigned char volatile xdata *)0xfe85)
(*(unsigned char volatile xdata *)0xfe86)
(*(unsigned char volatile xdata *)0xfe87)
=
0x93;
=
0x94;
=
0x91;
=
0x92;
=
0x95;
=
0x96;
=
0xb1;
=
0xb2;
=
0xb3;
=
0xb4;
=
0xc9;
=
0xca;
=
P1^0;
Enable comparator module
;
;
Enable comparator edge interrupt
is
;P3.6
CMP+ input pin
is
input pin
; P3.7
CMP-
;
Enable comparator output
//Clear interrupt flag
//Test port
-
- 257 -

Advertisement

loading
Need help?

Need help?

Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin