Input/Output ports system calls
The Holtek C language provides the following system calls for accessing the
input/output ports. These system calls are implemented without ’call’ in-
structions to reduce the number of stacks used.
→
Input/Output ports
•
unsigned char peekPX()
Read data from port X, X=A,B,C,D,E,F,G
–
Example
unsigned char i;
i= peekPA(); //read input value from the port A, saved in i
•
void pokePX (unsigned char)
Write data to port X, X=A,B,C,D,E,F,G
–
Example
pokePC (0
×
00); //write a char 0
×
00 to the port C
→
Read/Write control registers
•
unsigned char peekPXC()
Read data from port X control register, X= A,B,C,D,E,F,G
–
Example
unsigned char i;
i= peekPEC(); //read an input value from the control register
//of port E, saved in i
•
void pokePXC (unsigned char)
write data to port X control register, X=A,B,C,D,E,F,G
–
Example
pokePBC(0
×
20); //write a value of 0x20 to the control
//register of port B
→
Set/Clear bits of ports
•
void setPX()
set port X, X=A,B,C,D,E,F,G
–
Example
setPD(); //set port D
•
void setPXi()
set bit i of port X, i=0,1,2,3,4,5,6,7 and X=A,B,C,D,E,F,G
–
Example
setPD3(); //set bit 3 of port D
•
void clrPX()
clear port X,X=A,B,C,D,E,F,G
–
Example
clrPC(); //clear port C
Chapter 9 Holtek C Language
109
Содержание HT-IDE
Страница 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Страница 12: ...HT IDE User s Guide 2 ...
Страница 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Страница 24: ...HT IDE User s Guide 14 ...
Страница 70: ...HT IDE User s Guide 60 ...
Страница 76: ...HT IDE User s Guide 66 ...
Страница 92: ...HT IDE User s Guide 82 ...
Страница 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Страница 94: ...HT IDE User s Guide 84 ...
Страница 148: ...HT IDE User s Guide 138 ...
Страница 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Страница 154: ...HT IDE User s Guide 144 ...
Страница 192: ...HT IDE User s Guide 182 ...
Страница 194: ...HT IDE User s Guide 184 ...
Страница 218: ...HT IDE User s Guide 208 ...
Страница 235: ...P a r t V Appendix Part V Appendix 225 ...
Страница 236: ...HT IDE User s Guide 226 ...
Страница 250: ...HT IDE User s Guide 240 ...