IFC-DI08 Card Library Functions
IFC-DI08 Card Library Functions
Apr 2008
Information contained in this publication regarding device applications and the like is intended through suggestion only and may
be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. No
representation or warranty is given and no liability is assumed by Cytron Technologies Incorporated with respect to the accuracy
or use of such information, or infringement of patents or other intellectual property rights arising from such use or otherwise. Use
of Cytron Technologies’s products as critical components in life support systems is not authorized except with express written
approval by Cytron Technologies. No licenses are conveyed, implicitly or otherwise, under any intellectual property rights.
This document explains the function prototype for DI08 needed in controlling input port. The
function prototype will be called in main program for MB00 in order to control/communicate
with DI08. User can also find the explanation of function prototype in its header file,
“iic_di.h”. Table 1 show the function for DI08.
Digital input (DI08) is another card for IFC. With this digital input card user can plug their
favorite sensor, stack it and use it. To use this digital input card, some examples in using
function prototype are given as a guide.
These function prototypes are used to set the condition of counter on DI08. The first 2 input
ports (DI 1 and DI 2) can be set as 16-Bits counter which can count up to 65,535. Example
below is to show how to use this function prototype. di_add is an address which is set on the
Digital Input card and need to declare at beginning of programming. Both of the counters are
enabled in the example code.
From Figure 1, both of the counters are enabled and counter1 counted 619 times while
counter2 counted 463 times.
Figure 1
This function prototype is used to clear value in counter1 and counter2. To use this function,
user may call the function prototype as shown:
From Figure 2 when user calls this function, counter1 and counter2 will reset and start from
000000 compared to previous figure (Figure 1) where both of the counters have value.
Figure 2
di_c1val and di_c2val store the value counted by counter1 and counter2. So, this function is
used to read value in counter1 and counter2. User may call the function as shown to test the
value in counter1, if it is equal to ‘3’, led7 will turn ON:
This function is used to read the digital input status in byte or per input. For example below,
the program is written to test status of Digital Input 2. When signal is detected, value ‘0’ will
be send to the microcontroller since all the input ports on DI08 are active low.
Figure 3 shows char’2’ being displayed on LCD screen when input2 (DI 2) detected a signal.
Figure 3
User may also call this function to test ALL input port in a together. The example shown
below is to test ALL the input ports. If signal is detected on ALL input ports together, LED1
will turn ON:
Note: User is reminded to add header file (iic.h and iic_di.h) and object file (iic.o and
iic_di.o) for IFC-MB00 and IFC-DI08 each time open a new project for IFC. User also
needs to include card h file at the beginning of the program. Please refer sample source
code for the example to include card h file.
Prepared by
Cytron Technologies Sdn. Bhd.
19, Jalan Kebudayaan 1A,
Taman Universiti,
81300 Skudai,
Johor, Malaysia.
URL: www.cytron.com.my
Email: support@cytron.com.my
sales@cytron.com.my