Concept code which launches two threads, one of which implements a Modbus Tunnel protocol to talk with an ISEM, the other which launches a Modbus RTU protocol to talk to a CPUM (most of the Modbus code has been removed prior to publishing.) A canned AC and DC spectra is provided to display wave forms on start-up however the project normally polls for spectra from the ISEM and then plots is (that functionality has been removed prior to publishing.)
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI mbed-os BSP_DISCO_F429ZI
Plot of the initial start-up canned AC and DC spectra.
NextGen-Exerciser-Main.cpp@2:346119b3db6c, 2019-05-31 (annotated)
- Committer:
- Damotclese
- Date:
- Fri May 31 22:43:55 2019 +0000
- Revision:
- 2:346119b3db6c
- Parent:
- 1:01394e5db95b
Final concept code update, no further updates are expected;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Damotclese | 0:387684ec9d92 | 1 | |
Damotclese | 0:387684ec9d92 | 2 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 3 | // NextGen-Exerciser-Main.cpp |
Damotclese | 0:387684ec9d92 | 4 | // |
Damotclese | 0:387684ec9d92 | 5 | // Fredric L. Rice, May 2019 |
Damotclese | 0:387684ec9d92 | 6 | // |
Damotclese | 0:387684ec9d92 | 7 | // o The LCD is cleared and configured |
Damotclese | 0:387684ec9d92 | 8 | // o A canned AC and DC 2f water-in-ambient-air spectrum is plotted |
Damotclese | 0:387684ec9d92 | 9 | // on the LCD after the spectrum is "normalized" by making each of |
Damotclese | 0:387684ec9d92 | 10 | // the sample values positive and then compressed so that it fits |
Damotclese | 0:387684ec9d92 | 11 | // in the display |
Damotclese | 0:387684ec9d92 | 12 | // o A thread is created to perform Modbus against a CPUM device |
Damotclese | 0:387684ec9d92 | 13 | // o A thread is created to perform Modbus Tunneling with foreign |
Damotclese | 0:387684ec9d92 | 14 | // frames against an ISEM device |
Damotclese | 0:387684ec9d92 | 15 | // o The main() thread wakes up once a second and performs whatever |
Damotclese | 0:387684ec9d92 | 16 | // other functionality might be desired |
Damotclese | 0:387684ec9d92 | 17 | // |
Damotclese | 0:387684ec9d92 | 18 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 19 | |
Damotclese | 0:387684ec9d92 | 20 | #include "mbed.h" // The mbed operating system |
Damotclese | 0:387684ec9d92 | 21 | #include "NextGen-Exerciser-Modbus.h" // For the CPUM Modbus thread |
Damotclese | 0:387684ec9d92 | 22 | #include "NextGen-Exerciser-Tunnel.h" // For the Modbus Tunnel thread |
Damotclese | 0:387684ec9d92 | 23 | #include "NextGen-Exerciser-Defines.h" // For defined constants and MACROs |
Damotclese | 0:387684ec9d92 | 24 | #include "LCD_DISCO_F429ZI.h" // For controlling the LCD |
Damotclese | 0:387684ec9d92 | 25 | |
Damotclese | 0:387684ec9d92 | 26 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 27 | // Defined constants that we will use here |
Damotclese | 0:387684ec9d92 | 28 | // |
Damotclese | 0:387684ec9d92 | 29 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 30 | |
Damotclese | 0:387684ec9d92 | 31 | #define LCD_WIDTH 240 |
Damotclese | 0:387684ec9d92 | 32 | #define LCD_HEIGHT 320 |
Damotclese | 0:387684ec9d92 | 33 | |
Damotclese | 0:387684ec9d92 | 34 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 35 | // Allocate local data storage |
Damotclese | 0:387684ec9d92 | 36 | // |
Damotclese | 0:387684ec9d92 | 37 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 38 | |
Damotclese | 0:387684ec9d92 | 39 | // Describe a canned 2f AC spectrum consisting of 512 floating point samples |
Damotclese | 0:387684ec9d92 | 40 | // Note that the values after the decimal point are not really needed, they |
Damotclese | 0:387684ec9d92 | 41 | // get discarded when the spectrum values are plotted as integer values. |
Damotclese | 0:387684ec9d92 | 42 | // These values were extracted after Spectra Processor decimated a spectrum |
Damotclese | 0:387684ec9d92 | 43 | // of 65536 samples. We "normalize" the values to make them all positive and |
Damotclese | 0:387684ec9d92 | 44 | // later we take the 512 samples and further "decimate" by averaging every |
Damotclese | 0:387684ec9d92 | 45 | // two samples, resuling in 256 final values. The 256 values get plotted on |
Damotclese | 0:387684ec9d92 | 46 | // to the LCD along the "width" of the display which is 320 pixels, leaving |
Damotclese | 0:387684ec9d92 | 47 | // 64 pixels to the right of the plot free to be used for other things. |
Damotclese | 0:387684ec9d92 | 48 | static float f_decimatedACSpectrum[] = |
Damotclese | 0:387684ec9d92 | 49 | { |
Damotclese | 0:387684ec9d92 | 50 | -1.502448670,9.237028121,18.872425000,27.111267000,33.651569300,38.191074300,40.437301633,40.118068700, |
Damotclese | 0:387684ec9d92 | 51 | 36.992050100,30.858972544,21.569023133,9.031014442,-6.781046860,-25.823335644,-47.979820200,-73.062263400, |
Damotclese | 0:387684ec9d92 | 52 | -100.812744110,-130.908676110,-162.970184330,-196.569778440,-231.243743000,-266.505157440,-301.857879000,-336.811126000, |
Damotclese | 0:387684ec9d92 | 53 | -370.893982000,-403.669342000,-434.746948220,-463.794647220,-490.547790000,-514.816223110,-536.488708440,-555.534729000, |
Damotclese | 0:387684ec9d92 | 54 | -572.003357000,-586.019348110,-597.776916000,-607.531311000,-615.588317000,-622.292602000,-628.014892000,-633.139160110, |
Damotclese | 0:387684ec9d92 | 55 | -638.049499000,-643.118225000,-648.694641110,-655.095459000,-662.597473110,-671.431945000,-681.781494110,-693.779174000, |
Damotclese | 0:387684ec9d92 | 56 | -707.509704000,-723.013183000,-740.289856000,-759.307129000,-780.007019000,-802.314636220,-826.146362330,-851.418640110, |
Damotclese | 0:387684ec9d92 | 57 | -878.054870000,-905.992431000,-935.187500000,-965.618835440,-997.289367000,-1030.226684400,-1064.481080000,-1100.122430000, |
Damotclese | 0:387684ec9d92 | 58 | -1137.235840000,-1175.915650000,-1216.259270000,-1258.360100000,-1302.301140000,-1348.147820000,-1395.942993300,-1445.701293300, |
Damotclese | 0:387684ec9d92 | 59 | -1497.406372200,-1551.007934400,-1606.421874400,-1663.530761100,-1722.186401100,-1782.213134400,-1843.413452200,-1905.572753300, |
Damotclese | 0:387684ec9d92 | 60 | -1968.465942200,-2031.863770000,-2095.539062200,-2159.272210000,-2222.855460000,-2286.097900000,-2348.825683300,-2410.885253300, |
Damotclese | 0:387684ec9d92 | 61 | -2472.140130000,-2532.470214400,-2591.767090000,-2649.928460000,-2706.852294400,-2762.428950000,-2816.533440000,-2869.017333300, |
Damotclese | 0:387684ec9d92 | 62 | -2919.700190000,-2968.362304400,-3014.738520000,-3058.511710000,-3099.308830000,-3136.698974400,-3170.191162200,-3199.236572200, |
Damotclese | 0:387684ec9d92 | 63 | -3223.229492200,-3241.513671100,-3253.386710000,-3258.107421100,-3254.905273300,-3242.988030000,-3221.553710000,-3189.798340000, |
Damotclese | 0:387684ec9d92 | 64 | -3146.928950000,-3092.171142200,-3024.780761100,-2944.051020000,-2849.322510000,-2739.990234400,-2615.509270000,-2475.402343300, |
Damotclese | 0:387684ec9d92 | 65 | -2319.263183300,-2146.761962200,-1957.648560000,-1751.756340000,-1529.004510000,-1289.401733300,-1033.048700000,-760.140625000, |
Damotclese | 0:387684ec9d92 | 66 | -470.970947220,-165.934036220,154.471374000,489.638946000,838.851257330,1201.276733300,1575.967041100,1961.854370000, |
Damotclese | 0:387684ec9d92 | 67 | 2357.750480000,2762.345940000,3174.210693300,3591.797120000,4013.442382200,4437.375480000,4861.724610000,5284.524414400, |
Damotclese | 0:387684ec9d92 | 68 | 5703.730950000,6117.232910000,6522.867180000,6918.436030000,7301.727050000,7670.530761100,8022.663080000,8355.986320000, |
Damotclese | 0:387684ec9d92 | 69 | 8668.431640000,8958.021484400,9222.888671100,9461.302734400,9671.681640000,9852.618164400,10002.893500000,10121.489200000, |
Damotclese | 0:387684ec9d92 | 70 | 10207.603511000,10260.660100000,10280.314400000,10266.458900000,10219.221600000,10138.971600000,10026.307611000,9882.054680000, |
Damotclese | 0:387684ec9d92 | 71 | 9707.252930000,9503.147460000,9271.170890000,9012.928710000,8730.179680000,8424.816400000,8098.844230000,7754.357421100, |
Damotclese | 0:387684ec9d92 | 72 | 7393.519531100,7018.538080000,6631.642570000,6235.063470000,5831.010742200,5421.653800000,5009.104003300,4595.396972200, |
Damotclese | 0:387684ec9d92 | 73 | 4182.478510000,3772.192871100,3366.271484400,2966.325440000,2573.839350000,2190.168450000,1816.535644400,1454.033320000, |
Damotclese | 0:387684ec9d92 | 74 | 1103.623901100,766.144043000,442.308807330,132.717117330,-162.142257000,-441.884216330,-706.220947220,-954.955566440, |
Damotclese | 0:387684ec9d92 | 75 | -1187.975830000,-1405.248901100,-1606.816040000,-1792.787720000,-1963.340570000,-2118.713134400,-2259.203370000,-2385.165283300, |
Damotclese | 0:387684ec9d92 | 76 | -2497.007812200,-2595.190430000,-2680.222412200,-2752.658203300,-2813.093994400,-2862.164550000,-2900.537590000,-2928.907950000, |
Damotclese | 0:387684ec9d92 | 77 | -2947.991700000,-2958.517822200,-2961.222650000,-2956.839350000,-2946.091552200,-2929.683350000,-2908.292230000,-2882.560540000, |
Damotclese | 0:387684ec9d92 | 78 | -2853.090080000,-2820.434082200,-2785.094482200,-2747.517333300,-2708.092041100,-2667.150140000,-2624.968500000,-2581.769770000, |
Damotclese | 0:387684ec9d92 | 79 | -2537.729730000,-2492.980224400,-2447.618164400,-2401.711420000,-2355.307120000,-2308.439690000,-2261.137940000,-2213.432861100, |
Damotclese | 0:387684ec9d92 | 80 | -2165.363520000,-2116.981440000,-2068.355224400,-2019.572380000,-1970.740350000,-1921.984980000,-1873.449340000,-1825.289550000, |
Damotclese | 0:387684ec9d92 | 81 | -1777.670043300,-1730.759150000,-1684.721923300,-1639.715080000,-1595.880493300,-1553.340080000,-1512.190790000,-1472.501342200, |
Damotclese | 0:387684ec9d92 | 82 | -1434.309570000,-1397.621210000,-1362.410760000,-1328.622680000,-1296.175292200,-1264.964600000,-1234.869873300,-1205.759880000, |
Damotclese | 0:387684ec9d92 | 83 | -1177.499140000,-1149.954711100,-1123.002800000,-1096.534050000,-1070.459472200,-1044.713134400,-1019.255790000,-994.075744000, |
Damotclese | 0:387684ec9d92 | 84 | -969.188293440,-944.634338330,-920.477295000,-896.798462000,-873.692077000,-851.259216330,-829.601562440,-808.814880330, |
Damotclese | 0:387684ec9d92 | 85 | -788.983154220,-770.172973000,-752.429016110,-735.770691000,-720.190063440,-705.651245110,-692.091308000,-679.422546330, |
Damotclese | 0:387684ec9d92 | 86 | -667.536193000,-656.307312000,-645.600402000,-635.275817000,-625.196350000,-615.233886000,-605.275512000,-595.229004000, |
Damotclese | 0:387684ec9d92 | 87 | -585.027282000,-574.631591000,-564.033447220,-553.254821000,-542.346923000,-531.387756330,-520.477966330,-509.735595000, |
Damotclese | 0:387684ec9d92 | 88 | -499.290527330,-489.277618440,-479.830261220,-471.073608330,-463.118743000,-456.057190000,-449.956909110,-444.859253000, |
Damotclese | 0:387684ec9d92 | 89 | -440.777649000,-437.697479220,-435.577880000,-434.354522000,-433.944000220,-434.248993000,-435.164337110,-436.583465000, |
Damotclese | 0:387684ec9d92 | 90 | -438.404754000,-440.537933330,-442.909454330,-445.467254000,-448.184082000,-451.059661000,-454.121124220,-457.422180110, |
Damotclese | 0:387684ec9d92 | 91 | -461.040466330,-465.073761000,-469.634948000,-474.846222000,-480.832397440,-487.714386000,-495.602508000,-504.590667000, |
Damotclese | 0:387684ec9d92 | 92 | -514.750915000,-526.129760000,-538.745178220,-552.586059000,-567.612426000,-583.757812440,-600.933227000,-619.031982440, |
Damotclese | 0:387684ec9d92 | 93 | -637.936096110,-657.523071220,-677.673339000,-698.277160000,-719.241394000,-740.495056110,-761.993713330,-783.721740000, |
Damotclese | 0:387684ec9d92 | 94 | -805.693237330,-827.950134220,-850.558349000,-873.601989000,-897.174682000,-921.369873000,-946.269043000,-971.929199220, |
Damotclese | 0:387684ec9d92 | 95 | -998.369567000,-1025.558350000,-1053.400024400,-1081.723632200,-1110.273071100,-1138.698974400,-1166.554560000,-1193.292602200, |
Damotclese | 0:387684ec9d92 | 96 | -1218.267211100,-1240.738770000,-1259.881470000,-1274.795280000,-1284.520751100,-1288.056152200,-1284.377800000,-1272.461420000, |
Damotclese | 0:387684ec9d92 | 97 | -1251.305900000,-1219.956910000,-1177.530883300,-1123.238160000,-1056.406250000,-976.499206000,-883.136718000,-776.109497000, |
Damotclese | 0:387684ec9d92 | 98 | -655.391845000,-521.151001000,-373.752929000,-213.764404220,-41.951789800,140.723938000,333.115356440,533.900024440, |
Damotclese | 0:387684ec9d92 | 99 | 741.594665000,954.571960440,1171.079711100,1389.261840000,1607.181152200,1822.842651100,2034.219230000,2239.276360000, |
Damotclese | 0:387684ec9d92 | 100 | 2435.997802200,2622.412110000,2796.617180000,2956.805420000,3101.288080000,3228.517822200,3337.110590000,3425.865234400, |
Damotclese | 0:387684ec9d92 | 101 | 3493.781000000,3540.073974400,3564.189453300,3565.812744400,3544.875244400,3501.559570000,3436.298820000,3349.772700000, |
Damotclese | 0:387684ec9d92 | 102 | 3242.901850000,3116.834472200,2972.933350000,2812.756340000,2638.033691100,2450.644531100,2252.587640000,2045.952140000, |
Damotclese | 0:387684ec9d92 | 103 | 1832.885253300,1615.559814400,1396.141350000,1176.755120000,959.454528000,746.191284110,538.787902000,338.913055440, |
Damotclese | 0:387684ec9d92 | 104 | 148.060974110,-32.465728700,-201.568542440,-358.361267000,-502.173584000,-632.550109000,-749.244995110,-852.212768000, |
Damotclese | 0:387684ec9d92 | 105 | -941.595398000,-1017.705932200,-1081.010010000,-1132.105340000,-1171.699584400,-1200.587760000,-1219.629394400,-1229.727172200, |
Damotclese | 0:387684ec9d92 | 106 | -1231.805170000,-1226.789910000,-1215.592890000,-1199.095330000,-1178.135864400,-1153.499633300,-1125.911621100,-1096.030510000, |
Damotclese | 0:387684ec9d92 | 107 | -1064.447021100,-1031.682000000,-998.188537000,-964.353820000,-930.503479000,-896.906066000,-863.778503440,-831.291504000, |
Damotclese | 0:387684ec9d92 | 108 | -799.575500440,-768.725891110,-738.808532000,-709.864502000,-681.914245000,-654.961486000,-628.996582000,-603.999267000, |
Damotclese | 0:387684ec9d92 | 109 | -579.941101000,-556.787353000,-534.498901330,-513.033691440,-492.348114000,-472.398071220,-453.140289330,-434.533050000, |
Damotclese | 0:387684ec9d92 | 110 | -416.537292440,-399.117187440,-382.240600000,-365.879577000,-350.010192000,-334.612487000,-319.669769220,-305.167755110, |
Damotclese | 0:387684ec9d92 | 111 | -291.093566000,-277.434234000,-264.175262440,-251.299041000,-238.783386220,-226.600113000,-214.714141000,-203.082885000, |
Damotclese | 0:387684ec9d92 | 112 | -191.656234000,-180.377243000,-169.183487000,-158.009185000,-146.788055440,-135.456863440,-123.959488000,-112.251495330, |
Damotclese | 0:387684ec9d92 | 113 | -100.304824000,-88.112571711,-75.693458500,-63.095802300,-50.400745400,-37.724391933,-25.218734744,-13.071174622 |
Damotclese | 0:387684ec9d92 | 114 | } ; |
Damotclese | 1:01394e5db95b | 115 | |
Damotclese | 1:01394e5db95b | 116 | static float f_decimatedDCSpectrum[] = |
Damotclese | 1:01394e5db95b | 117 | { |
Damotclese | 1:01394e5db95b | 118 | 164622.859, 156185.187, 130679.648, 94457.766, 60629.086, 35816.664, 20260.646, 12169.420, |
Damotclese | 1:01394e5db95b | 119 | 9521.371, 9680.042, 10389.553, 14924.355, 29797.771, 54048.340, 79677.930, 100584.007, |
Damotclese | 1:01394e5db95b | 120 | 114916.859, 123130.789, 126640.937, 127108.539, 125978.539, 124264.656, 122565.765, 121160.593, |
Damotclese | 1:01394e5db95b | 121 | 120120.234, 119405.492, 118934.531, 118622.812, 118402.031, 118224.390, 118060.507, 117896.296, |
Damotclese | 1:01394e5db95b | 122 | 117727.086, 117552.828, 117375.304, 117196.453, 117017.570, 116837.726, 116656.039, 116473.492, |
Damotclese | 1:01394e5db95b | 123 | 116289.906, 116104.265, 115915.937, 115723.570, 115526.664, 115325.656, 115120.421, 114911.429, |
Damotclese | 1:01394e5db95b | 124 | 114697.828, 114476.804, 114247.992, 114013.179, 113771.867, 113522.140, 113264.578, 113002.109, |
Damotclese | 1:01394e5db95b | 125 | 112735.640, 112462.671, 112182.187, 111892.171, 111590.554, 111280.000, 110962.125, 110639.429, |
Damotclese | 1:01394e5db95b | 126 | 110312.679, 109975.781, 109623.398, 109255.132, 108878.789, 108498.742, 108109.039, 107706.664, |
Damotclese | 1:01394e5db95b | 127 | 107291.461, 106863.039, 106420.086, 105960.101, 105483.578, 104994.242, 104495.437, 103984.203, |
Damotclese | 1:01394e5db95b | 128 | 103457.976, 102917.992, 102363.515, 101794.343, 101214.031, 100629.211, 100040.492, 99439.859, |
Damotclese | 1:01394e5db95b | 129 | 98819.461, 98173.063, 97503.469, 96825.117, 96144.188, 95452.000, 94738.039, 93996.977, |
Damotclese | 1:01394e5db95b | 130 | 93228.984, 92435.734, 91625.875, 90815.219, 90004.086, 89177.555, 88331.219, 87471.523, |
Damotclese | 1:01394e5db95b | 131 | 86607.555, 85742.336, 84864.008, 83967.336, 83058.867, 82140.016, 81212.930, 80285.523, |
Damotclese | 1:01394e5db95b | 132 | 79358.758, 78424.992, 77494.000, 76579.289, 75662.469, 74731.563, 73808.039, 72908.133, |
Damotclese | 1:01394e5db95b | 133 | 72025.875, 71144.391, 70256.500, 69372.094, 68501.109, 67648.109, 66813.898, 65996.867, |
Damotclese | 1:01394e5db95b | 134 | 65195.641, 64414.758, 63665.418, 62947.723, 62251.930, 61577.820, 60930.938, 60310.703, |
Damotclese | 1:01394e5db95b | 135 | 59717.070, 59153.746, 58622.043, 58124.535, 57664.281, 57239.590, 56849.543, 56495.852, |
Damotclese | 1:01394e5db95b | 136 | 56177.289, 55892.000, 55643.016, 55431.777, 55257.840, 55124.254, 55029.434, 54971.840, |
Damotclese | 1:01394e5db95b | 137 | 54955.445, 54979.289, 55040.957, 55139.879, 55278.230, 55457.840, 55673.457, 55925.805, |
Damotclese | 1:01394e5db95b | 138 | 56220.500, 56554.961, 56925.184, 57330.996, 57773.441, 58253.074, 58770.402, 59326.258, |
Damotclese | 1:01394e5db95b | 139 | 59917.891, 60538.234, 61187.504, 61875.184, 62605.102, 63370.285, 64161.137, 64974.477, |
Damotclese | 1:01394e5db95b | 140 | 65816.297, 66691.320, 67592.148, 68503.984, 69422.414, 70364.266, 71343.883, 72351.906, |
Damotclese | 1:01394e5db95b | 141 | 73372.016, 74390.320, 75401.859, 76421.227, 77464.242, 78523.742, 79582.586, 80642.227, |
Damotclese | 1:01394e5db95b | 142 | 81714.758, 82804.367, 83906.422, 85006.211, 86092.281, 87169.992, 88245.125, 89310.359, |
Damotclese | 1:01394e5db95b | 143 | 90360.758, 91407.516, 92457.242, 93497.219, 94524.414, 95552.211, 96577.430, 97588.609, |
Damotclese | 1:01394e5db95b | 144 | 98588.539, 99575.063, 100543.234, 101498.179, 102434.992, 103344.476, 104234.867, 105114.281, |
Damotclese | 1:01394e5db95b | 145 | 105982.656, 106839.539, 107682.593, 108518.468, 109349.765, 110166.625, 110967.500, 111753.843, |
Damotclese | 1:01394e5db95b | 146 | 112524.437, 113279.453, 114016.820, 114732.929, 115433.171, 116129.640, 116820.101, 117493.351, |
Damotclese | 1:01394e5db95b | 147 | 118144.578, 118774.367, 119390.500, 119997.554, 120589.562, 121168.031, 121741.507, 122308.328, |
Damotclese | 1:01394e5db95b | 148 | 122861.468, 123400.164, 123925.187, 124437.125, 124944.039, 125448.539, 125940.484, 126416.187, |
Damotclese | 1:01394e5db95b | 149 | 126881.367, 127340.125, 127790.164, 128227.226, 128651.578, 129064.890, 129469.812, 129867.937, |
Damotclese | 1:01394e5db95b | 150 | 130259.703, 130648.023, 131031.523, 131406.046, 131770.140, 132124.406, 132471.937, 132814.875, |
Damotclese | 1:01394e5db95b | 151 | 133153.359, 133487.703, 133816.296, 134134.171, 134439.421, 134738.953, 135040.187, 135338.218, |
Damotclese | 1:01394e5db95b | 152 | 135628.468, 135915.687, 136198.750, 136474.656, 136746.062, 137011.234, 137270.937, 137531.343, |
Damotclese | 1:01394e5db95b | 153 | 137787.781, 138033.875, 138274.046, 138511.078, 138741.453, 138967.078, 139194.343, 139418.796, |
Damotclese | 1:01394e5db95b | 154 | 139635.859, 139849.718, 140059.359, 140263.546, 140464.187, 140661.343, 140856.937, 141051.328, |
Damotclese | 1:01394e5db95b | 155 | 141241.859, 141427.875, 141610.156, 141789.250, 141965.359, 142139.234, 142310.125, 142476.343, |
Damotclese | 1:01394e5db95b | 156 | 142639.187, 142799.046, 142954.359, 143106.234, 143255.687, 143402.343, 143547.250, 143690.609, |
Damotclese | 1:01394e5db95b | 157 | 143830.875, 143967.234, 144099.421, 144228.046, 144353.625, 144475.734, 144594.656, 144710.671, |
Damotclese | 1:01394e5db95b | 158 | 144823.093, 144931.390, 145036.046, 145138.921, 145240.593, 145339.421, 145434.562, 145525.906, |
Damotclese | 1:01394e5db95b | 159 | 145612.765, 145694.562, 145771.609, 145845.453, 145916.843, 145984.953, 146049.296, 146109.531, |
Damotclese | 1:01394e5db95b | 160 | 146165.484, 146216.843, 146262.718, 146304.031, 146341.515, 146373.906, 146400.953, 146423.250, |
Damotclese | 1:01394e5db95b | 161 | 146440.265, 146451.703, 146457.453, 146456.968, 146450.687, 146439.015, 146420.750, 146395.453, |
Damotclese | 1:01394e5db95b | 162 | 146364.703, 146329.000, 146286.328, 146235.890, 146179.187, 146116.390, 146046.562, 145970.250, |
Damotclese | 1:01394e5db95b | 163 | 145888.875, 145802.343, 145709.578, 145611.015, 145507.875, 145400.656, 145289.718, 145175.437, |
Damotclese | 1:01394e5db95b | 164 | 145058.906, 144941.578, 144823.593, 144704.640, 144585.046, 144464.984, 144345.546, 144229.687, |
Damotclese | 1:01394e5db95b | 165 | 144119.281, 144013.609, 143912.671, 143818.609, 143732.531, 143654.062, 143584.265, 143524.062, |
Damotclese | 1:01394e5db95b | 166 | 143472.843, 143430.656, 143398.421, 143376.796, 143365.031, 143361.171, 143364.421, 143375.312, |
Damotclese | 1:01394e5db95b | 167 | 143393.546, 143417.750, 143448.921, 143488.828, 143537.078, 143593.468, 143657.265, 143727.843, |
Damotclese | 1:01394e5db95b | 168 | 143806.734, 143893.125, 143984.609, 144081.359, 144184.625, 144293.546, 144406.218, 144524.500, |
Damotclese | 1:01394e5db95b | 169 | 144650.468, 144782.187, 144918.953, 145061.843, 145211.578, 145369.562, 145536.781, 145712.218, |
Damotclese | 1:01394e5db95b | 170 | 145895.156, 146085.937, 146284.156, 146491.125, 146708.437, 146934.328, 147168.796, 147413.734, |
Damotclese | 1:01394e5db95b | 171 | 147668.906, 147933.296, 148206.078, 148487.953, 148777.734, 149071.968, 149373.265, 149686.093, |
Damotclese | 1:01394e5db95b | 172 | 150007.109, 150328.703, 150648.953, 150969.625, 151287.671, 151603.171, 151921.078, 152239.421, |
Damotclese | 1:01394e5db95b | 173 | 152552.781, 152860.218, 153163.453, 153463.234, 153758.718, 154050.921, 154341.515, 154628.250, |
Damotclese | 1:01394e5db95b | 174 | 154907.796, 155179.656, 155444.531, 155703.500, 155957.656, 156205.265, 156446.359, 156685.718, |
Damotclese | 1:01394e5db95b | 175 | 156922.781, 157152.437, 157374.281, 157590.484, 157802.796, 158010.562, 158211.375, 158407.156, |
Damotclese | 1:01394e5db95b | 176 | 158600.015, 158787.093, 158967.703, 159144.312, 159317.187, 159486.218, 159652.437, 159816.218, |
Damotclese | 1:01394e5db95b | 177 | 159976.906, 160135.031, 160291.250, 160443.359, 160590.359, 160733.843, 160875.171, 161015.390, |
Damotclese | 1:01394e5db95b | 178 | 161154.515, 161291.843, 161427.000, 161559.953, 161689.953, 161815.781, 161939.203, 162063.375, |
Damotclese | 1:01394e5db95b | 179 | 162187.312, 162307.875, 162424.328, 162538.328, 162651.750, 162765.296, 162878.078, 162987.562, |
Damotclese | 1:01394e5db95b | 180 | 163093.531, 163199.171, 163305.312, 163410.593, 163514.609, 163617.453, 163720.437, 163824.093, |
Damotclese | 1:01394e5db95b | 181 | 163926.906, 164028.125, 164126.515, 164224.531, 164334.281, 164304.281, 163889.750, 164209.968 |
Damotclese | 1:01394e5db95b | 182 | } ; |
Damotclese | 0:387684ec9d92 | 183 | |
Damotclese | 0:387684ec9d92 | 184 | // We will be using the LCD so instantiate an object locally |
Damotclese | 0:387684ec9d92 | 185 | static LCD_DISCO_F429ZI st_lcd; |
Damotclese | 0:387684ec9d92 | 186 | |
Damotclese | 0:387684ec9d92 | 187 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 188 | // MainProcessDecimatedSpectrum() |
Damotclese | 0:387684ec9d92 | 189 | // |
Damotclese | 0:387684ec9d92 | 190 | // This function will: |
Damotclese | 0:387684ec9d92 | 191 | // o Search through the AC spectra and the DC spectra looking for |
Damotclese | 0:387684ec9d92 | 192 | // the smallest and the highest numeric values in both |
Damotclese | 0:387684ec9d92 | 193 | // o Convert the smallest number in to an absolute value by removing |
Damotclese | 0:387684ec9d92 | 194 | // the sign bit using the ANSI absolute function |
Damotclese | 0:387684ec9d92 | 195 | // o Add that now-positive smallest number to every sample in the |
Damotclese | 0:387684ec9d92 | 196 | // AC and DC spectrums so that each value in the spectrums are |
Damotclese | 0:387684ec9d92 | 197 | // positive values |
Damotclese | 0:387684ec9d92 | 198 | // o Add that smallest value to the known largest value so that it |
Damotclese | 0:387684ec9d92 | 199 | // agrees with the rest of the spectrum again |
Damotclese | 0:387684ec9d92 | 200 | // o Compute a ratio derived by dividing the ;argest known value |
Damotclese | 0:387684ec9d92 | 201 | // by the "width" of the screen |
Damotclese | 0:387684ec9d92 | 202 | // o Goes through all 512 samples and averages them two by two, |
Damotclese | 0:387684ec9d92 | 203 | // compressing the spectrum in place (in the same array of values) |
Damotclese | 0:387684ec9d92 | 204 | // so that we end up with 256 samples which can fit on the LCD |
Damotclese | 0:387684ec9d92 | 205 | // o Divides each of the 256 samples by the radio so that each of |
Damotclese | 0:387684ec9d92 | 206 | // the samples will fit on the LCD |
Damotclese | 0:387684ec9d92 | 207 | // |
Damotclese | 0:387684ec9d92 | 208 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 209 | static void MainProcessDecimatedSpectrum(void) |
Damotclese | 0:387684ec9d92 | 210 | { |
Damotclese | 1:01394e5db95b | 211 | uint16_t u16_searchLoop = 0; |
Damotclese | 1:01394e5db95b | 212 | uint32_t u32_sampleACRatio = 0; |
Damotclese | 1:01394e5db95b | 213 | uint32_t u32_sampleDCRatio = 0; |
Damotclese | 1:01394e5db95b | 214 | uint16_t u16_resultIndex = 0; |
Damotclese | 1:01394e5db95b | 215 | float f_smallACNumber = 10000000.0f; |
Damotclese | 1:01394e5db95b | 216 | float f_largeACNumber = 0.0f; |
Damotclese | 1:01394e5db95b | 217 | float f_smallDCNumber = 10000000.0f; |
Damotclese | 1:01394e5db95b | 218 | float f_largeDCNumber = 0.0f; |
Damotclese | 0:387684ec9d92 | 219 | |
Damotclese | 0:387684ec9d92 | 220 | // Search through the AC spectrum for the smallest and the largest values |
Damotclese | 0:387684ec9d92 | 221 | for (u16_searchLoop = 0; u16_searchLoop < 512; u16_searchLoop++) |
Damotclese | 0:387684ec9d92 | 222 | { |
Damotclese | 1:01394e5db95b | 223 | // First do the AC SPectrum |
Damotclese | 1:01394e5db95b | 224 | if (f_decimatedACSpectrum[u16_searchLoop] < f_smallACNumber) |
Damotclese | 0:387684ec9d92 | 225 | { |
Damotclese | 0:387684ec9d92 | 226 | // This value is the new lowest number |
Damotclese | 1:01394e5db95b | 227 | f_smallACNumber = f_decimatedACSpectrum[u16_searchLoop]; |
Damotclese | 1:01394e5db95b | 228 | } |
Damotclese | 1:01394e5db95b | 229 | |
Damotclese | 1:01394e5db95b | 230 | if (f_decimatedACSpectrum[u16_searchLoop] > f_largeACNumber) |
Damotclese | 1:01394e5db95b | 231 | { |
Damotclese | 1:01394e5db95b | 232 | // This value is the new highest number |
Damotclese | 1:01394e5db95b | 233 | f_largeACNumber = f_decimatedACSpectrum[u16_searchLoop]; |
Damotclese | 0:387684ec9d92 | 234 | } |
Damotclese | 0:387684ec9d92 | 235 | |
Damotclese | 1:01394e5db95b | 236 | // Now do the DC spectrum |
Damotclese | 1:01394e5db95b | 237 | if (f_decimatedDCSpectrum[u16_searchLoop] < f_smallDCNumber) |
Damotclese | 1:01394e5db95b | 238 | { |
Damotclese | 1:01394e5db95b | 239 | // This value is the new lowest number |
Damotclese | 1:01394e5db95b | 240 | f_smallDCNumber = f_decimatedDCSpectrum[u16_searchLoop]; |
Damotclese | 1:01394e5db95b | 241 | } |
Damotclese | 1:01394e5db95b | 242 | |
Damotclese | 1:01394e5db95b | 243 | if (f_decimatedDCSpectrum[u16_searchLoop] > f_largeDCNumber) |
Damotclese | 0:387684ec9d92 | 244 | { |
Damotclese | 0:387684ec9d92 | 245 | // This value is the new highest number |
Damotclese | 1:01394e5db95b | 246 | f_largeDCNumber = f_decimatedDCSpectrum[u16_searchLoop]; |
Damotclese | 0:387684ec9d92 | 247 | } |
Damotclese | 0:387684ec9d92 | 248 | } |
Damotclese | 0:387684ec9d92 | 249 | |
Damotclese | 1:01394e5db95b | 250 | // Is the smallest AC number negative? We know that it is but we check |
Damotclese | 1:01394e5db95b | 251 | if (f_smallACNumber < 0.0f) |
Damotclese | 0:387684ec9d92 | 252 | { |
Damotclese | 0:387684ec9d92 | 253 | // Make the value absolute so that it is positive |
Damotclese | 1:01394e5db95b | 254 | f_smallACNumber = abs(f_smallACNumber); |
Damotclese | 0:387684ec9d92 | 255 | } |
Damotclese | 0:387684ec9d92 | 256 | |
Damotclese | 1:01394e5db95b | 257 | // Is the smallest DC number negative? |
Damotclese | 1:01394e5db95b | 258 | if (f_smallDCNumber < 0.0f) |
Damotclese | 1:01394e5db95b | 259 | { |
Damotclese | 1:01394e5db95b | 260 | // Make the value absolute so that it is positive |
Damotclese | 1:01394e5db95b | 261 | f_smallDCNumber = abs(f_smallDCNumber); |
Damotclese | 1:01394e5db95b | 262 | } |
Damotclese | 1:01394e5db95b | 263 | |
Damotclese | 0:387684ec9d92 | 264 | // To make all values positive, add the newly-derived positive value. |
Damotclese | 0:387684ec9d92 | 265 | // This makes all numbers positive and ensures that the smallest |
Damotclese | 0:387684ec9d92 | 266 | // value in the spectra is zero. |
Damotclese | 0:387684ec9d92 | 267 | for (u16_searchLoop = 0; u16_searchLoop < 512; u16_searchLoop++) |
Damotclese | 0:387684ec9d92 | 268 | { |
Damotclese | 1:01394e5db95b | 269 | // Do the AC spectrum |
Damotclese | 1:01394e5db95b | 270 | f_decimatedACSpectrum[u16_searchLoop] += f_smallACNumber; |
Damotclese | 1:01394e5db95b | 271 | |
Damotclese | 1:01394e5db95b | 272 | // Do the DC spectrum |
Damotclese | 1:01394e5db95b | 273 | f_decimatedDCSpectrum[u16_searchLoop] += f_smallDCNumber; |
Damotclese | 0:387684ec9d92 | 274 | } |
Damotclese | 0:387684ec9d92 | 275 | |
Damotclese | 0:387684ec9d92 | 276 | // Also add the newly-positive number to our largest known value |
Damotclese | 1:01394e5db95b | 277 | f_largeACNumber += f_smallACNumber; |
Damotclese | 1:01394e5db95b | 278 | f_largeDCNumber += f_smallDCNumber; |
Damotclese | 0:387684ec9d92 | 279 | |
Damotclese | 0:387684ec9d92 | 280 | // Determine the ratio to use, the LCD screen is 240 by 320 so we |
Damotclese | 0:387684ec9d92 | 281 | // take the highest number value in the spectra and divide by 240 |
Damotclese | 0:387684ec9d92 | 282 | // for the verticle plot, and we have 512 samples which will be |
Damotclese | 0:387684ec9d92 | 283 | // plotted across the 320 by averaging every 2 samples to yield |
Damotclese | 0:387684ec9d92 | 284 | // 256 horizontal positions. We plot with the screen laying on |
Damotclese | 0:387684ec9d92 | 285 | // its side |
Damotclese | 1:01394e5db95b | 286 | u32_sampleACRatio = (f_largeACNumber / LCD_WIDTH); |
Damotclese | 1:01394e5db95b | 287 | u32_sampleDCRatio = (f_largeDCNumber / LCD_WIDTH); |
Damotclese | 0:387684ec9d92 | 288 | |
Damotclese | 0:387684ec9d92 | 289 | // Go through each pairs of samples and average them and then |
Damotclese | 0:387684ec9d92 | 290 | // divide the result by the ratio. Step through in twos |
Damotclese | 0:387684ec9d92 | 291 | for (u16_searchLoop = 0; u16_searchLoop < 512; u16_searchLoop += 2, u16_resultIndex++) |
Damotclese | 0:387684ec9d92 | 292 | { |
Damotclese | 1:01394e5db95b | 293 | // Take the next two AC samples and average them, putting the result |
Damotclese | 0:387684ec9d92 | 294 | // in to the next result index of the same buffer we're processing |
Damotclese | 0:387684ec9d92 | 295 | f_decimatedACSpectrum[u16_resultIndex] = |
Damotclese | 0:387684ec9d92 | 296 | (f_decimatedACSpectrum[u16_searchLoop] + f_decimatedACSpectrum[u16_searchLoop]) / 2; |
Damotclese | 0:387684ec9d92 | 297 | |
Damotclese | 0:387684ec9d92 | 298 | // Divide the sample value by the ratio |
Damotclese | 1:01394e5db95b | 299 | f_decimatedACSpectrum[u16_resultIndex] /= u32_sampleACRatio; |
Damotclese | 1:01394e5db95b | 300 | |
Damotclese | 1:01394e5db95b | 301 | // Take the next two DC samples and average them, putting the result |
Damotclese | 1:01394e5db95b | 302 | // in to the next result index of the same buffer we're processing |
Damotclese | 1:01394e5db95b | 303 | f_decimatedDCSpectrum[u16_resultIndex] = |
Damotclese | 1:01394e5db95b | 304 | (f_decimatedDCSpectrum[u16_searchLoop] + f_decimatedDCSpectrum[u16_searchLoop]) / 2; |
Damotclese | 1:01394e5db95b | 305 | |
Damotclese | 1:01394e5db95b | 306 | // Divide the sample value by the ratio |
Damotclese | 1:01394e5db95b | 307 | f_decimatedDCSpectrum[u16_resultIndex] /= u32_sampleDCRatio; |
Damotclese | 0:387684ec9d92 | 308 | } |
Damotclese | 0:387684ec9d92 | 309 | } |
Damotclese | 0:387684ec9d92 | 310 | |
Damotclese | 0:387684ec9d92 | 311 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 312 | // MainPlotFinalSpectrum() |
Damotclese | 0:387684ec9d92 | 313 | // |
Damotclese | 0:387684ec9d92 | 314 | // This function will step through the "normalized" and compressed AC |
Damotclese | 0:387684ec9d92 | 315 | // and DC spectrums consisting of 256 samples and will plot a line from |
Damotclese | 0:387684ec9d92 | 316 | // one sample to the next on the LCD |
Damotclese | 0:387684ec9d92 | 317 | // |
Damotclese | 0:387684ec9d92 | 318 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 319 | static void MainPlotFinalSpectrum(void) |
Damotclese | 0:387684ec9d92 | 320 | { |
Damotclese | 0:387684ec9d92 | 321 | uint16_t u16_searchLoop = 0; |
Damotclese | 0:387684ec9d92 | 322 | |
Damotclese | 0:387684ec9d92 | 323 | // Plot the spectrum values, plotting a line from point to point |
Damotclese | 0:387684ec9d92 | 324 | for (u16_searchLoop = 0; u16_searchLoop < ((512 / 2) - 1); u16_searchLoop++) |
Damotclese | 0:387684ec9d92 | 325 | { |
Damotclese | 1:01394e5db95b | 326 | // Ensure that we actually fit. The AC sample should |
Damotclese | 0:387684ec9d92 | 327 | if (f_decimatedACSpectrum[u16_searchLoop] <= LCD_WIDTH) |
Damotclese | 0:387684ec9d92 | 328 | { |
Damotclese | 0:387684ec9d92 | 329 | st_lcd.DrawLine(f_decimatedACSpectrum[u16_searchLoop], u16_searchLoop, |
Damotclese | 0:387684ec9d92 | 330 | f_decimatedACSpectrum[u16_searchLoop + 1], u16_searchLoop + 1); |
Damotclese | 0:387684ec9d92 | 331 | } |
Damotclese | 0:387684ec9d92 | 332 | else |
Damotclese | 0:387684ec9d92 | 333 | { |
Damotclese | 0:387684ec9d92 | 334 | // Mathematically we topped-out past the maximum some how |
Damotclese | 0:387684ec9d92 | 335 | st_lcd.DrawPixel(0, u16_searchLoop, LCD_COLOR_WHITE); |
Damotclese | 0:387684ec9d92 | 336 | } |
Damotclese | 1:01394e5db95b | 337 | |
Damotclese | 1:01394e5db95b | 338 | // Ensure that we actually fit. The DC sample should |
Damotclese | 1:01394e5db95b | 339 | if (f_decimatedDCSpectrum[u16_searchLoop] <= LCD_WIDTH) |
Damotclese | 1:01394e5db95b | 340 | { |
Damotclese | 1:01394e5db95b | 341 | st_lcd.DrawLine(f_decimatedDCSpectrum[u16_searchLoop], u16_searchLoop, |
Damotclese | 1:01394e5db95b | 342 | f_decimatedDCSpectrum[u16_searchLoop + 1], u16_searchLoop + 1); |
Damotclese | 1:01394e5db95b | 343 | } |
Damotclese | 1:01394e5db95b | 344 | else |
Damotclese | 1:01394e5db95b | 345 | { |
Damotclese | 1:01394e5db95b | 346 | // Mathematically we topped-out past the maximum some how |
Damotclese | 1:01394e5db95b | 347 | st_lcd.DrawPixel(0, u16_searchLoop, LCD_COLOR_WHITE); |
Damotclese | 1:01394e5db95b | 348 | } |
Damotclese | 1:01394e5db95b | 349 | } |
Damotclese | 1:01394e5db95b | 350 | } |
Damotclese | 1:01394e5db95b | 351 | |
Damotclese | 1:01394e5db95b | 352 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 353 | // MainInit() |
Damotclese | 0:387684ec9d92 | 354 | // |
Damotclese | 0:387684ec9d92 | 355 | // This function will: |
Damotclese | 0:387684ec9d92 | 356 | // o Clear and initialize the LCD |
Damotclese | 0:387684ec9d92 | 357 | // o Process the scanned decimated 2f AC and DC spectrums |
Damotclese | 0:387684ec9d92 | 358 | // o Plot the processed spectrums |
Damotclese | 0:387684ec9d92 | 359 | // |
Damotclese | 0:387684ec9d92 | 360 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 361 | static void MainInit(void) |
Damotclese | 0:387684ec9d92 | 362 | { |
Damotclese | 0:387684ec9d92 | 363 | // Bring the LCD up and set its various colors |
Damotclese | 0:387684ec9d92 | 364 | st_lcd.Clear(LCD_COLOR_BLACK); |
Damotclese | 0:387684ec9d92 | 365 | st_lcd.SetBackColor(LCD_COLOR_BLACK); |
Damotclese | 0:387684ec9d92 | 366 | st_lcd.SetTextColor(LCD_COLOR_WHITE); |
Damotclese | 0:387684ec9d92 | 367 | |
Damotclese | 0:387684ec9d92 | 368 | // Process the decimated spectrum and then plot it |
Damotclese | 0:387684ec9d92 | 369 | MainProcessDecimatedSpectrum(); |
Damotclese | 0:387684ec9d92 | 370 | MainPlotFinalSpectrum(); |
Damotclese | 0:387684ec9d92 | 371 | } |
Damotclese | 0:387684ec9d92 | 372 | |
Damotclese | 0:387684ec9d92 | 373 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 374 | // MainThread() |
Damotclese | 0:387684ec9d92 | 375 | // |
Damotclese | 0:387684ec9d92 | 376 | // Called once a second. |
Damotclese | 0:387684ec9d92 | 377 | // |
Damotclese | 0:387684ec9d92 | 378 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 379 | static void MainThread(void) |
Damotclese | 0:387684ec9d92 | 380 | { |
Damotclese | 0:387684ec9d92 | 381 | } |
Damotclese | 0:387684ec9d92 | 382 | |
Damotclese | 0:387684ec9d92 | 383 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 384 | // main() |
Damotclese | 0:387684ec9d92 | 385 | // |
Damotclese | 0:387684ec9d92 | 386 | // This is the main entry point which the operating system will load |
Damotclese | 0:387684ec9d92 | 387 | // and execute on power-up after the OS completes its own start-up |
Damotclese | 0:387684ec9d92 | 388 | // functionality. |
Damotclese | 0:387684ec9d92 | 389 | // |
Damotclese | 0:387684ec9d92 | 390 | // The function will: |
Damotclese | 0:387684ec9d92 | 391 | // o Initialize this module's functionality |
Damotclese | 0:387684ec9d92 | 392 | // o Launch the MODBUS CPUM thread |
Damotclese | 0:387684ec9d92 | 393 | // o Launch the Modbus Tunnel thread |
Damotclese | 0:387684ec9d92 | 394 | // o Enter in to a forever loop which should never terminate, |
Damotclese | 0:387684ec9d92 | 395 | // waking up once a second to perform any additional desired |
Damotclese | 0:387684ec9d92 | 396 | // functionality |
Damotclese | 0:387684ec9d92 | 397 | // |
Damotclese | 0:387684ec9d92 | 398 | // ---------------------------------------------------------------------- |
Damotclese | 0:387684ec9d92 | 399 | int main(void) |
Damotclese | 0:387684ec9d92 | 400 | { |
Damotclese | 0:387684ec9d92 | 401 | // Perform local module initialization, if any |
Damotclese | 0:387684ec9d92 | 402 | MainInit(); |
Damotclese | 0:387684ec9d92 | 403 | |
Damotclese | 0:387684ec9d92 | 404 | // Initialize and launch the MODBUS CPUM thread |
Damotclese | 0:387684ec9d92 | 405 | ModbusInit(); |
Damotclese | 0:387684ec9d92 | 406 | |
Damotclese | 0:387684ec9d92 | 407 | // Initialize and launch the MODBUS Tunnel thread |
Damotclese | 0:387684ec9d92 | 408 | TunnelInit(); |
Damotclese | 0:387684ec9d92 | 409 | |
Damotclese | 0:387684ec9d92 | 410 | // Enter in to a forever loop which wakes up once a second |
Damotclese | 0:387684ec9d92 | 411 | while (true) |
Damotclese | 0:387684ec9d92 | 412 | { |
Damotclese | 0:387684ec9d92 | 413 | // Sleep for one second |
Damotclese | 0:387684ec9d92 | 414 | wait(1.0); |
Damotclese | 0:387684ec9d92 | 415 | |
Damotclese | 0:387684ec9d92 | 416 | MainThread(); |
Damotclese | 0:387684ec9d92 | 417 | } |
Damotclese | 0:387684ec9d92 | 418 | } |
Damotclese | 0:387684ec9d92 | 419 | |
Damotclese | 0:387684ec9d92 | 420 | // End of file |
Damotclese | 0:387684ec9d92 | 421 |