Well, if we want to create and send a mix of String and Numeric Value, da is not the one to use even if it gives some codespace advantages.
O.K. for Text String only. So i'll stick to my first solution that used dt
Thanks for the tips anyway !
Well, if we want to create and send a mix of String and Numeric Value, da is not the one to use even if it gives some codespace advantages.
O.K. for Text String only. So i'll stick to my first solution that used dt
Thanks for the tips anyway !
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi Guys,
Hope you don't mind me butting in...
I've been using a similar method for 18F' devices in assembler for awhile now and I wonder if you might need to account for the occasional odd length character string to make sure the address is word aligned before placing it back into TOS?
Regards, Mike
Code:; ; Example macro usage ; _Title "K8LH Az/El Controller\r\n\n" _Print "Satellite AOS:\r\n" _Print "Satellite LOS:\r\n" ;****************************************************************** ; ; print the in-line string using Stack Pointer & TBLPTR ; PutString movff TOSH,TBLPTRH ; copy SP address to TBLPTR movff TOSL,TBLPTRL ; clrf TBLPTRU ; PutNxt tblrd *+ ; get character movf TABLAT,W ; last character (00)? bz PutXit ; yes, exit rcall Put232 ; else, print character bra PutNxt ; do another PutXit btfsc TBLPTRL,0 ; odd address? tblrd *+ ; yes, make it even (fix PC) movf TBLPTRH,W ; movwf TOSH ; update the return stack movf TBLPTRL,W ; movwf TOSL ; return ; ; ;******************************************************************
Last edited by Mike, K8LH; - 29th August 2005 at 03:02.
I'm using this for my LCD display, but what if....
I want to send two lines of text to my LCD?
Normally we would send $FE, $C0 to start the second line but coding this doesn't work using your example....
@ da "First line",$FE,$C0,"Second Line",0
I see you guys are doing this when sending serial data, by adding 13,10,0 to the string.
Cheers
J
using DA it won't work. Da pack two ascii character in a 14bit packet... 2X7Bits
$FE (wich should be write h'FE') is over the 127 dec or 7F Hex.
What you can do is to use something else something like
Code:DA "first line",1,2,"Second Line",0 . . . If char = 1 then char = $FE If char = 2 then char = $C0
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I use DEBUG to get to my serial pic LCD readout at 2400 baud. I have been trying to replace the hserout functions in the "string storage" thread with my usual debug output with no luck. I get repeating characters but not the expected string. I see now where there may be an issue because of the 14 bit word length but how to correct this is not clear.
Last edited by Homerclese; - 9th March 2007 at 06:23.
Thanks,
Homerclese
and when you use HSEROUT ["HELLO"] it works or not?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Using pin 25 RC6/TX and monitoring with MCS serial communicator at 9600 baud I get a repeating string of garbage characters. Hserout ["hello"] test result was the same. Isn't there an issue with hserout and inverted output?
In the mean time playing around I found this code works:
StringOut: ' Send the string out via serout
Readcode Addr, TwoChars ' Get the 14 bit packed characters
Char = TwoChars >> 7 ' Separate first char
if Char = 0 then StringDone ' Look for Null char, Stop if found
Gosub Out ' Send first char
Char = TwoChars & $7F ' Separate second char
if Char = 0 then StringDone ' Look for Null char, Stop if found
Gosub out ' Send the second char
Addr = Addr + 1 ' Point to next two characters
Goto StringOut ' Continue with rest of the string
StringDone:
Return
out:
Serout PORTE.1,N2400,[char]:Return
end
I'm trying to find a way to select ASCI character tag pairs based on a numerical index something like my flawed example below.
Lookup index,["A1","A2","A3","A4","B1","B2","B3","B4"....... ..],#tag
I can use codespace strings if there is no simpler way to go.
Last edited by Homerclese; - 9th March 2007 at 20:02.
Thanks,
Homerclese
Yes. HSEROUT & HSERIN work with non-inverted data. There is no wayIsn't there an issue with hserout and inverted output?
to force inverted when using the hardware USART without an external
inverter.
This was a new one on me. I was trying to work DT’s "STRINGS.PBP" code for the first time and ran across an error from MPASM, the likes of which I had never seen before.
“The Microchip assembler (MPASM) only allows up to 62 characters for path and file name. Current length is 72 characters”
AHHHH ??Now, I am not 100% efficient on doing a forum search, but I could not find anything like this. Stumped big time and no where to go.
Contacted the author and low and behold I had my code buried 5 levels deep into subdirectories on my C:\ drive. Each subdirectory had long names, hence 72 characters by the time I got to the directory where I placed my "STRINGS.PBP" code. Changed the subdirectory names to shorter lengths and bingo, works fine. Even though all my projects have worked fine over the years, one needs to think how and where they store their projects,
Thought I would share this little “tidbit” just incase someone else runs into it.
You aren't the 1st one to get bitten by that one. That used to bite me every once in awhile for no particular reason...and would stump me for literally hours each time.
To cure it, awhile back I started a completely separate partition just for MPLAB, PBP, MCS, PICKIT2, all my programming stuff and keep it all in the root directory.
Even if I do have to type something out at the command line, the line ends up being relatively short. Not to mention, I can 'dynamically' adjust the partition size with Partition Magic since the partition is so small. And I backup the whole thing at PC startup with a simple ZIP batch file straight to a thumbdrive. Practically bullet proof...and transportable...
Bookmarks