Click here to Skip to main content
15,911,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: caption bar Pin
Nish Nishant18-Sep-06 4:28
sitebuilderNish Nishant18-Sep-06 4:28 
GeneralRe: caption bar Pin
radhika2818-Sep-06 4:24
radhika2818-Sep-06 4:24 
GeneralRe: caption bar Pin
Nish Nishant18-Sep-06 4:34
sitebuilderNish Nishant18-Sep-06 4:34 
GeneralRe: caption bar Pin
radhika2818-Sep-06 4:48
radhika2818-Sep-06 4:48 
GeneralRe: caption bar Pin
Nish Nishant18-Sep-06 4:54
sitebuilderNish Nishant18-Sep-06 4:54 
GeneralRe: caption bar Pin
Nish Nishant18-Sep-06 4:53
sitebuilderNish Nishant18-Sep-06 4:53 
GeneralRe: caption bar Pin
radhika2818-Sep-06 5:08
radhika2818-Sep-06 5:08 
QuestionHow split up a double value into 8 sets of uint8 Pin
cahit2318-Sep-06 3:47
cahit2318-Sep-06 3:47 
Hi all,

i am working on a simulink model (graphical block programming) and in a block i am supposed to write a user defined function (S-Function) which takes a double value and outputs 8 uint8 values. It has some simulink related commands but basically C Code. Since i have an error message, i would like to share it with you all to find a way out.


#define S_FUNCTION_NAME double2integer
#define S_FUNCTION_LEVEL 2

#include "simstruc.h"

typedef union

{ uint8_T uvalue[8];
real_T d; //real_T is double

} UnionNum;

static void mdlInitializeSizes(SimStruct *S)

{
ssSetNumSFcnParams(S, 0);
if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) {
return; /* Parameter mismatch will be reported by Simulink */
}

if (!ssSetNumInputPorts(S, 1)) return;
ssSetInputPortWidth(S, 0, 1);
ssSetInputPortDataType(S, 0, SS_DOUBLE);
ssSetInputPortDirectFeedThrough(S, 0, 1);

if (!ssSetNumOutputPorts(S,1)) return;
ssSetOutputPortWidth(S, 0, 8);
ssSetOutputPortDataType(S, 0, SS_UINT8);

ssSetNumSampleTimes(S, 1);
ssSetOptions(S,0);
}

static void mdlOutputs(SimStruct *S, int_T tid)

{

int_T i;

int_T width = ssGetOutputPortWidth(S,0);

InputPtrsType uPtrs = ssGetInputPortSignalPtrs(S,0);

uint8_T *y = (uint8_T *)ssGetOutputPortSignal(S,0);

UnionNum num;
num.d = *uPtrs[0] ;

for(i=0; i
AnswerRe: How split up a double value into 8 sets of uint8 Pin
David Crow18-Sep-06 3:58
David Crow18-Sep-06 3:58 
GeneralRe: How split up a double value into 8 sets of uint8 Pin
cahit2318-Sep-06 4:22
cahit2318-Sep-06 4:22 
AnswerRe: How split up a double value into 8 sets of uint8 Pin
toxcct18-Sep-06 4:02
toxcct18-Sep-06 4:02 
Questionread string Pin
zizzzz18-Sep-06 3:41
zizzzz18-Sep-06 3:41 
AnswerRe: read string [modified] Pin
_AnsHUMAN_ 18-Sep-06 3:42
_AnsHUMAN_ 18-Sep-06 3:42 
QuestionRe: read string Pin
David Crow18-Sep-06 4:00
David Crow18-Sep-06 4:00 
AnswerRe: read string Pin
zizzzz18-Sep-06 4:32
zizzzz18-Sep-06 4:32 
AnswerRe: read string Pin
ThatsAlok18-Sep-06 5:07
ThatsAlok18-Sep-06 5:07 
Question.:Restoring Window Problem:. Pin
Programm3r18-Sep-06 3:30
Programm3r18-Sep-06 3:30 
AnswerRe: .:Restoring Window Problem:. Pin
toxcct18-Sep-06 3:34
toxcct18-Sep-06 3:34 
AnswerRe: .:Restoring Window Problem:. Pin
_AnsHUMAN_ 18-Sep-06 3:37
_AnsHUMAN_ 18-Sep-06 3:37 
GeneralRe: .:Restoring Window Problem:. Pin
Programm3r18-Sep-06 3:46
Programm3r18-Sep-06 3:46 
GeneralRe: .:Restoring Window Problem:. Pin
_AnsHUMAN_ 18-Sep-06 3:52
_AnsHUMAN_ 18-Sep-06 3:52 
GeneralRe: .:Restoring Window Problem:. Pin
toxcct18-Sep-06 3:58
toxcct18-Sep-06 3:58 
GeneralRe: .:Restoring Window Problem:. Pin
_AnsHUMAN_ 18-Sep-06 4:01
_AnsHUMAN_ 18-Sep-06 4:01 
GeneralRe: .:Restoring Window Problem:. Pin
Programm3r18-Sep-06 4:05
Programm3r18-Sep-06 4:05 
QuestionConfused with the resource using Pin
bloodwinner18-Sep-06 2:50
bloodwinner18-Sep-06 2:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.