Shop OBEX P1 Docs P2 Docs Learn Events
Newbie 4D_VisiGeni.spin help — Parallax Forums

Newbie 4D_VisiGeni.spin help

Mathew Brown wrote what I think is a great object for the 4D System uLCD32-PTU intelligent touch screen display. I have all the "screens" built and they all seem to work as far as the 4D test facility indicates.

I can write to the display no problem but I can't seem to read FROM the display. I'm sure it is my VERY limited experience with Spin but would appreciate it if someone could shed some light on what I am missing in getting the ReadObject method to work..

Here is the method I'm stuck on:

PUB ReadObjValue(ObjectId,ObjectIndex) 'Reads the value of a displayed GUI object ...


  SendByte(CmdReadValue)        'Byte 1 is command byte 'CmdReadValue'
  SendByte(ObjectID)            'Byte 2 is ObjectID
  SendByte(ObjectIndex)         'Byte 3 is Object Index  
  SendChksum                    'Byte 4 is calculated checksum, of previous bytes

  'Wait for valid report object packet reply from LCD
  result := PollReportObj(True)

  'Return value truncated to the control value (0000-FFFF) only
  result &= $FFFF       




In my application I am trying to read a "ObjWinButton = $06" with the line LCD.ReadObjValue(ObjWinButton, 0)

LCD is my nickname for the VisiGenie object..

I get an expression expected error if I use the "ObjWinButton" but get a good compilation if I use instead {$06,0).

I am trying to see the result of pushing this particular button show up on the Parallax Serial Terminal to no avail.

By the way the WinButton 0 is the first momentary push button in the display.

Thanks for reading

Mike B.

Comments

  • Really? No one??

    Mike B.
  • Hello Mike,

    I use the 4D Displays quite a bit and have authored a number of 4D code elements for them along with SPIN code to interface (some of which is posted here on the OBEX). However, I seldom use the 4D Systems folks generated stuff other than Visi, as (in my opinion) the "Genie" is rather poorly documented, buggy and there is little in the way of other useful material on the 4D Website to clarify things. James on the 4D staff from NZ is helpful if you can get his attention. Generally I use Visi to construct graphical elements, when absolutely necessary, and then write native 4D code to take care of the communications so that I have complete control over the process. That way I don't have to rely on "black boxes".

    I would say the most probable reason no one has replied here is that the code sample you have included is not really completed enough to make sense of it.

    I have a uLCD32-PTU setting here mounted on a little robotics project I could test with. If you post here a very simple example of one of your on screen controls and the associated code I would be glad to help and see if I can get you a decent answer. Zip it up and attach it to your reply if you are interested. I'll keep an eye open for it.

    Regards...
    ...Mark Owen (not the Bogus Navy Seal)
  • OK Mark:

    Thanks for the reply. I was tempted to include the entire VisiGenie object but thought that might annoy someone. Turns out I found the answer to my problem in an obscure AppNote number 11.

    Turned out I was using the same ObjectNames that were in the VisiGenie object in my application. I have since redefined all the object names in my application to the same name/values as the VisiGenie object but with out the "Obj" prefix. I am now able to read and write to the display OK. My error was being unaware that the constant declarations in the VisiGenie object are LOCAL to that object and I was using their names in my application which of course generated an error... I know better now...lol


    I also need to go into the 4D IDE and change the event handlers for the Winbuttons from "select form" to "report message" handler and then write the form number etc from the host (Parallax Propeller) to the display... I want the WinButtons to simply be a push button then I'll decide what to do about it...


    If you haven't figured it out yet I am a total newbie to the Prop...

    I would be interested in seeing ANYTHING you have done with the 32PTU

    FYI. I am building a "box" that will be in my pickup that controls my three ham radios using a BlueTooth headset, displays GPS data, controls a motor driven HF antenna that has an encoder for position feedback. So far I have been able to hack all these various pieces of hardware in a test condition so now it's time for me to tie them all together.

    This might be an ambitious undertaking for a total dunce but I never understood the term "you can't do that". I'm hard headed...

    Mike B.
  • I use the 4D-Systems 7-inch display all the time and I would recommend hands down to program everything from the native code of the display. It has a very capable processor and a very similar feel to Spin. The only exception is where we have a display programmed to function similar to a PLC interface where every event that happens on the display is sent in a packet form serially to whomever is listening. The display is also capable of receiving packet commands. But again, even in this situation, all of the grunt work is done within the display. Anything else just creates a huge bottle neck and trying to drive the display serially with another processor doing the grunt work makes for very inefficient response times.
  • Hi Beau:

    Well the VisiGenie has been working for me quite nicely even at 9600 baud. I have spent weeks building my display "forms" and have them pretty well tweaked. My problem wasn't with the 4D display rather my lack of experience with Spin which I think I have now sorted out. I just needed to figure out how to communicate with the display which I have done.

    I am hesitant to try and learn yet another programing language (4D native code) when I am up to my backside in learning Spin. All my box does is display some screens with push buttons and a couple thermometer gauges (for volume and mic gain) which I can already use and like I said, even at 9600 baud they react instantly . I'll be running some of this stuff in separate cogs like the GPS module (also from Parallax), HB-25 for motor control, Blue Tooth module, rotary encoder etc for example.

    Next time I need to tweak a form on the display I might try 115,200 baud. These buttons will only get pushed once in a blue moon so mega performance really isn't required in this application. (300 baud would probably be good enough) (it's a hobby with me)... Maybe down the line when I master Spin (insert laughter here) I'll try some apps with the native code...

    VisiGenie was the primary reason I bought the display from Parallax....

    (Did I mention I am 71. "You can teach an old dog new tricks, but you can't teach a dumb dog nuttin" !)

    Mike B.
Sign In or Register to comment.