Hardware Reference
In-Depth Information
rts
isdeci
leas
4,SP
adda
#$30
; compute the ASCII code
rts
#include “c:\miniIDE\delay.asm”
The C language version of the function is as follows:
#define keypad PTA // keypad port
#define keypad_dir DDRA // keypad port direction register
// ********************************************************************************
// rmask is row mask, cmask is column mask, row is the row being scanned, col is the
// column being scanned
// ********************************************************************************
char getkey (void)
{
char rmask, cmask, row, col;
char temp, keycode;
keypad_dir 5 0xF0;
// configure lower four pins for input
while (1) {
rmask
5 0xEF;
for (row 5 0; row , 4; row 11 ){
cmask
5 0x01;
keypad
& 5 rmask; // select the current row
for (col 5 0; col , 4; col 11 ){
if (!(keypad & cmask)){
// key switch detected pressed
delayby10ms(1);
if(!(keypad & cmask)){ // check the same key again
keycode 5 row * 4 1 col;
if (keycode , 10)
return (0x30 1 keycode);
else
return (0x37 1 keycode);
}
}
cmask 5 cmask ,, 1;
}
rmask 5 (rmask ,, 1) | 0x0F;
}
}
}
7.10 Using the D/A Converter
A digital-to-analog converter (DAC) converts fixed-point binary numbers into an electric
voltage (more often) or current. Normally the output is a linear function of the input num-
ber. These numbers are often obtained from a sampling process (for example, digital audio)
at uniform intervals. To restore to the original physical quantity, these numbers are fed to
 
Search WWH ::




Custom Search