Calling Macro After Cross Page Boundry


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2011
    Location
    Michigan, USA
    Posts
    33

    Default Calling Macro After Cross Page Boundry

    Hello,
    Writing a small application to write to Nokia 5110 LCD. I am using code found in the wiki section with some small changes. I am not using the PrintStr macro.
    It is the PrintVar macro i am using. I don't do much macro work and need some help.

    I seem to be having trouble when i use a macro and i get cross page boundry warnings when compiling. That is to say, when i don't get the boundry
    warnings, (i reduce my code size), everything is o.k. Otherwise screen gets full of characters. I suspects chip has lost its way.

    PBP3
    MPLab 8.83
    PicKit 3 (programmer and powering circuit 3.3V)
    PIC16F1825
    Nokia 5110 LCD

    thanks,
    Mike

    Code:
    #CONFIG
    	__config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
    	__config _CONFIG2, _PLLEN_OFF & _LVP_OFF & _WRT_ALL & _STVREN_OFF & _BORV_19
    #ENDCONFIG
    
    
    DEFINE OSC 4
    DEFINE NO_CLRWDT 1
    
    'don't display page boundry error
    '@ ERRORLEVEL -306
    
    
    
    '--- Inputs ---
    
    
    
    '--- Outputs ---
    lcd_DC      var PORTA.2
    lcd_RES     var PORTC.0
    lcd_CLK     var PORTC.1
    lcd_SDO     var PORTC.2
    lcd_SCE     var PORTC.3
    
    
    
    '--- Variables ---
    posX        var byte
    posY        var byte
    FC          var byte[5]     '5 bytes = 1 character
    lcd_Data    var byte        'LCD command or data
    columnNum   var byte
    charNum     var byte
    temp		var word
    
    'for PrintVar macro
    varData     var word        'variable to print to lcd
    n           var byte        'for/next variable
    digits      var bit         'number of digits in varData
    
    
    
    
    '=== Initialize Chip ==========================================================
    InitChip:
    	'set internal clock to 4MHz
    	OSCCON = %01101000
    
    	PORTA = 0
    	LATA = 0
    	PORTC = 0
    	LATC = 0
    
    	'setup port i/o
    	TRISA = %001011
    	TRISC = %000000
    
    	'turn off all a/d inputs
    	ANSELA = 0
    	ANSELC = 0
    
    	'power on delay
    	pause 20
    
    	gosub LcdInit
    	gosub LcdClear
    	goto Main
    
    
    
    
    '===[ Subroutines ]================================================================
    'PrintVar Macro
    'Example: @ PrintVar x,y, _variableName
    asm
    PrintVar macro x, y, Variable
        local OverVar                
        goto OverVar                
    OverVar
        MOVE?CB  x, _posX           ;move x from above statement to PosX
        MOVE?CB  y, _posY           ;move y from above statement to PosY
        MOVE?WW  Variable, _varData ;move variable to VarData
        L?CALL   _VariableOut
        endm
    endasm
    VariableOut:
        @ bcf _digits
        for n = 4 to 0 step -1        		'cycles through all possible digts of number
            gosub LcdGotoXY          		'place character at position PosX and PosY
            lcd_Data = (varData dig n) + 48 'digit number n to character str format
            if lcd_data = 48 and digits = 0 then SkipChar 'skip if first char is 0
            @ bsf _digits             		'show that one character has been printed
            gosub LcdSendChar        		'print char to screen
            posX = posX + 6           		'next x position for character
    SkipChar:        
        next
    	return
    
    
    
    LcdInit:
        lcd_RES = 0      						'reset LCD (HW reset)
        pause 1
        lcd_RES = 1                         	'release reset
        lcd_SCE = 0                             'chip select
        lcd_DC = 0                              'command mode
         
      	lcd_Data = $21 : gosub LcdSendByte    	'LCD EXTENDED COMMANDS
      	lcd_Data = $c8 : gosub LcdSendByte      'SET LCD Vop (CONTRAST)
      	lcd_Data = $06 : gosub LcdSendByte      'SET TEMP COEFFICENT
      	lcd_Data = $13 : gosub LcdSendByte      'LCD BIAS MODE
      	lcd_Data = $20 : gosub LcdSendByte      'LCD STANDARD COMMANDS
      	lcd_data = $08 : gosub LcdSendByte      'LCD Blank
      	lcd_Data = $0c : gosub LcdSendByte      'LCD NORMAL MODE
    	return
    
    
    
    LcdSendByte:
        shiftout lcd_SDO,lcd_CLK,1,[lcd_Data]
        return
    
    
    
    LcdClear:
        gosub LcdHome
        lcd_DC = 1
        for columnNum = 1 to 84                         'Send empty character
        	shiftout lcd_SDO,lcd_CLK,1,[0,0,0,0,0,0] 	'14 per page
        next                                   			'6 rows
        return											'14 * 6 = 84
    
    
    
    LcdHome:
        posX = 0
        posY = 0
        gosub LcdGotoXY
        return
    
    
    
    LcdGotoXY:
        lcd_DC = 0
        lcd_Data = %01000000 | posY : gosub LcdSendByte	
        lcd_Data = %10000000 | posX : gosub LcdSendByte	
        return
    
    
    
    LcdContrast:
        lcd_DC = 0
        lcd_Data = %11010001
        gosub LcdSendByte
        return
    
    
    
    ScrNormal:
        lcd_DC = 0
        lcd_Data = %00001100
        gosub LcdSendByte
        return
    
    
    
    ScrInvert:
        lcd_DC = 0
        lcd_Data = %00001101
        gosub LcdSendByte
        return
    
    
    
    LcdSendChar:
    	lookdown lcd_data,[" !\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],charNum
    
        lcd_data = charNum + 32
        
        select case lcd_data
        	case 32                   
        		FC(0)=$00 : FC(1)=$00 : FC(2)=$00 : FC(3)=$00 : FC(4)=$00 ' sp
    	    case 33                   
    	    	FC(0)=$00 : FC(1)=$00 : FC(2)=$2f : FC(3)=$00 : FC(4)=$00 ' !
    	    case 34                   
    	    	FC(0)=$00 : FC(1)=$07 : FC(2)=$00 : FC(3)=$07 : FC(4)=$00 ' " (use \ to display " )
    	    case 35                   
    	    	FC(0)=$14 : FC(1)=$7f : FC(2)=$14 : FC(3)=$7f : FC(4)=$14 ' #
    	    case 36                   
    	    	FC(0)=$24 : FC(1)=$2a : FC(2)=$7f : FC(3)=$2a : FC(4)=$12 ' $
    	    case 37                   
    	    	FC(0)=$c4 : FC(1)=$c8 : FC(2)=$10 : FC(3)=$26 : FC(4)=$46 ' %
    	    case 38                   
    	    	FC(0)=$36 : FC(1)=$49 : FC(2)=$55 : FC(3)=$22 : FC(4)=$50 ' &
    	    case 39                   
    	    	FC(0)=$00 : FC(1)=$05 : FC(2)=$03 : FC(3)=$00 : FC(4)=$00 ' '
    	    case 40                   
    	    	FC(0)=$00 : FC(1)=$1c : FC(2)=$22 : FC(3)=$41 : FC(4)=$00 ' (
    	    case 41                   
    	    	FC(0)=$00 : FC(1)=$41 : FC(2)=$22 : FC(3)=$1c : FC(4)=$00 ' )
    	    case 42                   
    	    	FC(0)=$14 : FC(1)=$08 : FC(2)=$3E : FC(3)=$08 : FC(4)=$14 ' *
    	    case 43                   
    	    	FC(0)=$08 : FC(1)=$08 : FC(2)=$3E : FC(3)=$08 : FC(4)=$08 ' +
    	    case 44                   
    	    	FC(0)=$00 : FC(1)=$00 : FC(2)=$50 : FC(3)=$30 : FC(4)=$00 ' ,
    	    case 45                   
    	    	FC(0)=$10 : FC(1)=$10 : FC(2)=$10 : FC(3)=$10 : FC(4)=$10 ' -
    	    case 46                   
    	    	FC(0)=$00 : FC(1)=$60 : FC(2)=$60 : FC(3)=$00 : FC(4)=$00 ' .
    	    case 47                   
    	    	FC(0)=$20 : FC(1)=$10 : FC(2)=$08 : FC(3)=$04 : FC(4)=$02 ' /
    	    case 48                   
    	    	FC(0)=$3E : FC(1)=$51 : FC(2)=$49 : FC(3)=$45 : FC(4)=$3E ' 0
    	    case 49                   
    	    	FC(0)=$00 : FC(1)=$42 : FC(2)=$7F : FC(3)=$40 : FC(4)=$00 ' 1
    	    case 50                   
    	    	FC(0)=$42 : FC(1)=$61 : FC(2)=$51 : FC(3)=$49 : FC(4)=$46 ' 2
    	    case 51                   
    	    	FC(0)=$21 : FC(1)=$41 : FC(2)=$45 : FC(3)=$4B : FC(4)=$31 ' 3
    	    case 52                   
    	    	FC(0)=$18 : FC(1)=$14 : FC(2)=$12 : FC(3)=$7F : FC(4)=$10 ' 4
    	    case 53                   
    	    	FC(0)=$27 : FC(1)=$45 : FC(2)=$45 : FC(3)=$45 : FC(4)=$39 ' 5
    	    case 54                   
    	    	FC(0)=$3C : FC(1)=$4A : FC(2)=$49 : FC(3)=$49 : FC(4)=$30 ' 6
    	    case 55                   
    	    	FC(0)=$01 : FC(1)=$71 : FC(2)=$09 : FC(3)=$05 : FC(4)=$03 ' 7
    	    case 56                   
    	    	FC(0)=$36 : FC(1)=$49 : FC(2)=$49 : FC(3)=$49 : FC(4)=$36 ' 8
    	    case 57                   
    	    	FC(0)=$06 : FC(1)=$49 : FC(2)=$49 : FC(3)=$29 : FC(4)=$1E ' 9
    	    case 58                   
    	    	FC(0)=$00 : FC(1)=$36 : FC(2)=$36 : FC(3)=$00 : FC(4)=$00 ' :
    	    case 59                   
    	    	FC(0)=$00 : FC(1)=$56 : FC(2)=$36 : FC(3)=$00 : FC(4)=$00 ' ;
    	    case 60                   
    	    	FC(0)=$08 : FC(1)=$14 : FC(2)=$22 : FC(3)=$41 : FC(4)=$00 ' <
    	    case 61                   
    	    	FC(0)=$14 : FC(1)=$14 : FC(2)=$14 : FC(3)=$14 : FC(4)=$14 ' =
    	    case 62                   
    	    	FC(0)=$00 : FC(1)=$41 : FC(2)=$22 : FC(3)=$14 : FC(4)=$08 ' >
    	    case 63                   
    	    	FC(0)=$02 : FC(1)=$01 : FC(2)=$51 : FC(3)=$09 : FC(4)=$06 ' ?
    	    case 64                   
    	    	FC(0)=$32 : FC(1)=$49 : FC(2)=$59 : FC(3)=$51 : FC(4)=$3E ' @
    	    case 65                   
    	    	FC(0)=$7E : FC(1)=$11 : FC(2)=$11 : FC(3)=$11 : FC(4)=$7E ' A
    	    case 66                   
    	    	FC(0)=$7F : FC(1)=$49 : FC(2)=$49 : FC(3)=$49 : FC(4)=$36 ' B
    	    case 67                   
    	    	FC(0)=$3E : FC(1)=$41 : FC(2)=$41 : FC(3)=$41 : FC(4)=$22 ' C
    	    case 68                   
    	    	FC(0)=$7F : FC(1)=$41 : FC(2)=$41 : FC(3)=$22 : FC(4)=$1C ' D
    	    case 69                   
    	    	FC(0)=$7F : FC(1)=$49 : FC(2)=$49 : FC(3)=$49 : FC(4)=$41 ' E
    	    case 70                   
    	    	FC(0)=$7F : FC(1)=$09 : FC(2)=$09 : FC(3)=$09 : FC(4)=$01 ' F
    	    case 71                   
    	    	FC(0)=$3E : FC(1)=$41 : FC(2)=$49 : FC(3)=$49 : FC(4)=$7A ' G
    	    case 72                   
    	    	FC(0)=$7F : FC(1)=$08 : FC(2)=$08 : FC(3)=$08 : FC(4)=$7F ' H
    	    case 73                   
    	    	FC(0)=$00 : FC(1)=$41 : FC(2)=$7F : FC(3)=$41 : FC(4)=$00 ' I
    	    case 74                   
    	    	FC(0)=$20 : FC(1)=$40 : FC(2)=$41 : FC(3)=$3F : FC(4)=$01 ' J
    	    case 75                   
    	    	FC(0)=$7F : FC(1)=$08 : FC(2)=$14 : FC(3)=$22 : FC(4)=$41 ' K
    	    case 76                   
    	    	FC(0)=$7F : FC(1)=$40 : FC(2)=$40 : FC(3)=$40 : FC(4)=$40 ' L
    	    case 77                   
    	    	FC(0)=$7F : FC(1)=$02 : FC(2)=$0C : FC(3)=$02 : FC(4)=$7F ' M
    	    case 78                   
    	    	FC(0)=$7F : FC(1)=$04 : FC(2)=$08 : FC(3)=$10 : FC(4)=$7F ' N
    	    case 79                   
    	    	FC(0)=$3E : FC(1)=$41 : FC(2)=$41 : FC(3)=$41 : FC(4)=$3E ' O
    	    case 80                   
    	    	FC(0)=$7F : FC(1)=$09 : FC(2)=$09 : FC(3)=$09 : FC(4)=$06 ' P
    	    case 81                   
    	    	FC(0)=$3E : FC(1)=$41 : FC(2)=$51 : FC(3)=$21 : FC(4)=$5E ' Q
    	    case 82                   
    	    	FC(0)=$7F : FC(1)=$09 : FC(2)=$19 : FC(3)=$29 : FC(4)=$46 ' R
    	    case 83                   
    	    	FC(0)=$46 : FC(1)=$49 : FC(2)=$49 : FC(3)=$49 : FC(4)=$31 ' S
    	    case 84                   
    	    	FC(0)=$01 : FC(1)=$01 : FC(2)=$7F : FC(3)=$01 : FC(4)=$01 ' T
    	    case 85                   
    	    	FC(0)=$3F : FC(1)=$40 : FC(2)=$40 : FC(3)=$40 : FC(4)=$3F ' U
    	    case 86                   
    	    	FC(0)=$1F : FC(1)=$20 : FC(2)=$40 : FC(3)=$20 : FC(4)=$1F ' V
    	    case 87                   
    	    	FC(0)=$3F : FC(1)=$40 : FC(2)=$38 : FC(3)=$40 : FC(4)=$3F ' W
    	    case 88                   
    	    	FC(0)=$63 : FC(1)=$14 : FC(2)=$08 : FC(3)=$14 : FC(4)=$63 ' X
    	    case 89                   
    	    	FC(0)=$07 : FC(1)=$08 : FC(2)=$70 : FC(3)=$08 : FC(4)=$07 ' Y
    	    case 90                   
    	    	FC(0)=$61 : FC(1)=$51 : FC(2)=$49 : FC(3)=$45 : FC(4)=$43 ' Z
    	    case 91                   
    	    	FC(0)=$00 : FC(1)=$7F : FC(2)=$41 : FC(3)=$41 : FC(4)=$00 ' [
    	    case 92
    	    	'to display this character, copy this line and then
    	    	'follow with gosub WriteLCD
    	        FC(0)=$02 : FC(1)=$04 : FC(2)=$08 : FC(3)=$10 : FC(4)=$20 ' \
    	    case 93                   
    	    	FC(0)=$00 : FC(1)=$41 : FC(2)=$41 : FC(3)=$7F : FC(4)=$00 ' ]
    	    case 94                   
    	    	FC(0)=$04 : FC(1)=$02 : FC(2)=$01 : FC(3)=$02 : FC(4)=$04 ' ^
    	    case 95                   
    	    	FC(0)=$40 : FC(1)=$40 : FC(2)=$40 : FC(3)=$40 : FC(4)=$40 ' _
    	    case 96
    	    	FC(0)=$00 : FC(1)=$01 : FC(2)=$02 : FC(3)=$04 : FC(4)=$00 ' '
    	    case 97                   
    	    	FC(0)=$20 : FC(1)=$54 : FC(2)=$54 : FC(3)=$54 : FC(4)=$78 ' a
    	    case 98                   
    	    	FC(0)=$7F : FC(1)=$48 : FC(2)=$44 : FC(3)=$44 : FC(4)=$38 ' b
    	    case 99                   
    	    	FC(0)=$38 : FC(1)=$44 : FC(2)=$44 : FC(3)=$44 : FC(4)=$20 ' c
    	    case 100                   
    	    	FC(0)=$38 : FC(1)=$44 : FC(2)=$44 : FC(3)=$48 : FC(4)=$7F ' d
    	    case 101                   
    	    	FC(0)=$38 : FC(1)=$54 : FC(2)=$54 : FC(3)=$54 : FC(4)=$18 ' e
    	    case 102                   
    	    	FC(0)=$08 : FC(1)=$7E : FC(2)=$09 : FC(3)=$01 : FC(4)=$02 ' f
    	    case 103                   
    	    	FC(0)=$0C : FC(1)=$52 : FC(2)=$52 : FC(3)=$52 : FC(4)=$3E ' g
    	    case 104                   
    	    	FC(0)=$7F : FC(1)=$08 : FC(2)=$04 : FC(3)=$04 : FC(4)=$78 ' h
    	    case 105                   
    	    	FC(0)=$00 : FC(1)=$44 : FC(2)=$7D : FC(3)=$40 : FC(4)=$00 ' i
    	    case 106                   
    	    	FC(0)=$20 : FC(1)=$40 : FC(2)=$44 : FC(3)=$3D : FC(4)=$00 ' j
    	    case 107                   
    	    	FC(0)=$7F : FC(1)=$10 : FC(2)=$28 : FC(3)=$44 : FC(4)=$00 ' k
    	    case 108                   
    	    	FC(0)=$00 : FC(1)=$41 : FC(2)=$7F : FC(3)=$40 : FC(4)=$00 ' l
    	    case 109                   
    	    	FC(0)=$7C : FC(1)=$04 : FC(2)=$18 : FC(3)=$04 : FC(4)=$78 ' m
    	    case 110                   
    	    	FC(0)=$7C : FC(1)=$08 : FC(2)=$04 : FC(3)=$04 : FC(4)=$78 ' n
    	    case 111                   
    	    	FC(0)=$38 : FC(1)=$44 : FC(2)=$44 : FC(3)=$44 : FC(4)=$38 ' o
    	    case 112                   
    	    	FC(0)=$7C : FC(1)=$14 : FC(2)=$14 : FC(3)=$14 : FC(4)=$08 ' p
    	    case 113                   
    	    	FC(0)=$08 : FC(1)=$14 : FC(2)=$14 : FC(3)=$18 : FC(4)=$7C ' q
    	    case 114                   
    	    	FC(0)=$7C : FC(1)=$08 : FC(2)=$04 : FC(3)=$04 : FC(4)=$08 ' r
    	    case 115                   
    	    	FC(0)=$48 : FC(1)=$54 : FC(2)=$54 : FC(3)=$54 : FC(4)=$20 ' s
    	    case 116                   
    	    	FC(0)=$04 : FC(1)=$3F : FC(2)=$44 : FC(3)=$40 : FC(4)=$20 ' t
    	    case 117                   
    	    	FC(0)=$3C : FC(1)=$40 : FC(2)=$40 : FC(3)=$20 : FC(4)=$7C ' u
    	    case 118                   
    	    	FC(0)=$1C : FC(1)=$20 : FC(2)=$40 : FC(3)=$20 : FC(4)=$1C ' v
    	    case 119                   
    	    	FC(0)=$3C : FC(1)=$40 : FC(2)=$30 : FC(3)=$40 : FC(4)=$3C ' w
    	    case 120                    
    	    	FC(0)=$44 : FC(1)=$28 : FC(2)=$10 : FC(3)=$28 : FC(4)=$44 ' x 
    	    case 121                    
    	    	FC(0)=$0C : FC(1)=$50 : FC(2)=$50 : FC(3)=$50 : FC(4)=$3C ' y 
    	    case 122                    
    	    	FC(0)=$44 : FC(1)=$64 : FC(2)=$54 : FC(3)=$4C : FC(4)=$44 ' z 
    	    case 123
    	        FC(0)=$00 : FC(1)=$08 : FC(2)=$36 : FC(3)=$41 : FC(4)=$00'  {
    	    case 124
    	        FC(0)=$00 : FC(1)=$00 : FC(2)=$7F : FC(3)=$00 : FC(4)=$00 ' |
    	    case 125
    	        FC(0)=$00 : FC(1)=$41 : FC(2)=$36 : FC(3)=$08 : FC(4)=$00'  }    
    	    case 126
    	        FC(0)=$10 : FC(1)=$08 : FC(2)=$08 : FC(3)=$10 : FC(4)=$08'  ~
    	    case 127
    	        FC(0)=$10 : FC(1)=$08 : FC(2)=$08 : FC(3)=$10 : FC(4)=$08'  DEL        
    	    case 128
    	    	FC(0)=$55 : FC(1)=$2A : FC(2)=$55 : FC(3)=$2A : FC(4)=$55 ' (shaded)
    	end select
    WriteLCD:
        lcd_DC = 1
        shiftout lcd_SDO,lcd_CLK,1,[ FC(0),FC(1),FC(2),FC(3),FC(4),$00 ]
        return
    
    '=== End Subroutines ============================================================
    
    Main:
    	'Print some text on first line
    	lcd_Data = "A"
    	gosub LcdSendChar
    	lcd_Data = "B"
    	gosub LcdSendChar
    	lcd_Data = "C"
    	gosub LcdSendChar
    	
    
    	'print some variables
    	temp = 24
    	'@ PrintVar  0,4, _temp
    	temp = 621
    	'@ PrintVar  0,5, _temp
    
    	'Print some text on second line
    	posX = 0
    	posY = 1
    	gosub LcdGotoXY
    	lcd_Data = "a"
    	gosub LcdSendChar
    	lcd_Data = "b"
    	gosub LcdSendChar
    	lcd_Data = "c"
    	gosub LcdSendChar
    
    
    	end

  2. #2
    Join Date
    Feb 2011
    Location
    Michigan, USA
    Posts
    33


    Did you find this post helpful? Yes | No

    Default Re: Calling Macro After Cross Page Boundry

    This is what i'm thinking i have to do to solve this. Or please tell me if i'm way off.........

    If i call the macro from another page, do i need to account for page bits?
    'psuedo code for macro'
    begin macro -
    check if page bits are set to 0 page - (0 page is where macro resides)
    if not, save page bits in temp variables and set page bits to 0 -
    macro code here -
    restore page bits from temp variables -
    end macro -

    I fall down a well, my eyes go crossed. I get kicked by a mule, they go back. I don't know.

  3. #3
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Calling Macro After Cross Page Boundry

    just not sure if the boundary warning are the problem , i use a macro DT_int14.bas for instant interrupts , and since including the macro code i see this warning msg ( 306) x 3 when doing a compile but the code is working fine , removing some code when compiling does reduce the warning msg down to 2 but thats about it , removing the macro removes the msgs completely

    I am also using the same chip as you for my prog

    Not sure if this aids you or just confuses , but perhaps the problem may be else where not the msg it creates , just a thought

  4. #4
    Join Date
    Feb 2011
    Location
    Michigan, USA
    Posts
    33


    Did you find this post helpful? Yes | No

    Default Re: Calling Macro After Cross Page Boundry

    You may be right longpole. But this is what it's pointing to at this time.
    Sometimes i guess we wish for more problems so we have more information to troubleshoot.

    Well DT_interrupts handles page crossing. I'm pretty sure. So I don't think this is good enough proof of being not the problem.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Calling Macro After Cross Page Boundry

    Have you tried putting your vars all in bank 0 ?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Feb 2011
    Location
    Michigan, USA
    Posts
    33


    Did you find this post helpful? Yes | No

    Default Re: Calling Macro After Cross Page Boundry

    O.K. I'll try that tomorrow. (I don't have chip with me now)
    thanks,
    Mike

  7. #7
    Join Date
    Feb 2011
    Location
    Michigan, USA
    Posts
    33


    Did you find this post helpful? Yes | No

    Default Re: Calling Macro After Cross Page Boundry

    Archangel,
    No luck there. I just got a blank screen. I put all all my vars in Bank 0 like following example:
    posX var byte BANK0 SYSTEM

    I can get it to work if i manually do everything. But the macro would sure be nice.
    Mike -

  8. #8
    Join Date
    Feb 2011
    Location
    Michigan, USA
    Posts
    33


    Did you find this post helpful? Yes | No

    Default Re: Calling Macro After Cross Page Boundry

    Got it working.
    Changed code in Macro. Removed the local label called OverVar. Not sure why it was there anyway. Also took the gosub LcdGotoXY out of for/next loop since it only needed to be executed once.
    Also put in provision in case the variable number = 0.

    here's updated macro:
    Code:
    'PrintVar Macro
    'Example: @ PrintVar x,y, _variableName
    '
    asm
    PrintVar macro x, y, variable
        MOVE?CB  x, _posX
        MOVE?CB  y, _posY
        MOVE?WW  variable, _varData
        L?CALL   _VariableOut
        endm
    endasm
    VariableOut:
        zeroFlag = 0
        gosub LcdGotoXY
        
        'cycle through all possible digts of word sized number
        for n = 4 to 0 step -1        		
            lcdData = (varData dig n) + 48
            if lcdData = 48 AND zeroFlag = 0 then SkipNum
            zeroFlag = 1
            gosub LcdSendChar
            posX = posX + 6
    SkipNum:
    		'if varData = 0 then print "0"
    		if n = 0 AND zeroFlag = 0 then	
            	gosub LcdSendChar
            endif
        next
    	return

Members who have read this thread : 0

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