I was trying to read values from Ports A, B and C using the DBitIn program from the C library example code provided.
Configuring the port is done using this function. err = getDioInfoFirstSupportedPortType(daqDeviceHandle, &portType, portTypeStr); Here by default the portType is read as FIRSTPORTA. So I have externally given portType values as FIRSTPORTB / FIRSTPORTCL/ FORSTPORTCH to get the ports configured.
To read the bits,this function is used,err = ulDBitIn(daqDeviceHandle, portType, bitNumber, &data[bit_counter]). My requirement is to read all the port values at once. So to do that, I am first configuring FIRSTPORTA, then reading its bits. Later configuring FIRSTPORTB, then reading. Similarly for PORTC. Is this the only way to do it, or any better way to read all at once? Doing it port to port is tedious.
Attaching my code for reference , how I implemented it.
Question
Chandana Narayan
I was trying to read values from Ports A, B and C using the DBitIn program from the C library example code provided.
Configuring the port is done using this function. err = getDioInfoFirstSupportedPortType(daqDeviceHandle, &portType, portTypeStr); Here by default the portType is read as FIRSTPORTA. So I have externally given portType values as FIRSTPORTB / FIRSTPORTCL/ FORSTPORTCH to get the ports configured.
To read the bits,this function is used,err = ulDBitIn(daqDeviceHandle, portType, bitNumber, &data[bit_counter]). My requirement is to read all the port values at once. So to do that, I am first configuring FIRSTPORTA, then reading its bits. Later configuring FIRSTPORTB, then reading. Similarly for PORTC. Is this the only way to do it, or any better way to read all at once? Doing it port to port is tedious.
Attaching my code for reference , how I implemented it.
DBitIn.c
Edited by Chandana NarayanLink to comment
Share on other sites
1 answer 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