L
ON
W
ORKS
I
NTERFACE
M
ODULE
O
PEN
N
ET
C
ONTROLLER
L
ON
W
ORKS
I
NTERFACE
M
ODULE
U
SER
’
S
M
ANUAL
19
27. Main Program
28. *********************************************************/
29. when(reset){
30. initialize();
31. /* Insert other commands here to execute within when(reset), if required. */
32. }
Header File (fc3asx5l.h)
1.
//Header File: fc3asx5l.h
2.
/*************************************/
3.
/* Common Definition */
4.
/*************************************/
5.
#define LED_OFF 1
6.
#define LED_ON 0
7.
#define OK 1
8.
#define NG 0
9.
#define HIGH 1
10. #define LOW 0
11. /* Timer Value */
12. #define DTm_5sec 5000
13. /*************************************/
14. /* Memory Mapped I/O Definition */
15. /*************************************/
16. #define IO_GA_BASE 0xc000 // I/O Base Address
17. /*************************************/
18. /* Digital I/O Register Address */
19. /*************************************/
20. #define GA_FCDR (IO_G 0x00) // Data Register
21. #define GA_CSR_ERR (IO_G 0x12) // Error Register
22. #define GA_FVER (IO_G 0x18) // I/O Version Register
23. #define GA_EMID (IO_G 0x19) // Expansion Module ID Register
24. #define GA_BCTL (IO_G 0x1a)
25. /*************************************/
26. /* I/O Register Bit Definition */
27. /*************************************/
28. #define BCTL_CENABLE 0x10
29. #define BCTL_NWR_REQ 0x04
30. #define BCTL_NENABLE 0x01
31. #define MAX_FCDR_DATA_LEN 16
32. /* Define Neuron Chip IO pins as follows. */
33. IO_0 output bit PO_RUN_LED = HIGH;
34. IO_1 output bit PO_ERR_LED = HIGH;
35. IO_2 output bit PO_IO_LED = HIGH;
36. IO_3 input bit PI_ODE;
37. IO_4 input bit PI_RUN;
38. IO_6 output bit PO_F_ERR = LOW;
39. /*************************************/
40. /* Prototype */
41. /*************************************/
42. void initialize(void);
43. void init_internal_io(void);
44. void init_external_io(void);
45. void init_gate_array(void);
46.
47. /*************************************/
48. /* Global Variable */
49. /*************************************/
50. mtimer io_check_timer;
51. unsigned char csr_error_data; // CSR_ERROR Reg. data save area
52.
53. void initialize(void){