How Do You Construct a Basic Data Packet for Communication?

  • Thread starter Thread starter rama1001
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around constructing a basic data packet for communication, particularly in the context of sending commands from a host (PC) to a slave device, with a focus on the PMBus protocol. Participants seek examples and guidance on packet structure and transmission methods.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant requests help in creating a data packet based on a provided structure and relevant data.
  • Another participant suggests using structs for headers and footers, and arrays for data, recommending TCP protocol for initial communication.
  • Several participants emphasize the need for more specific details about the project, such as the environment, programming language, and type of communication bus being used.
  • A participant mentions the use of PMBus protocol to communicate with a power supply and requests an example packet structure based on this protocol.
  • One participant provides a specific example of a packet structure, detailing the bytes to be sent and the expected acknowledgment signals.

Areas of Agreement / Disagreement

Participants generally agree on the need for specific details to provide effective assistance, but there is no consensus on the exact packet structure or method of transmission, as multiple approaches and examples are discussed.

Contextual Notes

Limitations include the lack of clarity on the specific requirements for the packet construction and the varying interpretations of the communication environment (e.g., LAN/WAN vs. local bus).

rama1001
Messages
130
Reaction score
1
Hi,
I am very new to communication and now i want transmit a packet to read data. The attached file containg the packet structure. and relavant data need to make a packet.
can anyone help by giving some example packet by given data.

Please it's urgent for me, hope for helping forum.
 

Attachments

Computer science news on Phys.org
Hey there.

The simple answer is create structs for you're header (and footer) and use an array for the rest.

Use some kind of array class (or a managed buffer) and pack all your data into that array.

Then use a sockets library to send the data.

That's the basics but you need to have a system in place to handle networked traffic.

To start off use the TCP protocol. Don't use UDP just yet.

If you're just doing a demo program you could poll until you get the appropriate response (ie loop until you get response).

If you want to develop it into reusable code you will need to create a library that contains encapsulated code for servers, clients, and protocols.

Since I don't know the scope of what you want to accomplish maybe you can give me some hints on the matter.
 
i am just making a project and its imporant to get data from slave. Inorder to do that commands will transfer from host(PC) to slave, then it responds for different commands with answer. Basic, i need send packet like what i have gave you. cam you make any example packet from that. Please help me.
 
rama1001 said:
i am just making a project and its imporant to get data from slave. Inorder to do that commands will transfer from host(PC) to slave, then it responds for different commands with answer. Basic, i need send packet like what i have gave you. cam you make any example packet from that. Please help me.

Is this over a network like say a LAN/WAN or internet or is it over say some local bus that inside the boundary of the machine?
 
chiro said:
Is this over a network like say a LAN/WAN or internet or is it over say some local bus that inside the boundary of the machine?[/QUO

First of all, forgive me if i made any mistake. Perhaps. i am looking for basic packet construction from the given parameters. what should you need to know else. I need to send the packet from labview.
 
Use a function to figure out how much space you need, allocate the space, write the data to the allocated memory and then after you setup the socket connection use the send function to send it to the destination.

I can't help you if you do not get more specific about what you dealing with (machine, environment/platform, programming language, communication bus etc).

If you can't provide me with things to go on, I'm afraid I can't be as helpful as I could if you more specific about what problem you are having.
 
chiro said:
Use a function to figure out how much space you need, allocate the space, write the data to the allocated memory and then after you setup the socket connection use the send function to send it to the destination.

I can't help you if you do not get more specific about what you dealing with (machine, environment/platform, programming language, communication bus etc).

If you can't provide me with things to go on, I'm afraid I can't be as helpful as I could if you more specific about what problem you are having.

I need to communicate with powersupply digitally from PC. SO, commands willl takes mail lead get answer. I am using PMBus protocol on slave side to get values from Power supply everytime. you can also fine more commands in the link(http://pmbus.org/docs/PMBus_Specification_Part_II_Rev_1-1_20070205.pdf) and you can find more command in pdf last pages. Detailed information also available for packet structure. Just i am looking for example packet structure. just give me what you think about packet structure. I am new to this packet making and sending stuff.
 
Ok I will give you an example packet with the following values:

Address byte - 255 (0xFF)
Command byte - 136 (0x88)

Lets say you have one data byte 27 (0x1C)
Lets say no optional PEC data

According to your document you need to wait for acknowledgment signals so you will do the following:

1) Send 0xFF (in binary 11111111) (wait for acknowledgment)
2) Send 0x88 (in binary 10001000) (wait for acknowledgment)
3) Send 0x1C (in binary 00011100) (wait for stop signal)
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 21 ·
Replies
21
Views
4K
Replies
7
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
Replies
7
Views
3K
Replies
10
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K