Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

SN8F5708 Datasheet(PDF) 117 Page - SONiX Technology Company

Part # SN8F5708
Description  8051-based Microcontroller
PDF  204 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  SONIX [SONiX Technology Company]
Direct Link  http://www.sonix.com.tw
Logo SONIX - SONiX Technology Company

SN8F5708 Datasheet(HTML) 117 Page - SONiX Technology Company

Back Button SN8F5708 Datasheet HTML 113Page - SONiX Technology Company SN8F5708 Datasheet HTML 114Page - SONiX Technology Company SN8F5708 Datasheet HTML 115Page - SONiX Technology Company SN8F5708 Datasheet HTML 116Page - SONiX Technology Company SN8F5708 Datasheet HTML 117Page - SONiX Technology Company SN8F5708 Datasheet HTML 118Page - SONiX Technology Company SN8F5708 Datasheet HTML 119Page - SONiX Technology Company SN8F5708 Datasheet HTML 120Page - SONiX Technology Company SN8F5708 Datasheet HTML 121Page - SONiX Technology Company Next Button
Zoom Inzoom in Zoom Outzoom out
 117 / 204 page
background image
www.sonix.com.tw
SN8F5708 Series
Copyright © 2019, SONiX Technology Co., Ltd.
Comparator
Datasheet Rev. 2.4
117
17.5
Sample Code
The following sample code demonstrates how to perform CMP0 with interrupt.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#define CM0LeChge
(3 << 0) // CM0P > CM0N or CM0P < CM0N
#define CM0NGreCM0P (2 << 0) // CM0P < CM0N
#define CM0PGreCM0N (1 << 0) // CM0P > CM0N
#define CMP0OEN
(1 << 3) // CMP0 output pin enable
#define CMP0Vin2V
(0 << 4) // CMP0 positive Vin connect 2.0V
#define CMP0Vin3V
(1 << 4) // CMP0 positive Vin connect 3.0V
#define CMP0Vin4V
(2 << 4) // CMP0 positive Vin connect 4.0V
#define CMP0VINP
(3 << 4) // CMP0 positive Vin connect CM0P
#define CMP0EN
(1 << 7) //enable CMP0
#define CM1LeChge
(3 << 0) // CM1P > CM1N or CM1P < CM1N
#define CM1NGreCM1P (2 << 0) // CM1P < CM1N
#define CM1PGreCM1N (1 << 0) // CM1P > CM1N
#define CMP1OEN
(1 << 3) // CMP1 output pin enable
#define CMP1Vin2V
(0 << 4) // CMP1 positive Vin connect 2.0V
#define CMP1Vin3V
(1 << 4) // CMP1 positive Vin connect 3.0V
#define CMP1Vin4V
(2 << 4) // CMP1 positive Vin connect 4.0V
#define CMP1VINP
(3 << 4) // CMP1 positive Vin connect CM1P
#define CMP1EN
(1 << 7) //enable CMP1
void CMPInit(void)
{
P1 = 0x00;
P1M = 0xC0;
// set CMP0 & CMP1 pins’ mode at pure analog pin
P3CON |= 0xC0;
//P36/P37
P2CON |= 0x60;
//P26/P25
// configure CMP0 positive Vin = 4.0V and interrupt trigger = CM0P > CM0N
// enable CMP0 and output pin
CMP0M = CMP0EN | CMP0Vin4V | CMP0OEN | CM0PGreCM0N;
// configure CMP1 positive Vin = CM1P and interrupt trigger = CM1P < CM1N
// enable CMP1 and output pin
CMP1M = CMP1EN | CMP1VINP | CMP1OEN | CM1NGreCM1P;
// enable CMP0 & CMP1 interrupt
IEN2 |= 0x30;
IEN0 |= 0x80;
//enable global interrupt
}
void CMP0Interrupt(void) interrupt ISRCmp0 //0xA3
{
if ((IRCON2 & 0x08) == 0x08) {
P16 = ~P16;
IRCON2 &= 0xF7;
//Clear CMP0F
}
}
void CMP1Interrupt(void) interrupt ISRCmp1 //0xAB
{
if ((IRCON2 & 0x10) == 0x10) {
P17 = ~P17;
IRCON2 &= 0xEF;
//Clear CMP1F
}
}



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com