Announcement

Collapse
No announcement yet.

A Simple PBCC Plot Program?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • A Simple PBCC Plot Program?

    Has anyone written, or know of, a simple 2-D plot program for PBCC that, (for example), would be able to draw a sine wave? (i.e. it would (for example) be able to plot a dependent variable as a function of time.)

    I realize that I could probably calculate a data set in EXCEL and then plot it, but it seems that it would be more interesting to be able to insert/swap an equation in a general purpose PBCC code.

    Thank you very much for your thoughts.

  • #2
    In the samples that came with PBCC 6 there is a program PwrGraph.bas that might give you some ideas.
    Rod
    I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

    Comment


    • #3
      Code:
      'PBCC6 program
      FUNCTION PBMAIN () AS LONG
      
      LOCAL Angle, Amplitude,pi AS EXT
      
      pi=3.14159265358979323
      
      
      GRAPHIC WINDOW "Sine wave", 100, 100, 400, 400  TO hWin???
      GRAPHIC ATTACH hWin???, 0
      
      GRAPHIC SCALE (0,-1) - (2*pi,1)     'scale the graphics so a sine wave fills the window
      GRAPHIC SET POS (0,200)             'offset the origin half way up the window
      
      FOR Angle = 0 TO 2*pi STEP 0.01
          Amplitude = SIN(Angle)
          GRAPHIC LINE  -(Angle,Amplitude)
      
      NEXT
      
      
      WAITKEY$
      GRAPHIC WINDOW END
      
      END FUNCTION

      Comment


      • #4
        Rodney and Paul -- Thank you so much for your quick responses! Rodney, I shall certainly check out your suggestion: PwrGraph. Paul, it looks like you have something running already. Indeed so! You guys amaze me! I got it to run one time, and then I stepped into that familiar trap again, (I'm embarrassed), that I "cannot compile because the program is already running".

        I have spent several hours on it again, so far. Can you or some other kind soul please remind me how to get out of this trap again? This time I will write it, in large letters, on my wall <g>!

        Thank you again,
        David

        Comment


        • #5
          Paul,

          It worked fine here, even looks good. I don't have a clue how it works but that does not really matter.
          hutch at movsd dot com
          The MASM Forum

          www.masm32.com

          Comment


          • #6
            In Paul's code try changing "WAITKEY$" to "GRAPHIC WAITKEY$", it may help. Otherwise, check to see if your anti virus set up is interfering.
            Rod
            I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

            Comment


            • #7
              That worked, Rodney! And thank you again, Paul, for the clever design!

              Comment


              • #8
                Small fix - move the line that offsets the origin to before the scale change.
                Code:
                GRAPHIC SET POS (0,200)             'offset the origin half way up the window
                GRAPHIC SCALE (0,-1) - (2*pi,1)     'scale the graphics so a sine wave fills the window
                Rgds, Dave

                Comment

                Working...
                X