Changes between Version 2 and Version 3 of Docs/Prog/Manual/DeviceSupport/Weighing


Ignore:
Timestamp:
02/19/10 12:15:58 (14 years ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/Prog/Manual/DeviceSupport/Weighing

    v2 v3  
    11= Weighing =
    22
    3 == Analog SIB ==
     3The 825 OS provides access to weight data by means of the mnbd-comm device driver. This device driver provides device files: /dev/wt1 - /dev/wt10 corresponding to scale 1 - scale 10. Device file /dev/wttot is used for total weight if the totalizer feature is enabled.
    44
    5 == iCAN ==
     5== Get Weight ==
     6
     7=== Command prompt testing ===
     8
     9Make sure no applications are running or the weight server. Otherwise, the application or weight server may grab the response before you are able to retrieve it from the command prompt.
     10
     11From the 825 command prompt type:
     12{{{
     13echo "W" > /dev/wt1
     14cat /dev/wt1
     15WA01004456A486000000004456A4860000
     16}}}
     17
     18The response "WA" indicates the response for the "W" weight request is acknowledged "A". The following characters are hexadecimal encoded values for the floating point gross, tare, net weights and weight status information. Because this data represents floating point math values it is difficult to interpret. You may change the weight on the scale and repeat the test to see that the values change.
     19
     20=== Access the weight data from a program ===
     21
     22The lib825 library provides features to facilitate access the weight information from an application program.
     23
     24{{{
     25// Simple get weight sample
     26
     27#include <stdio.h>
     28#include <stdlib.h>
     29
     30#include "mnbdcomm.h"
     31#include "lcd.h"
     32#include "util.h"
     33
     34int main()
     35{
     36   int n;
     37   char gross_wt_str[41];
     38   CSleep slp(0, 5);
     39
     40   InitLCD();
     41   MnBdStartup();
     42
     43   while(1)
     44   {
     45      n = MnBdProcess();
     46      if(n == mnbdProcWtRcv)
     47      {
     48          FormatGrossWt(GetProcessWt(), gross_wt_str);
     49          DisplayText(0, 0, gross_wt_str);
     50      }
     51      slp.Pause();
     52   }
     53   return 0;
     54}
     55
     56}}}
     57
     58This displays the gross weight at the upper left corner of the display. The weight will update as changes are made to the scale. This program as an endless loop. If you started the program from the command line without using the "&" parameter you can press CTRL-C to end the program. Otherwise use PS to see the process list and KILL to terminate the appropriate process number.
     59