Using Pangolin SDK

Discussion in 'The Lounge' started by the_researcher, Sep 12, 2007.

  1. Hello!

    I've started programming using the Pangolin SDK, using the QM2000 PCI board. Now I'm trying to draw a set of points in a grid fashion. To do that, I draw in vector frame modes. For each point, I use one blanking point before, then two points in the same place to draw the point, and one blanking point after.

    in other words, to draw each point, I need to send out 4 points (2 blanking, 2 drawing). The funny thing is, I can only draw 25 points this way (or 100 points actually sent to the board). If I draw more than 25, then I get 25 missing points, and then draws another 25.

    Why is it doing that?
  2. Pangolin

    Pangolin Staff Member

    For sure you have a bug in your program... I can't say where, without reviewing your program code. But for sure there is a bug.

    Also, you are really doing things the hard way. When the system is in Vector mode, you only need to remember a few rules:

    * The frame MUST start with a "black" point. This is a "move-to"
    * The frame MUST end with a "non-black" point. This is a "draw-to".
    * If you want a corner to be drawn at a particular point, you set VOTYPE for that point to 4096.
    * It generally does not make sense to have more than one "black" point in a row. That is like "move-to", "move-to", which doesn't make sense.
    * Vector imagery is like: "move-to" then "draw-to", "draw-to", "draw-to", etc.

    Best regards,

    William Benner
  3. Oh, I see. Well, that helps reduce the code a little bit, but I still can't seem to send more than 100 points (either move-to or draw-to), without getting 100 points spaced in the middle.

    Here's the code in C
           //init session
    	LONG retval;
    	BeginSession (1, 6000, 7000, 0, &retval);
    	//adjust frequency
    	LONG actpps, actvps, actaps;
    	DisplayFreq3 (18000, 9000, 0, &actpps, &actvps, &actaps);
    	//first laser projector
    	//only one track (frame / angle / scale) for now
    	//current frame
    	//save space for frame and points
            FRAMESTRUCT     LaserFrame;         // Frame to associate points into
            PTSTRUCT        LaserPoints[6000];  // Array to draw points with into the current frame
            memset(&LaserFrame, 0, sizeof(FRAMESTRUCT));
            memset(LaserPoints, 0, sizeof(PTSTRUCT) * 6000);
    	//display a point grid with lasers
    	int nMarkings = 0;
    	for (int i=0; i<gridsize; i++)
    		for (int j=0; j<gridsize; j++)
    			//move to coordinate
    			LaserPoints[nMarkings].XCoord = (i - gridsize/2)*100;
    			LaserPoints[nMarkings].YCoord = (j - gridsize/2)*100;
    			LaserPoints[nMarkings].RGBValue = RGB(0, 0, 0);
    			//now draw the coordinate
    			LaserPoints[nMarkings].XCoord = (i - gridsize/2)*100;
    			LaserPoints[nMarkings].YCoord = (j - gridsize/2)*100;
    			LaserPoints[nMarkings].RGBValue = RGB(255, 255, 0);
    			LaserPoints[nMarkings].Status = 0x1000;	//this is a corner point
    	LaserFrame.NumPoints = nMarkings;
    	LaserFrame.VOFlag = 1; //this is a VECTOR oriented frame
    	// Write this into frame 1 (as specified ty SetWorkingFrame above)
    	WriteFrame(&LaserFrame, &LaserPoints[0]);
    	//display the frame
    Basically, what this does is to draw a squared grid of dots. It works wonderfully for 7x7 grids (gridsize=7), but for 9x9 it only draws the first 50 points (50 "move to" + 50 "draw to") and then stops drawing.

    I'm pretty sure I must be doing something wrong, but I just can't figure it out
  4. On a deeper inspection, the code is actually sending all the points (I'm using LD2000 Designer show to see what's ending up on the board's memory). But for some reason, after the 100th point, they're all black (thus, not showing).

    Any ideas what can be doing this?
  5. Pangolin

    Pangolin Staff Member

    I would use BeginSessionEx if I were you. That is a newer function, and it automatically sets everything up, and loads the palette, zones, and any other user files. You can see the use of BeginSessionEx in all of our SDK examples.

    You don't need to use DisplayFreq3 as long as you use BeginSessionEx, because BeginSessionEx will automatically set the scan rates and other scanning parameters as they are in your INI file.

    Probably the reason why you are not seeing any more than 100 points is because of "DisplayScanLimits" or some similar function. I think BeginSessionEx even resets this. Otherwise you can look for a function called "ResetLD" or "ResetAll" or something like that in our example programs.

    Best regards,

    William Benner

Share This Page