another pic
Never done something like that, but as DT said there is no better manual than .mac and .lib files.
So here is what I found.
Compiler use this macro from pbppic18.mac file when LCDOUT STR is used
SEROUT2STR is in file pbppic18.Code:;**************************************************************** ;* LCDOUTSTR?B : Macro - Lcdout string * ;* * ;* Input : B[] * ;* Output : None * ;* * ;* Notes : * ;**************************************************************** LCDOUTSTR?B macro Bin MOVE?CW LCDOUTJ, R8 'dont know what this line do MOVE?CB high (Bin), FSR2H 'load highbyte of adr, from pbppic18.lib Macro - Move BYTE Variable into WORD Variable MOVE?CA low (Bin) 'load low byte of adr to w, from pbppic18.lib MOVE?CA : Macro - Move constant into W L?CALL SEROUT2STR endm
So you could use in your program something like this:Code:SEROUT2STR movwf FSR2L ; Set up for index serout2strloop movf POSTINC2, W ; Get a character bnz serout2str1 ; Not null char
EDIT:Code:TFTSTR?B macro Bin MOVE?CB high (Bin), FSR2H ;load highbyte MOVE?CB low (Bin), FSR2L ;load low byte local tftstrloop local tftStrDone tftstrloop movf POSTINC2, W ; Get a character, then increment pointer BZ tftStrDone ;All strings must end with 0 ;Not Null char L?CALL tftWoutput; CALL print char in W to TFT BRA tftstrloop ;Get next chr tftStrDone: ;Null char endm ;end of macro
You could also use PBP's routine like LCDOUTSTR do, but you must see what this flags do
LCDOUTJ_USED = 1
SEROUT2STR_USED = 1
And how JUMPMAN is used.
Last edited by pedja089; - 22nd June 2015 at 02:11.
Hi Richard,
Where is the subroutine tft_init ?
I have ordered 2 from your seller should get then before Christmas . . .
These look very promising .. .
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.
updated version , complete this time {end must have fallen off first time}
that's what I was looking for thanks pedja089MOVE?CB high (Bin), FSR2H ;load highbyte
MOVE?CB low (Bin), FSR2L ;load low byte
that's one down , works like a dream
Code:GLCDSTR?CCB macro Xin ,Yin ,Bin movlw Xin CHK?RP _X MOVWF _X movlw Yin CHK?RP _Y MOVWF _Y MOVE?CB high (Bin), FSR2H ;load highbyte MOVE?CB low (Bin), FSR2L ;load low byte strloop movf POSTINC2, W ; Get a character bnz outstr1 ; Not null char bra exstr outstr1 MOVWF _g_chr L?CALL _gcga bra strloop exstr endm
woops - looping in macro for multiple calls is a no go
needs to be like this
Code:GLCDSTR?CCB macro Xin ,Yin ,Bin movlw Xin CHK?RP _X MOVWF _X movlw Yin CHK?RP _Y MOVWF _Y MOVE?CB high (Bin), FSR2H ;load highbyte MOVE?CB low (Bin), FSR2L ;load low byte L?CALL bfill endm bfill Next_Char movf POSTINC2, W ; Get a character bnz outchr ; Not null char bra exstr2 outchr MOVWF _g_chr L?CALL _gcga bra Next_Char exstr2 return
now have strings and circles, moved font to include file
HOW TO USE THIS STILL ELUDES ME would be nice for display of "constant" stringUSERCOMMAND?S
You can use label in macro and multiple call to that macro.
Just need to define your labels as local.
Here is local used in my example:
But way your done use less FLASHCode:TFTSTR?B macro Bin MOVE?CB high (Bin), FSR2H ;load highbyte MOVE?CB low (Bin), FSR2L ;load low byte local tftstrloop local tftStrDone tftstrloop movf POSTINC2, W ; Get a character, then increment pointer BZ tftStrDone ;All strings must end with 0 ;Not Null char L?CALL tftWoutput; CALL print char in W to TFT BRA tftstrloop ;Get next chr tftStrDone: ;Null char endm ;end of macro
And you can make bfill little smaller
To save few bytes in FLASH.Code:bfill Next_Char movf POSTINC2, W ; Get a character bz exstr2 ; Null char MOVWF _g_chr L?CALL _gcga bra Next_Char exstr2 return
And I'll suggest you to put TFT_ in front all labels and variable names so there is minimal chance for user to duplicate label/variable or unintentional use one of tft variables.
And for "Constant String" I don't know how to implement it with user command. But I know assembler part
Here is use of asm macro
PrintStr 0,0," Test Clock"
And macro:
This is from example for nokia 3310 lcd, that I tried to get to work with GLCD with KS0108 controler.Code:PrintStr macro x, y, Str local TheString, OverStr ; define local labels so you can call macro multiple times goto OverStr ' goto over string stored in FLASH, so processor can't execute that TheString ;label to get address of your string data Str, 0 ;add string to flash at TheString address and end string with 0 OverStr MOVE?CB x, _GLCD_X MOVE?CB x, _GLCD_SX MOVE?CB y, _PosY MOVE?CW TheString, _GLCD_Addr ;move addres of string to word variable, don't know how it would work with device that have more than 65535K of FLASH??? L?CALL _GLCD_StringOut endm ENDASM GLCD_StringOut: Readcode GLCD_Addr, GLCD_Char ' Get a character if GLCD_Char = 0 then RETURN ' Look for Null char, Stop if found ...... RETURN
Last edited by pedja089; - 22nd June 2015 at 12:55.
brilliant , thanks for the tip pedja089Just need to define your labels as local.
seems nobody doesAnd for "Constant String" I don't know how to implement it with user command
I might just stick to my flash2ram macro for now
Bookmarks