Shop OBEX P1 Docs P2 Docs Learn Events
Mouse_TV_Monitor.spin trouble — Parallax Forums

Mouse_TV_Monitor.spin trouble

El PaisaEl Paisa Posts: 375
edited 2006-10-07 02:49 in Propeller 1
I am trying to run Mouse_TV_Monitor.spin ·but·the only thing that get is the banner "MouseCoodinates".
and nothing happens afterwards.

I changed VideoDisplay(3) to VideoDisplay(12).

I am using the demo board with a mouse connected.

Is a new version?

Please somebody help me!!.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-06 02:26
    Check that the mouse pin numbers in the program are correct. Some of the older demonstration programs had pin numbers that didn't match the production demo boards.
  • El PaisaEl Paisa Posts: 375
    edited 2006-10-06 02:42
    Hi Mike,
    In the program there is not provisions to· insert the mouse port numbers.
    I tried to insert "·mouse.start(24, 25)" in various locations but still·the same problem.·
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2006-10-06 03:10
    El Paisa,

    Can you post your code?

    Dropping to DOS and doing a dir/s/p Mouse_TV_Monitor.spin in the root directory yields no results for finding that particular file.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • El PaisaEl Paisa Posts: 375
    edited 2006-10-06 12:23
    Beau,

    This is the file.
  • simonlsimonl Posts: 866
    edited 2006-10-06 12:54
    El Paisa,

    Your start routine only: starts the TV, sets the colours, send the string to the TV, then sends a new line. It then stops! What do you want it to do next?

    For example, if you want a continuous display of mouse coordinates you'll need to do something like the following (Note, I'm not near a PChip, so can't check I'm right...):
    PUB Start 
      VideoDisplay.start( 12 ) 
      SetScreenToWhiteOnDarkBlue 
     
      start_mouse( dd, cc )                      ' Where dd = dpin and cc = cpin
    
      VideoDisplay.str( string( "Mouse coordinates" ) ) 
      VideoDisplay.Out( NewLine ) 
    
      WaitCnt( 5_000_000 + Cnt ) 
    
      Repeat                                     ' Do this loop forever
        VideoDisplay.str( string( "ax = " ) ) 
        VideoDisplay.dec( ax ) 
        VideoDisplay.str( string( " ay = " ) ) 
        VideoDisplay.dec( ay ) 
        VideoDisplay.Out( NewLine )
    

    ·The important bit is the Repeat block - this is an endless loop...

    ·Hope that helps.

    *** Edit:

    Also, as Mike said, the version of mouse.spin I have (see attached)·has got a PUB start(dpin, cpin) routine. I've added the call in my code above. NO. WAIT. I see what's happened, you appear to have copied mouse.spin into your code, and renamed the mouse object's start routine to "mouse_start". You've forgotten to call that start routine -- I've added the call above.

    If you need to keep the mouse routines in your code (which you should only need to do if you've made changes -- and even then I'd keep them in their own file called (say) mouse2.spin) then the above should work. Otherwise, your OBJ declaration should be: mouse : "mouse2", and the start routine would then be: mouse.start_mouse( dd, cc ).

    I think that's right...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon

    Post Edited (simonl) : 10/6/2006 3:32:10 PM GMT
  • El PaisaEl Paisa Posts: 375
    edited 2006-10-06 17:40
    Simon,

    All I want is to run the Mouse_TV_Monitor and use all the mouse functions.

    This file Mouse_TV_Monitor is not mine, I copied from the forum right after the propeller was released.

    I hope Beau or Mike take a look at the file and modified so it will run.
  • El PaisaEl Paisa Posts: 375
    edited 2006-10-07 01:30
    Beau, Mike,

    I know how busy you are,·for this I really apologize.

    Could you take a quick view at the attached Mouse_TV_Monitor program and tell

    me what I have to do to having running?.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-07 01:43
    El Paisa,
    This program is doing exactly what it was written to do, essentially display the words "MouseCoordinates" and stop. Even though it includes a copy of the mouse driver, nothing calls the mouse routines. The program actually doesn't do anything with the mouse. I suspect you got a "non-working" early copy of someone's program.

    The graphics_demo program included with the Propeller Tool does illustrate the use of some of the mouse routines. I suggest you start there.
    Mike
  • El PaisaEl Paisa Posts: 375
    edited 2006-10-07 01:52
    Mike,

    I really appreciate your prompt response.

    I ask form you is a program that displays the mouse functions that Mouse_TV_Monitor shows like,

    PUB present : type

    '' Check if mouse present - valid ~2s after start
    '' returns mouse type:
    ''
    ''·· 3 = five-button scrollwheel mouse
    ''·· 2 = three-button scrollwheel mouse
    ''·· 1 = two-button or three-button mouse
    ''·· 0 = no mouse connected

    · type := par_present·····
    ···
    PUB button(b) : state

    '' Get the state of a particular button
    '' returns t|f

    · state := -(par_buttons >> b & 1)
    · VideoDisplay.bin(state,8)···

    PUB buttons : states

    '' Get the states of all buttons
    '' returns buttons:
    ''
    ''·· bit4 = right-side button
    ''·· bit3 = left-side button
    ''·· bit2 = center/scrollwheel button
    ''·· bit1 = right button
    ''·· bit0 = left button
    · VideoDisplay.bin(states,8)

    The Graphics_Demo only shows two mouse functions Mouse_button(0) and Mouse_button(1).

    According to Chip Gracey, there are five (5) mouse functions.

    I would like to see those five functions.

    I really appreciate your help.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-07 02:49
    I think you have enough information in the Graphics_Demo program to try to do this yourself. You'll learn better that way and the functions involved are not complicated. You can certainly use the .bin and .hex and .dec routines to display the information. If you have questions as you go along, ask them.
    Mike
Sign In or Register to comment.