| |
SPL GPIO InputPort programming - How to start GPIO InputPort programming
1. Add "InputPort" command
- Double click "InputPort" item on the tree.
| |
InputPort port5
/Pin:5
/GlitchFilter:false
/ResistorMode:PullDown
| |
|
- You can change Pin number as one of between 5 ~ 10.
- You can change GlitchFilter as true.
- You can change ResistorMode as one of among the "PullUp, PullDown, and Disabled".
|
|
|
2. Add simple logic to read current state of port
- You can read current state of port by using below method.
portname.Read()
- Add lines to read and print current state of port.
| |
InputPort port5
/Pin:5
/GlitchFilter:false
/ResistorMode:PullDown
s = port5.Read()
print "Current state is " + s
| |
|
3. Re-launch SPL emulator
- if SPL emulator is running, please terminate emulator.
- Press "F5" key to re-launch SPL emulator on the editor.
4. Send SPL script to emulator
- Click "Send Script" button to send SPL script to emulator
- Executed result will be shown as follows.
|