A tft addin for pbp3


Results 1 to 40 of 142

Threaded View

  1. #16
    Join Date
    May 2013
    Location
    australia
    Posts
    2,390


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    having an issue here with a usercmd macro overwriting an array boundary and I'm at a loss to understand what I'm doing wrong ,
    attached is a safer version of the touch screen addin.

    problem is , lets say I have defined number_of_buttons con 9
    vars are defined by button_Taddr VAR byte[number_of_buttons*3]

    by my count that's 27 bytes

    I usercmd a button the nineth button

    MAKEBUTTON 34,216,8,40
    in the macro k=Button*3 which should be 24
    so

    movlw 0
    movwf _button_Taddr +k
    movwf _button_Taddr +k+1
    movwf _button_Taddr +k+2
    should place 0 into button_Taddr[24-26]
    but something else gets clobbered instead , buttons 0-7 seem ok but I might be wrong



    Code:
      
    MAKEBUTTON?CCCC  macro X0in ,Y0in ,Button ,Szin     ;sqr button no text
    k=Button*3   ; 
    j=Button*2    ;1 WORD  PER BUTTON
    i=Button*6    ;3 WORDS PER BUTTON
        
        if Button <8
        bcf _button_action ,Button
        bcf _button_rpt ,Button
        bcf _button_set ,Button
        else
        bcf _button_action+1 ,Button-8
        bcf _button_rpt+1 ,Button-8
        bcf _button_set+1 ,Button-8
        endif
        MOVE?CW  Szin ,_button_xsize+ j
        MOVE?CW  Szin ,_button_ysize+ j
        MOVE?CB  0  , _BUTTON_STATE + Button
    ;    movlw   0
    ;    movwf   _button_Taddr +k 
    ;    movwf   _button_Taddr +k+1
    ;    movwf   _button_Taddr +k+2
        MOVE?CW  0  ,button_count +i
        MOVE?CW  X0in ,button_X  +i
        MOVE?CW  Y0in ,button_Y  +i
        MOVE?CW  0, _button_Tsize +  j   
      endm
    Attached Files Attached Files

Similar Threads

  1. Replies: 0
    Last Post: - 25th September 2013, 18:33
  2. code examples / libraries for ILI9320 2.8" TFT LCD Module
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 6th June 2013, 08:50
  3. I really need some help with PBP3
    By Ramius in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th February 2012, 16:05
  4. What's with PBP3?
    By BrianT in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th August 2011, 17:09
  5. Experience of driving TFT screens?
    By isaac in forum General
    Replies: 1
    Last Post: - 26th September 2008, 00:15

Members who have read this thread : 6

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts