| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sct_fsm_keil_mcb_18574357.c
Go to the documentation of this file.
1
2 /* Generated by fzmparser version 1.14 --- DO NOT EDIT! */
3
4 /* Uses following resources: */
5 /* [9 events, 5+1 states, 1 inputs, 5 outputs, 7 match regs, 0 capture regs] */
6
7 #include "sct_fsm.h"
8
9
10 void sct_fsm_init (void)
11 {
12
13 /* MATCH/CAPTURE registers */
14 LPC_SCT->REGMODE_L = 0x0000; /* L: 6x MATCH, 0x CAPTURE, 10 unused */
15 LPC_SCT->REGMODE_H = 0x0000; /* H: 1x MATCH, 0x CAPTURE, 15 unused */
16 LPC_SCT->MATCH_L[0] = yellow_on_time;
17 LPC_SCT->MATCHREL_L[0] = yellow_on_time;
18 LPC_SCT->MATCH_H[0] = pedestrianCross_time;
19 LPC_SCT->MATCHREL_H[0] = pedestrianCross_time;
20 LPC_SCT->MATCH_L[1] = red_off_time;
21 LPC_SCT->MATCHREL_L[1] = red_off_time;
22 LPC_SCT->MATCH_L[2] = yellow_off_time;
23 LPC_SCT->MATCHREL_L[2] = yellow_off_time;
24 LPC_SCT->MATCH_L[3] = pedestrian_walk_time;
25 LPC_SCT->MATCHREL_L[3] = pedestrian_walk_time;
26 LPC_SCT->MATCH_L[4] = red_on_time;
27 LPC_SCT->MATCHREL_L[4] = red_on_time;
28 LPC_SCT->MATCH_L[5] = pedestrian_stop_time;
29 LPC_SCT->MATCHREL_L[5] = pedestrian_stop_time;
30
31 /* OUTPUT registers */
32 LPC_SCT->OUT[10].SET = 0x00000008; /* GREEN_N */
33 LPC_SCT->OUT[10].CLR = 0x000000E6;
34 LPC_SCT->OUT[13].SET = 0x00000010; /* BLUE_N */
35 LPC_SCT->OUT[13].CLR = 0x00000100;
36 LPC_SCT->OUT[14].SET = 0x00000020; /* RED_N */
37 LPC_SCT->OUT[14].CLR = 0x0000014A;
38 LPC_SCT->OUT[8].SET = 0x00000084; /* REQUEST */
39 LPC_SCT->OUT[8].CLR = 0x00000010;
40 LPC_SCT->OUT[11].SET = 0x00000001; /* AUTO_CROSS */
41 LPC_SCT->OUT[11].CLR = 0x00000020;
42 /* Unused outputs must not be affected by any event */
43 LPC_SCT->OUT[0].SET = 0;
44 LPC_SCT->OUT[0].CLR = 0;
45 LPC_SCT->OUT[1].SET = 0;
46 LPC_SCT->OUT[1].CLR = 0;
47 LPC_SCT->OUT[2].SET = 0;
48 LPC_SCT->OUT[2].CLR = 0;
49 LPC_SCT->OUT[3].SET = 0;
50 LPC_SCT->OUT[3].CLR = 0;
51 LPC_SCT->OUT[4].SET = 0;
52 LPC_SCT->OUT[4].CLR = 0;
53 LPC_SCT->OUT[5].SET = 0;
54 LPC_SCT->OUT[5].CLR = 0;
55 LPC_SCT->OUT[6].SET = 0;
56 LPC_SCT->OUT[6].CLR = 0;
57 LPC_SCT->OUT[7].SET = 0;
58 LPC_SCT->OUT[7].CLR = 0;
59 LPC_SCT->OUT[9].SET = 0;
60 LPC_SCT->OUT[9].CLR = 0;
61 LPC_SCT->OUT[12].SET = 0;
62 LPC_SCT->OUT[12].CLR = 0;
63 LPC_SCT->OUT[15].SET = 0;
64 LPC_SCT->OUT[15].CLR = 0;
65 LPC_SCT->OUTPUT = (LPC_SCT->OUTPUT & ~0x00000D00) | 0x00006000;
66
67 /* Conflict resolution register */
68
69 /* EVENT registers */
70 LPC_SCT->EVENT[0].CTRL = 0x00005010; /* H: --> state H_ENTRY */
71 LPC_SCT->EVENT[0].STATE = 0x00000001;
72 LPC_SCT->EVENT[1].CTRL = 0x0000D000; /* L: --> state YELLOW_ON_State */
73 LPC_SCT->EVENT[1].STATE = 0x00000008;
74 LPC_SCT->EVENT[2].CTRL = 0x0001E6E0; /* L: --> state GREEN_ON_state */
75 LPC_SCT->EVENT[2].STATE = 0x00000001;
76 LPC_SCT->EVENT[3].CTRL = 0x00027E24; /* L: --> state RED_ON_State */
77 LPC_SCT->EVENT[3].STATE = 0x00000002;
78 LPC_SCT->EVENT[4].CTRL = 0x00025005; /* L: --> state RED_ON_State */
79 LPC_SCT->EVENT[4].STATE = 0x00000004;
80 LPC_SCT->EVENT[5].CTRL = 0x00007222; /* L: --> state L_ENTRY */
81 LPC_SCT->EVENT[5].STATE = 0x00000002;
82 LPC_SCT->EVENT[6].CTRL = 0x0000F221; /* L: --> state YELLOW_ON_State */
83 LPC_SCT->EVENT[6].STATE = 0x00000010;
84 LPC_SCT->EVENT[7].CTRL = 0x0001E400; /* L: --> state GREEN_ON_state */
85 LPC_SCT->EVENT[7].STATE = 0x00000001;
86 LPC_SCT->EVENT[8].CTRL = 0x00017E23; /* L: --> state WALK_State */
87 LPC_SCT->EVENT[8].STATE = 0x00000010;
88 /* Unused events must not have any effect */
89 LPC_SCT->EVENT[9].STATE = 0;
90 LPC_SCT->EVENT[10].STATE = 0;
91 LPC_SCT->EVENT[11].STATE = 0;
92 LPC_SCT->EVENT[12].STATE = 0;
93 LPC_SCT->EVENT[13].STATE = 0;
94 LPC_SCT->EVENT[14].STATE = 0;
95 LPC_SCT->EVENT[15].STATE = 0;
96
97 /* STATE registers */
98 LPC_SCT->STATE_L = 0;
99 LPC_SCT->STATE_H = 0;
100
101 /* state names assignment: */
102 /* State L 0: L_ENTRY */
103 /* State L 1: YELLOW_ON_State */
104 /* State L 2: WALK_State */
105 /* State L 3: GREEN_ON_state */
106 /* State L 4: RED_ON_State */
107 /* State H 0: H_ENTRY */
108
109 /* CORE registers */
110 LPC_SCT->START_L = 0x0000;
111 LPC_SCT->STOP_L = 0x0000;
112 LPC_SCT->HALT_L = 0x0000;
113 LPC_SCT->LIMIT_L = 0x01FE;
114 LPC_SCT->START_H = 0x0020;
115 LPC_SCT->STOP_H = 0x0001;
116 LPC_SCT->HALT_H = 0x0000;
117 LPC_SCT->LIMIT_H = 0x0020;
118 LPC_SCT->EVEN = 0x00000004;
119 LPC_SCT->DMA0REQUEST = 0x00000000;
120 LPC_SCT->DMA1REQUEST = 0x00000000;
121
122 }