|
| 1 | +.. _blinking_leds_tutorial: |
| 2 | + |
| 3 | +Blinking LEDs Tutorial |
| 4 | +====================== |
| 5 | + |
| 6 | +This tutorial will introduce you to the basics of PandABlocks, how to wire |
| 7 | +Blocks together to make different LEDs flash at different rates |
| 8 | + |
| 9 | + |
| 10 | +Opening the GUI |
| 11 | +--------------- |
| 12 | + |
| 13 | +Point your web browser at the ip address or hostname of the PandA and you will |
| 14 | +be greeted with a welcome page. At the bottom of this page will be links for |
| 15 | +Docs, Control and Admin. You can use the Control link to open the Web Control |
| 16 | +page that we will use in these tutorials. For more information on the Web |
| 17 | +Control, see its entry in the Docs section. |
| 18 | + |
| 19 | + |
| 20 | +Loading the tutorial design |
| 21 | +--------------------------- |
| 22 | + |
| 23 | +The Design dropdown box allows you to select from saved designs stored on the |
| 24 | +PandA. Selecting an item from this list will load the saved design over the |
| 25 | +current Block settings. You can use the Save method to save your current |
| 26 | +design if you wish to keep it. |
| 27 | + |
| 28 | +Select "template_tutorial1_leds" from the box and the settings and wiring of |
| 29 | +the Blocks in the PandA will be changed to the following: |
| 30 | + |
| 31 | +.. image:: ../../images/tutorial1_layout.png |
| 32 | + |
| 33 | +If you now look at the front panel of the PandA you should see the first 4 |
| 34 | +TTL output LEDs turn on sequentially, then turn off in the opposite order. |
| 35 | + |
| 36 | + |
| 37 | +How the design works |
| 38 | +-------------------- |
| 39 | + |
| 40 | +The CLOCKS Block is creating a 50% duty cycle pulse train with a period of 1s. |
| 41 | +PULSE1..4 are taking this as an input trigger, and producing a different width |
| 42 | +pulse with a different delay for each PULSE Block. These PULSE Blocks work as a |
| 43 | +delay line, queuing a series of pulses up to be sent out when the delay expires. |
| 44 | + |
| 45 | +If you click on one of them you can see its settings: |
| 46 | + |
| 47 | +.. image:: ../../images/tutorial1_pulse.png |
| 48 | + |
| 49 | +If you increase the delay beyond the 1s period you will notice that the |
| 50 | +``Queued`` field will increase, but the PULSE Block will still continue |
| 51 | +outputting pulses after the desired delay. However if you increase the width |
| 52 | +beyond the pulse period the Block will drop the pulse, reporting it via the |
| 53 | +``Dropped`` field. This is so it avoids merging them together. |
| 54 | + |
| 55 | +You can also try clicking on the CLOCKS Block to modify the period of the input |
| 56 | +pulse train. |
| 57 | + |
| 58 | +You can also try wiring these outputs to different TTLOUT Blocks by clicking |
| 59 | +the Palette icon, dragging a TTLOUT Block onto the canvas, and connecting it |
| 60 | +up by dragging the PULSE out port to the TTLOUT val port. |
| 61 | + |
| 62 | + |
| 63 | +The Bit Bus |
| 64 | +----------- |
| 65 | + |
| 66 | +All ports on the visible Blocks are blue. They represent bits, single boolean |
| 67 | +values that can propagate through the system by connecting Blocks together. |
| 68 | +These outputs can be viewed on their respective Blocks by clicking them on the |
| 69 | +design, or all together by clicking the Bits field in the left hand pane: |
| 70 | + |
| 71 | +.. image:: ../../images/tutorial1_bits.png |
| 72 | + |
| 73 | +If you scroll down to the section with the Pulse blocks you will see the |
| 74 | +same pattern of flashing lights as on the front of the PandA |
| 75 | + |
| 76 | +.. note:: |
| 77 | + |
| 78 | + The web GUI polls the PandA at 10Hz, receiving the current value of each bit |
| 79 | + and whether it has changed. The web GUI uses this information to reflect the |
| 80 | + current value of each bit if pulsing at less than 5Hz, and displaying a 5Hz |
| 81 | + pulsing value if faster than 5Hz. This means that you will see even short |
| 82 | + pulses reflected on the web GUI. The front panel LEDs have a similar |
| 83 | + behaviour but with a maximum rate of 10Hz. |
| 84 | + |
| 85 | + |
| 86 | +Conclusion |
| 87 | +---------- |
| 88 | + |
| 89 | +This tutorial has shown how to load a saved design and modify some parameters. |
| 90 | +It has also introduced the PULSE delay block that is useful for delaying and |
| 91 | +stretching trigger signals. It has introduced bit outputs and shown how they |
| 92 | +can be connected to the outside world using the TTLOUT Blocks. In the next |
| 93 | +tutorial we will read about position outputs, how they can be set and how they |
| 94 | +can be captured. |
0 commit comments