SPL GPIO InputPort programming - How to start GPIO InputPort programming


1. Add "InputPort" command
  1. Double click "InputPort" item on the tree.



      
    InputPort    port5
    	/Pin:5
    	/GlitchFilter:false
    	/ResistorMode:PullDown
    
      


  2. You can change Pin number as one of between 5 ~ 10.

  3. You can change GlitchFilter as true.

  4. You can change ResistorMode as one of among the "PullUp, PullDown, and Disabled".
 



2. Add simple logic to read current state of port
  1. You can read current state of port by using below method.

       portname.Read()

  2. 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
  1. if SPL emulator is running, please terminate emulator.

  2. Press "F5" key to re-launch SPL emulator on the editor.




4. Send SPL script to emulator
  1. Click "Send Script" button to send SPL script to emulator



  2. Executed result will be shown as follows.