参数资料
型号: 20-151-0178
厂商: Rabbit Semiconductor
文件页数: 88/162页
文件大小: 0K
描述: CABLE CONVERTER RS-232 TO USB
标准包装: 1
附件类型: USB 至 RS232 适配器
适用于相关产品: 基于 Rabbit 的板
产品目录页面: 619 (CN2011-ZH PDF)
其它名称: 20-151-0178-ND
316-1181
We will now go through each part of this new while loop in detail:
while (1) {
costate {
// Check if a switch has been pressed
do {
flexDigInGroup16(switches, &switch_values);
} while (switch_values == 0x00);
Like before, we use a costatement to make implementing debouncing easier. Now notice the
flexDigInGroup16() function call. Like flexDigOutGroup16() , this function takes an array
of Flex_IOPin pointers. However, the second parameter is a pointer to an unsigned integer.
flexDigInGroup16() places the values read from the digital inputs into this unsigned integer
( switch_values , in this case). This is done in much the same way that the outputs are used in
flexDigOutGroup16() . That is, the value read from the first input in the group is placed in the least
significant bit in the unsigned integer; the second input value is placed in the next least significant bit; etc.
Note that having a do/while loop in a costatement is not an efficient design for cooperative multitasking,
since the costatement would not yield until a switch has been pressed. In a real-world application, busy
waiting such as this should be replaced with a waitfor statement and a function call to code that would
check for the switch press and return.
Notice that we are reading the switch inputs until one of the switches has been pressed. Because we read
the values in a group, we can check all switches simultaneously.
// Determine which switch was pressed
value = 1;
switch_pressed = switches;
led = leds;
switchnum = 1;
while (!(value | switch_values)) {
value <<= 1;
switch_pressed++;
led++;
switchnum++;
}
// switch_pressed now indicates which pin was pressed
Next, we must inspect the switch_values unsigned integer to determine which switch was pressed. To
do this, we use the value variable to check against each bit of switch_values . That is, we change
the bit that is set within the variable value in each iteration of the loop. By ORing the value variable
against switch_values , we can determine if the corresponding switch has been pressed.
82
Applications Programming
相关PDF资料
PDF描述
MAX11200EVKIT+ KIT EVALUATION FOR MAX11200
HCC06DRTF-S13 CONN EDGECARD 12POS .100 EXTEND
HK1608R47J-T INDUCTOR HI FREQ 470NH 5% 0603
PCM16XD0 PROCESSOR MODULE FOR MPLAB-ICE
SDR1006-681KL INDUCTOR POWER 680UH 0.28A SMD
相关代理商/技术参数
参数描述
20-151-0183 功能描述:处理器配件 UNIVL PWRSUPLY 12VDC 1A/W MOLEX MICROFIT3 RoHS:否 制造商:Olimex Ltd. 产品:Cable 用于:
2015103-1 制造商:TE CONNECTIVITY 功能描述:RF C/A, RT ANG QMA/DIN 1.0/2.3 CONN
2015-104 制造商:The Bergquist Company 功能描述:THERMAL PAD TO-3P PK5 制造商:The Bergquist Company 功能描述:THERMAL PAD, TO-3P, PK5 制造商:The Bergquist Company 功能描述:THERMAL PAD, TO-3P, PK5; Insulator Body Material:Silicone Elastomer; Thermal Conductivity:3.5W/m.K; Breakdown Voltage Vbr:4kV; Thickness:0.508mm; Volume Resistivity:100000Mohm-m; SVHC:No SVHC (19-Dec-2012); Electrical Property Ins /
2015-104 制造商:The Bergquist Company 功能描述:THERMAL PAD TO-3P 制造商:The Bergquist Company 功能描述:THERMAL PAD, TO-3P
201511 制造商:Phoenix Contact 功能描述:Misc Products