Fairbanks FB3000 II Operators Manual User Manual

Page 49

Advertising
background image

Appendix II: System Resource

02/10

49

51220 Rev. 1

Shared Memory (Kernel Mapped Output)

//***********************************

// Sample code to read Kernel Mapped Output (Shared Memory)

//***********************************

// FileMap Memory Structure

struct FileMapStruct

{

unsigned char data[256]; // configured output string from kernel

unsigned char command[2]; // command to return to kernel i.e. “z” = zero all scales, “Z1” =
zero scale 1

int length; // length of string in data

int counter; // sequential number

char status[128]; // kernel status

};

bool TScaleForm::ReadMappedOutput(char *input)

{

bool result = false;

bool CommandSent = false;

if( MappedOutputHandle == NULL )

{

wSemaphore = CreateSemaphore(NULL, 1, 1, “Output1 Write");

if( wSemaphore == NULL )

return 0;

rSemaphore = CreateSemaphore(NULL, 0, 1, “Output1 Read");

if( rSemaphore == NULL ) {

CloseHandle(wSemaphore);

wSemaphore = NULL;

return 0;

}

Advertising