Announcement

Collapse
No announcement yet.

Scaling for BS2px

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

  • Scaling for BS2px

    Hello Guys,

    I am new to display devices and its been a long time since I programmed in Pbasic. I ordered the uOLED from parallax and should get it in a few days. I have one question about the scaling at the top of the demo code from 4d systems, will I need the proper scaling for the 2px? I have the BS2 homework board to try, but If I wanted to use the 2px How would I go about finding out the scale values for the 2px?

    Any help would be great.
    Mike
    The Robotics Nut

  • #2


    What demo code?

    Comment


    • #3


      The demo I'm using is from 4d systems. I got my display and have decided to use my basic stamp 2 homwork board and I got the demo to send text and some graphics to the screen but it does seem to hang up on some of the serial commands. I have been looking for a schematic of how it should be connected to the stamp but I can't seem to find it. I have it directly wired to the stamp breadboard with no resistors.

      When it hangs up I have to disconnect the ground and reconnect it 2 times and then press the stamp reset button before it will work again. My goal is to keep it from from locking up and reset without having to manually unhook wires.

      Hangs up here:

      SEROUT 2, T19K2, [$45] 'Clear screen
      GOSUB GetACK

      SEROUT 2, T19K2, ["s", 3, 1, 0, $FF, $FF, Circle (fill), $00] 'Send text to screen. it displays this text then hangs.

      GOSUB GetACK

      SEROUT 2, T19K2, [i, 64, 64, 30, $00, $1F] 'Draw Blue filled Circle
      Mike
      The Robotics Nut

      Comment


      • #4


        what do you get on the screen? post full code - also what screen are you using?

        Comment


        • #5


          Well I have been able to write text, draw a solid rectangle, draw a hollow rectangle, draw lines, print a character, but I can't get the button commands to work! I dont understand what I am doing wrong. My display is working fine, my problems are basic stamp syntax related. One reason I was hanging up was that the demo had a display image command (I) and that is used for displaying images from the micro sd card per the user manual. I dont have a micro sd card and I had the jumper on the back header on which is used for auto display of images stored on the sd card. I have removed it.

          I'm stuck on buttons right now.

          Here is the modified demo:

          '*******************************************************************************
          ' Program Name: uOLED_Demo.bs2
          ' Author: Steve McManus
          ' Date: August, 2007
          ' Description: Demo of most of the common function of the uOLED
          '
          ' Special Notes: Tested using the 128x128 1MB and 160x128 1MB models
          '
          '
          '
          '*******************************************************************************
          '
          ' {$STAMP BS2}
          ' {$PBASIC 2.5}
          '
          '****************
          'Variables
          '****************
          counter VAR Word
          pinNum VAR Nib
          Rx VAR Byte
          hun VAR Byte
          ten VAR Byte
          one VAR Byte

          '----------------------------

          T1200 CON 813
          T2400 CON 396
          T4800 CON 188
          T9600 CON 84
          T19K2 CON 32
          T38K4 CON 6

          '****************
          'Main
          '****************
          PAUSE 2000


          DEBUG "And... ", CR
          PAUSE 1500
          DEBUG "Start!", CR


          GOTO Main


          powerUp:
          SEROUT 2, T19K2, [$59, $03, $01] 'Power up the screen


          Main:

          SEROUT 2, T19K2, [$55] 'Establish auto-baud
          GOSUB GetACK
          PAUSE 100


          SEROUT 2, T19K2, [$45] 'Clear screen
          GOSUB GetACK

          SEROUT 2, T19K2, [$42, $00, $00] 'Black Backbround
          GOSUB GetACK

          'SEROUT 2, T19K2, [p, $01] 'PEN SIZE

          'SEROUT 2, T19K2, [r, 0, 0, 100,100, $00, $1F] 'RECTANGLE

          '---------------------( Buttons )----------------------------------

          TextButtons:

          SEROUT 2, T19K2, [$45] 'Clear screen
          GOSUB GetACK

          SEROUT 2, T19K2, [$42, $00, $1F] 'blue Backbround
          GOSUB GetACK

          SEROUT 2, T19K2, [$4F,$00] 'Make text transparent

          SEROUT 2, T19K2, [b, 1, 18, 18, 70, 34 , $18, $63] 'Grey button
          GOSUB GetACK
          SEROUT 2, T19K2, ["s", 4, 3, 1, $F8, $00, NEXT, $00] 'Send text to screen (red)
          GOSUB GetACK
          SEROUT 2, T19K2, [b, 0, 18, 58, 70, 74 , $18, $63] 'Grey button
          GOSUB GetACK
          SEROUT 2, T19K2, ["s", 4, 8, 1, $F8, $00, PREV, $00] 'Send text to screen (red)
          GOSUB GetACK

          SEROUT 2, T19K2, ["s", 1, 12, 1, $00, $00, Text Buttons, $00] 'Send text to screen (red)
          GOSUB GetACK
          PAUSE 4000
          '--------------------------------------------------------------


          PAUSE 5000
          SEROUT 2, T19K2, [$59, $03, $00] 'Power Down the screen
          GOSUB GetACK
          PAUSE 4000 ' pause 4 sec to allow user to to turn off Stamp while uOLED is powered down
          ' and before demo restarts
          GOTO powerUp

          END






          '****************
          'Sub-Routines
          '****************

          GetACK:

          SERIN 3, T19K2, [Rx]
          IF (Rx = $06) THEN
          RETURN
          ELSE
          DEBUG "NAK ", HEX Rx, CR
          DEBUG "Power it down!", CR
          SEROUT 2, T19K2, [$59, $03, $00] 'Try to power down the screen anyway
          ENDIF
          RETURN
          Mike
          The Robotics Nut

          Comment


          • #6


            Not sure how you interpreted the button command that way, it's more like

            SEROUT 2, T19K2, ["b", 1, 0, 18, 0, 18, $FF, $FF, 3, $18, $63, 1, 1, Button, $00]
            Mark

            Comment


            • #7


              beat me to it - cmd, state, x, y, buttonColour(msb:lsb), font, stringColour(msb:lsb), width, height, √Ęstring√Ę, terminator

              but ESPsupport is the x,y not 1 byte so no 0 before the 18? and font 0-2?

              Comment


              • #8


                Ahh right, I quoted the Picaso 'sizes', so yeah, only single byte x + y and 0-2 for the Font
                Mark

                Comment


                • #9


                  Thanks guys, I got the button feature to work. kaddrison was right, the x,y is not 2 byte. I changed them to single byte and it works! I appreciate the help! Now I need to work on updating the screen with real time data. Oh and I changed the font from 3 to 2.
                  Mike
                  The Robotics Nut

                  Comment

                  Working...
                  X