l2t, fpga-modulen jag kör med har ett program "Front Panel" som gör att man kan sätta ihop gui-t via en xml-fil. Gui-t är alltså inte skrivet i C++, VB eller så... Se nedan hur jag skrivit koden som genererar guit ovan som man sedan laddar in i Front Panel. Väldigt smidigt när man prototypar.
Sen finns det ett C++ mflr API så att jag kan styra FPGA modulen direkt från min egen applikation om jag vill göra en sådan senare. T.ex. om jag vill göra ett program som läser en g-kodsfil och skickar den till FPGA så att jag kan generera stegningen utan att köra via MACH3.
Kod: Markera allt
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
StepMaster
Copyright (c) 2011, Andax
-->
<resource version="2.3.0.1">
<object class="okPanel" name="panel1">
<title>StepMaster</title>
<size>380,325</size>
<!-- PLL22150 settings
These will only be visible when the attached device has
a 22150 PLL (XEM3001).
-->
<object class="okPLL22150">
<label>PLL1</label>
<position>20,5</position>
<size>40,15</size>
<p>400</p>
<q>48</q>
<divider1 source="vco">8</divider1>
<output0 source="div1byn">on</output0>
<output1 source="ref">on</output1>
</object>
<!-- StepMaster -->
<!-- Encoder controls -->
<object class="okStaticBox">
<label>Encoder</label>
<position>10,20</position>
<size>360,90</size>
</object>
<!-- HEX -->
<object class="okHex">
<label>[15:12]</label>
<position>22,36</position>
<size>36,50</size>
<endpoint>0x20</endpoint>
<bit>12</bit>
<tooltip>Count (nibble 3)</tooltip>
</object>
<object class="okHex">
<label>[11:8]</label>
<position>62,36</position>
<size>36,50</size>
<endpoint>0x20</endpoint>
<bit>8</bit>
<tooltip>Count (nibble 2)</tooltip>
</object>
<object class="okHex">
<label>[7:4]</label>
<position>102,36</position>
<size>36,50</size>
<endpoint>0x20</endpoint>
<bit>4</bit>
<tooltip>Count (nibble 1)</tooltip>
</object>
<object class="okHex">
<label>[3:0]</label>
<position>142,36</position>
<size>36,50</size>
<endpoint>0x20</endpoint>
<bit>0</bit>
<tooltip>Count (nibble 0)</tooltip>
</object>
<!-- HEX -->
<object class="okHex">
<label>[15:12]</label>
<position>202,36</position>
<size>36,50</size>
<endpoint>0x21</endpoint>
<bit>12</bit>
<tooltip>Count (nibble 3)</tooltip>
</object>
<object class="okHex">
<label>[11:8]</label>
<position>242,36</position>
<size>36,50</size>
<endpoint>0x21</endpoint>
<bit>8</bit>
<tooltip>Count (nibble 2)</tooltip>
</object>
<object class="okHex">
<label>[7:4]</label>
<position>282,36</position>
<size>36,50</size>
<endpoint>0x21</endpoint>
<bit>4</bit>
<tooltip>Count (nibble 1)</tooltip>
</object>
<object class="okHex">
<label>[3:0]</label>
<position>322,36</position>
<size>36,50</size>
<endpoint>0x21</endpoint>
<bit>0</bit>
<tooltip>Count (nibble 0)</tooltip>
</object>
<object class="okStaticText">
<label>Current Value</label>
<position>70,90</position>
</object>
<object class="okStaticText">
<label>Latched Value</label>
<position>250,90</position>
</object>
<!-- Parallel in -->
<object class="okStaticBox">
<label>Parallel In</label>
<position>10,115</position>
<size>360,60</size>
</object>
<!-- LEDs -->
<object class="okLED">
<position>23,140</position>
<size>35,25</size>
<label align="bottom">Step X</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>0</bit>
</object>
<object class="okLED">
<position>65,140</position>
<size>35,25</size>
<label align="bottom">Dir X</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>1</bit>
</object>
<object class="okLED">
<position>107,140</position>
<size>35,25</size>
<label align="bottom">Step Y</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>2</bit>
</object>
<object class="okLED">
<position>149,140</position>
<size>35,25</size>
<label align="bottom">Dir Y</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>3</bit>
</object>
<object class="okLED">
<position>191,140</position>
<size>35,25</size>
<label align="bottom">Step Z</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>4</bit>
</object>
<object class="okLED">
<position>233,140</position>
<size>35,25</size>
<label align="bottom">Dir Z</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>5</bit>
</object>
<object class="okLED">
<position>275,140</position>
<size>35,25</size>
<label align="bottom">Step A</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>6</bit>
</object>
<object class="okLED">
<position>317,140</position>
<size>35,25</size>
<label align="bottom">Dir A</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>7</bit>
</object>
<!-- Parallel out -->
<object class="okStaticBox">
<label>Parallel Out</label>
<position>10,180</position>
<size>360,130</size>
</object>
<!-- LEDs -->
<object class="okLED">
<position>23,205</position>
<size>35,25</size>
<label align="bottom">Step X</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>8</bit>
</object>
<object class="okLED">
<position>65,205</position>
<size>35,25</size>
<label align="bottom">Dir X</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>9</bit>
</object>
<object class="okLED">
<position>107,205</position>
<size>35,25</size>
<label align="bottom">Step Y</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>10</bit>
</object>
<object class="okLED">
<position>149,205</position>
<size>35,25</size>
<label align="bottom">Dir Y</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>11</bit>
</object>
<object class="okLED">
<position>191,205</position>
<size>35,25</size>
<label align="bottom">Step Z</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>12</bit>
</object>
<object class="okLED">
<position>233,205</position>
<size>35,25</size>
<label align="bottom">Dir Z</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>13</bit>
</object>
<object class="okLED">
<position>275,205</position>
<size>35,25</size>
<label align="bottom">Step A</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>14</bit>
</object>
<object class="okLED">
<position>317,205</position>
<size>35,25</size>
<label align="bottom">Dir A</label>
<style>SQUARE</style>
<color>#00ff00</color>
<endpoint>0x22</endpoint>
<bit>15</bit>
</object>
<object class="okToggleButton">
<label>Step X</label>
<position>21,240</position>
<size>41,20</size>
<endpoint>0x00</endpoint>
<bit>8</bit>
</object>
<object class="okToggleButton">
<label>Dir X</label>
<position>63,240</position>
<size>41,20</size>
<endpoint>0x00</endpoint>
<bit>9</bit>
</object>
<object class="okToggleButton">
<label>Step Y</label>
<position>105,240</position>
<size>41,20</size>
<endpoint>0x00</endpoint>
<bit>10</bit>
</object>
<object class="okToggleButton">
<label>Dir Y</label>
<position>147,240</position>
<size>41,20</size>
<endpoint>0x00</endpoint>
<bit>11</bit>
</object>
<object class="okToggleButton">
<label>Step Z</label>
<position>189,240</position>
<size>41,20</size>
<endpoint>0x00</endpoint>
<bit>12</bit>
</object>
<object class="okToggleButton">
<label>Dir Z</label>
<position>231,240</position>
<size>41,20</size>
<endpoint>0x00</endpoint>
<bit>13</bit>
</object>
<object class="okToggleButton">
<label>Step A</label>
<position>273,240</position>
<size>41,20</size>
<endpoint>0x00</endpoint>
<bit>14</bit>
</object>
<object class="okToggleButton">
<label>Dir A</label>
<position>315,240</position>
<size>41,20</size>
<endpoint>0x00</endpoint>
<bit>15</bit>
</object>
<object class="okToggleCheck">
<label>Manual</label>
<position>30,275</position>
<endpoint>0x00</endpoint>
<bit>2</bit>
</object>
<object class="okCombobox">
<position>90,270</position>
<size>70,-1</size>
<options>
<item value="0">No slave</item>
<item value="1">Slave X</item>
<item value="2">Slave Y</item>
<item value="3">Slave Z</item>
<item value="4">Slave A</item>
</options>
<endpoint>0x00</endpoint>
<bit>3</bit>
</object>
<object class="okDigitEntry">
<position>200,270</position>
<size>50,20</size>
<tooltip>Sets the integer divider.</tooltip>
<minvalue>0</minvalue>
<maxvalue>65536</maxvalue>
<radix>10</radix>
<value>0</value>
<endpoint>0x04</endpoint>
<bit>0</bit>
</object>
<object class="okDigitEntry">
<position>280,270</position>
<size>50,20</size>
<tooltip>Sets the integer divider.</tooltip>
<minvalue>0</minvalue>
<maxvalue>65536</maxvalue>
<radix>10</radix>
<value>0</value>
<endpoint>0x04</endpoint>
<bit>0</bit>
</object>
</object>
</resource>