Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

XPort - How to change GPIO states - PLEASE HELP :)

Status
Not open for further replies.

reise

Newbie level 2
Joined
Jun 23, 2017
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
29
Hello! I am attempting to use the GPIOs on the Xport to control a set of relays. However, I have not been able to figure out how to change the state of my Xport's GPIOs.

Using the DeviceInstaller I am able to change the configuration from Active Low to Active High, but I am not able to change the states dynamically.

the User Guide says "states can be dynamically controlled and probed through special port 77F0."

I have been trying to communicate with the XPort using telnet, via PuTTy and MATLAB, but have had no luck getting these GPIOs to respond.

I tried, with no luck, reproduce their example 2, which says:

"Example 2: PC sends command 1Bh to change the current states of GPIO 0 and 1.
PC -> XPort: 1Bh, 01h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
XPort -> PC: 1Bh, 05h, 00h, 00h, 00h
Command details:
1Bh = command 1Bh
01h, 00h, 00h, 00h = the mask that determines which GPIOs will be changed.
bit 0 is 1 → GPIO0 will be changed.
bit 1 is 0 → GPIO1 will remain the same.
00h, 00h, 00h, 00h = the new states
bit 0 is 0 → GPIO0 will become 0.
bit 1 is ignored since it is masked out.
Response details:
1Bh = response to command 1Bh
05h, 00h, 00h, 00h =
bit 0 is 1 → GPIO0 = 1
bit 1 is 0 → GPIO1 = 0
bit 2 is 1 → GPIO2 = 1
The other bits are ignored because there are only three configurable pins on
the XPort module."

When I tried this I attempted to send the commands in hex as shown, and in binary but had no luck. When I connect to port 10001 and send command I am able to see the serial data on the TXD pin using my OScope, but they have no affect.

I did notice that when sending commands to port 10001 there are extra characters appended to the end of the bit stream (CR,LF, or ")" ).

If anyone has experience with XPort's GPIOs please help!

Thank you!
 

To set the Xport GPIO state you must send a 9 byte datagram where byte 0 is the command, bytes 1-4 are a mask, and bytes 5-8 are the new state. Below is sample code for MATLAB which sets all three GPIOs to active. Pages 78-80 of the User Guide give details about the datagrams.

xportIP = '192.168.x.xxx';
xportPort = 30704;
xport = udp(xportIP,xportPort);

fopen(xport);
fwrite(xport,[27 7 0 0 0 7 0 0 0]);
echoudp('off')
fclose(xport);
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top