I have never tried DEFINE_BAUD
maybe that was the problem.
I have never tried DEFINE_BAUD
maybe that was the problem.
Dave
Always wear safety glasses while programming.
Hmm, now I have problem with reading from the USART instead..
I searched the forum and found ALOT of threads, but none that really solved my prob..
I want to read a string of chars, like 16, BUT if a CR (13) occurs it should skip the rest.
I.e I want to be able to write strings UP to 16 chars in my terminal program, and get them as a string or array.
This seem to be a bit harder than I first thought ?
It was very easy to read single chars with HSERIN.. and I thiought it would be easy with something like
HSERIN [ str rxarr\16\13 ]
..But no ?
Does anyone have a bit of sample code that do this using HSERIN ?
Have you used SEROUT2/SERIN2 much? The hardware command use the same syntax.
Off the top I would try
$d
in place of
13
What exactly is or is not happening?
Dave
Always wear safety glasses while programming.
Well, I havent used SERIN, never really had use of the serial stuff before.
Now I have:
main:
HSERIN [ str rxarr\8\13 ]
LCDOUT $FE, 1, "Serial data is:"
LCDOUT $FE, $C0, rxarr
pause 500
goto main:
..This just print the first char I write.. I want rxarr to contain eight chars.
btw I found this on melabs website, which made me even more confused..
http://melabs.com/resources/samples/pbp/usart.bas
I think I see what you need. When you use the STR thing it is creating an array. Here is an example.
the above is saving a 16 character array but I only want every other bit. Now I have eight variables X1 to X8. Do what ever you need with them.Code:SERIN2 PORTB.5,24972,[WAIT("A"),STR NUMS\16] '7, Even X1 = (NUMS[1]) X2 = (NUMS[3]) X3 = (NUMS[5]) X4 = (NUMS[7]) X5 = (NUMS[9]) X6 = (NUMS[11]) X7 = (NUMS[13]) X8 = (NUMS[15])
Sorry for the poor example but it is what I have with me.
Dave
Always wear safety glasses while programming.
Bookmarks