IDEC LonWorks FC3A-SX5LS1 User Manual page 21

Interface module
Table of Contents

Advertisement

L
W
I
ON
ORKS
NTERFACE
54.
init_internal_io();
55.
init_external_io();
56. }
57. void init_internal_io(void){
58.
io_change_init(PI_ODE);
59.
io_change_init(PI_RUN);
60. }
61. void init_external_io(void){
62.
init_gate_array();
63. }
64. void init_gate_array(void){
65.
int st, n;
66.
unsigned char *pGA;
67.
unsigned char dat;
68.
69.
io_check_timer = DTm_5sec;
70.
while(TRUE){
71.
post_events();
72.
pGA = (unsigned char *)GA_BCTL;
73.
*pGA |= BCTL_NWR_REQ;
74.
dat = *pGA;
75.
if (dat & BCTL_NWR_REQ){
76.
pGA = (unsigned char *)GA_FCDR;
77.
for (n = 0; n < MAX_FCDR_DATA_LEN; n++){
78.
79.
}
80.
pGA = (unsigned char *)GA_CSR_ERR;
81.
csr_error_data = 0;
82.
*pGA
83.
pGA = (unsigned char *)GA_FVER;
84.
*pGA = FC3ASX5L_VERSION;
85.
pGA = (unsigned char *)GA_EMID;
86.
*pGA = EMID_CODE;
87.
pGA = (unsigned char *)GA_BCTL;
88.
*pGA
89.
dat = *pGA;
90.
if (dat & BCTL_NENABLE){
91.
92.
93.
}else{
94.
95.
}
96.
}
97. /* The following program turns on the I/O LED when initialization fails within 5 seconds, and
can be modified by the user. */
98.
if (timer_expires(io_check_timer)){
99.
io_out(PO_IO_LED, LOW);
100.
break;
101.
}
102.
}
103.}
Note: ~ is an exclusive OR of every bit.
Brief description of functions used for the initialization program
• init_internal_io() function
This function initializes the Neuron Chip internal IO pins.
• init_external_io() function
This function substitutes the number of register IO points for max_out_number or max_in_number.
• init_gate_array() function
This function turns on the I/O LED when initialization of registers fails within 5 seconds.
20
M
ODULE
*pGA++ = 0x00;
= csr_error_data;
|= BCTL_NENABLE;
*pGA &= ~BCTL_NWR_REQ;
break;
*pGA &= ~BCTL_NWR_REQ;
O
N
C
L
PEN
ET
ONTROLLER
ON
/* I/O LED goes on when timeout */
W
I
M
U
ORKS
NTERFACE
ODULE
'
M
SER
S
ANUAL

Advertisement

Table of Contents
loading

Table of Contents