SPL GPIO TristatePort programming - How to change the function of tristate port from output port to input port


This tutorial is continued from the previous tutorial.


6. Change "Active" property of tristate port
  1. Change "Active" property of tristate port as "false"



      
    port8.Active = false
    
      


  2. Click "Send Script" button to send SPL script to emulator.
 



7. Create emulator script to change the state of tristate port
  1. Add script to write into GPIO port on the Emulator's editor panel.



      
    port8.Write(false)
    
      


  2. Click "Send Script" button to send SPL script to emulator.



8. Read the state of tristate port in the application
  1. Execute below script on the editor or emulator's Application command box.



      
    s = port8.Read()
    print "Current state is " + s
    
      


  2. Send SPL script for application to the emulator.


  3. Or you can execute above script on the emulator's Application tab directly.

  4. Executed result will be shown as follows.