kevin vannorsdel Posted September 24 Share Posted September 24 All I want to do is independently control output pin 24 and output pin 29. Something like this: Set_output_pin_24(1) Set_output_pin_29(0) Set_output_pin_24(0) I don't want to use any fancy pattern generator or anything like that. Just basic software controlled digital output using PYTHON. I dont see an example for how to clearly do this. Can you advise? Thanks! Link to comment Share on other sites More sharing options...
0 attila Posted September 24 Share Posted September 24 Hi @kevin vannorsdel See WK SDK/ samples/ py/ DigitalIO.py and the pdf manual dwf.FDwfDigitalIOOutputEnableSet(hdwf, 0x00FF) # drive DIO 24-31 and float DIO 32-39 dwf.FDwfDigitalIOOutputSet(hdwf, 0x01) # DIO 24 = 1 others 0 dwf.FDwfDigitalIOOutputSet(hdwf, 0x00) # all 0s dwf.FDwfDigitalIOOutputSet(hdwf, (1<<1) | (1<<5)) # DIO 25 and 29 = 1 others 0 Link to comment Share on other sites More sharing options...
0 kevin vannorsdel Posted September 24 Author Share Posted September 24 ok looking into it. thx attila 1 Link to comment Share on other sites More sharing options...
0 kevin vannorsdel Posted September 24 Author Share Posted September 24 Still confused, let's say I want to control DIO 24 and DIO 27 as software controlled digital outputs and DIO 25,26 and 27 used by the nice pattern generator logic. How do I control these sort of "independant" digital output lines 24 and 27 while leaving the ones in between those alone? It seems complicated but I just want a python function that can write a 0 or 1 to any single output line at will. Thanks! Link to comment Share on other sites More sharing options...
0 attila Posted September 25 Share Posted September 25 Hi @kevin vannorsdel I suppose you wanted to say to control DIO 24 and 29 from digital-io. The DIOs can be controlled as bits in the following function arguments, lsb to msb, indexed from 0. 1=dio24, 2=dio25, 4=dio26 ... dwf.FDwfDigitalIOOutputEnableSet(hdwf, 0x0021) # output enable only on (1<<(29-24)) | (1<<(24-24)), the others can be controlled from digital-out and protocols dwf.FDwfDigitalIOOutputSet(hdwf, 0x0000) # DIO 29 = low and DIO 24 = low dwf.FDwfDigitalIOOutputSet(hdwf, 0x0001) # DIO 29 = low and DIO 24 = high dwf.FDwfDigitalIOOutputSet(hdwf, 0x0020) # DIO 29 = high and DIO 24 = low dwf.FDwfDigitalIOOutputSet(hdwf, 0x0021) # DIO 29 = high and DIO 24 = high Link to comment Share on other sites More sharing options...
0 kevin vannorsdel Posted September 25 Author Share Posted September 25 Thanks for the response. I guess I see what you are saying. I think when you said: "I suppose you wanted to say to control DIO 24 and 29 from digital-io" by "digital-io" you are referring to the Digital I/O functions mentioned in section 8 of the SDK ref manual? I sure wish I knew what this paragraph actually means: The digital IO signals are shared in the device between Digital-IO, Out and In functions. The Digital-IO has priority over Digital-Out. The Digital-Out is only applied for a signal when the Digital-IO Enable and Output are zero for the respective bit. Especially this last sentence. it makes almost no sense to me. Can you clarify what this means by chance? Link to comment Share on other sites More sharing options...
0 attila Posted September 26 Share Posted September 26 Hi @kevin vannorsdel You mentioned 27 twice: On 9/25/2024 at 1:13 AM, kevin vannorsdel said: DIO 24 and DIO 27 as software controlled digital outputs and DIO 25,26 and 27 used by the nice pattern generator The device DIO outputs can be controlled by digital-io and digital-out function. The digital-io has higher priority. If you set FDwfDigitalIOOutputEnableSet(hdwf, 0x0001) the first DIO channel (DIO 24 on Digital Discovery) will be controlled low/high by FDwfDigitalIOOutputSet value. The other DIOs will output what is configured with digital-out function. Link to comment Share on other sites More sharing options...
0 kevin vannorsdel Posted September 26 Author Share Posted September 26 Yeah, sorry I mentioned 27 twice. that was a mistake. Thanks. attila 1 Link to comment Share on other sites More sharing options...
Question
kevin vannorsdel
All I want to do is independently control output pin 24 and output pin 29.
Something like this:
Set_output_pin_24(1)
Set_output_pin_29(0)
Set_output_pin_24(0)
I don't want to use any fancy pattern generator or anything like that. Just basic software controlled digital output using PYTHON.
I dont see an example for how to clearly do this. Can you advise?
Thanks!
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now