Difference between revisions of "How the dataport works"

From DIDEAS Wiki
Jump to: navigation, search
(Created page with "To send data from the PIC to a computer, a datastream is sent (either over wireless radio or physical serial connection). However, for the receiving computer to understand the st...")
 
Line 1: Line 1:
 +
The PIC makes use of a data structure to communicate both with other microcontrollers (e.g. motor controller, sensor-reading microcontroller like state machine board in the ankle). Therefore, to access data being read from other microcontrollers (sensor data, EMG, etc) you must access the appropriate data structure.
 +
 +
An example of a data structure for sending/receiving is defined in dataport.h, and is called USER_DATAPORT_OBJ_T (you'll see "typedef struct PACKED" that starts the definition, followed by USER_DATAPORT_OBJ_T, which is the new name for this datatype). The data structure has a number of members. Some of the members (emg_data, for instance) are for storing sensor data from other microcontrollers, etc.
 +
 +
Chris has written code that reads data from other microcontrollers and stores that data (at each timestep) into a memory location. Therefore, to access this memory location (and hence the data stored) you need to create a pointer and store the appropriate memory location to that pointer. Use the line:
 +
 +
------- LINE HERE ------------
 +
 +
to store the
 +
 
To send data from the PIC to a computer, a datastream is sent (either over wireless radio or physical serial connection). However, for the receiving computer to understand the stream of 1's and 0's, there must be a header of sorts to describe the incoming data. This is the vlist. This list must be defined on both the PIC side and computer side as follows:
 
To send data from the PIC to a computer, a datastream is sent (either over wireless radio or physical serial connection). However, for the receiving computer to understand the stream of 1's and 0's, there must be a header of sorts to describe the incoming data. This is the vlist. This list must be defined on both the PIC side and computer side as follows:
  
PIC:
+
== PIC: ==
-To send data from the PIC to the PC, the information is stored in a C structure. This structure type is defined in dataport.h, and is called USER_DATAPORT_OBJ_T (you'll see "typedef struct PACKED" that starts the definition, followed by USER_DATAPORT_OBJ_T, which is the new name for this datatype).
+
*To send data from the PIC to the PC, the information must be stored in a C structure.  
-
+
 
 +
 
 +
*If say, you want to send variables a, b, and c to the computer, (where a is an int, b is a float and c is a byte) you'll want to make "room" for them in a structure.  
 +
 
 +
 
 +
The USER_DATAPORT_OBJ_T structure is defined already, and thanks to Chris,

Revision as of 22:08, 27 October 2010

The PIC makes use of a data structure to communicate both with other microcontrollers (e.g. motor controller, sensor-reading microcontroller like state machine board in the ankle). Therefore, to access data being read from other microcontrollers (sensor data, EMG, etc) you must access the appropriate data structure.

An example of a data structure for sending/receiving is defined in dataport.h, and is called USER_DATAPORT_OBJ_T (you'll see "typedef struct PACKED" that starts the definition, followed by USER_DATAPORT_OBJ_T, which is the new name for this datatype). The data structure has a number of members. Some of the members (emg_data, for instance) are for storing sensor data from other microcontrollers, etc.

Chris has written code that reads data from other microcontrollers and stores that data (at each timestep) into a memory location. Therefore, to access this memory location (and hence the data stored) you need to create a pointer and store the appropriate memory location to that pointer. Use the line:


LINE HERE ------------

to store the

To send data from the PIC to a computer, a datastream is sent (either over wireless radio or physical serial connection). However, for the receiving computer to understand the stream of 1's and 0's, there must be a header of sorts to describe the incoming data. This is the vlist. This list must be defined on both the PIC side and computer side as follows:

PIC:

  • To send data from the PIC to the PC, the information must be stored in a C structure.


  • If say, you want to send variables a, b, and c to the computer, (where a is an int, b is a float and c is a byte) you'll want to make "room" for them in a structure.


The USER_DATAPORT_OBJ_T structure is defined already, and thanks to Chris,