![IDEC OpenNet series Скачать руководство пользователя страница 381](http://html.mh-extra.com/html/idec/opennet-series/opennet-series_user-manual_617384381.webp)
26: L
ON
W
ORKS
I
NTERFACE
M
ODULE
26-20
O
PEN
N
ET
C
ONTROLLER
U
SER
’
S
M
ANUAL
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. *pGA++ = 0x00;
79. }
80. pGA = (unsigned char *)GA_CSR_ERR;
81. csr_error_data = 0;
82. *pGA = csr_error_data;
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 |= BCTL_NENABLE;
89. dat = *pGA;
90. if (dat & BCTL_NENABLE){
91. *pGA &= ~BCTL_NWR_REQ;
92. break;
93. }else{
94. *pGA &= ~BCTL_NWR_REQ;
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); /* I/O LED goes on when timeout */
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.
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: [email protected]