Adding BYTEs into a STRING Oshonsoft BASIC

ericgibbs

Joined Jan 29, 2010
18,869
hi C,
A simple HEX to ASCII Proc.
Showing 3 conversion examples for Byte lengths 1 to 3.
E
Hi,
The site will not allow me to post the code file either as text or as Code, so here it is as an image.!
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
hi C,
A simple HEX to ASCII Proc.
Showing 3 conversion examples for Byte lengths 1 to 3.
E
Hi,
The site will not allow me to post the code file either as text or as Code, so here it is as an image.!
Hi E,
I can't recall how the full CODE uses the DATA, I think it deals with it ok, and PARSES out each bit of information. I'll have to set it up of course, when I add this CODE into the full CODE.

Why has AAC stopped accepting CODE postings and inserts?
C
 

ericgibbs

Joined Jan 29, 2010
18,869
Why has AAC stopped accepting CODE postings and inserts?
hi C,

Are you also having a problem in Posting short Code programs.??

E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Why has AAC stopped accepting CODE postings and inserts?
hi C,

Are you also having a problem in Posting short Code programs.??

E
Hi E,
Here's one of the TXT files that you posted #15.
If it appears then I can post files, in this format?

I tried various method with my CODE, but failed, possibly too long, even though I've done it lots of time before, so somthing has changed.
C
 

Attachments

Last edited:

ericgibbs

Joined Jan 29, 2010
18,869
hi
Like this.?
E

Code:
Include "setup1.bas"

Dim gps As String

Hseropen 9600
Hserout "Ready!", CrLf

'This is the debug subroutine test Coding.

main:
'for generating test code ONLY
gps = "12"

'this line is the Code that does the work
gps = RightStr("000" + gps, 3)
'So assume your Compass SPI value was '27'
'add "000" to the leftside so that would be '00027'
'then select the right side 3 characters  ie: '027'

Hserout gps, " ",


Goto main
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
hi
Like this.?
E

Code:
Include "setup1.bas"

Dim gps As String

Hseropen 9600
Hserout "Ready!", CrLf

'This is the debug subroutine test Coding.

main:
'for generating test code ONLY
gps = "12"

'this line is the Code that does the work
gps = RightStr("000" + gps, 3)
'So assume your Compass SPI value was '27'
'add "000" to the leftside so that would be '00027'
'then select the right side 3 characters  ie: '027'

Hserout gps, " ",


Goto main
Hi E,
First go compiled ok. Surprised look on face!!
I'll now try to post the files. NO GO for all 3x files
The MAIN.txt file is 36 lines long
C

@bertus
 
Last edited by a moderator:

sagor

Joined Mar 10, 2019
912
Why has AAC stopped accepting CODE postings and inserts?
hi C,

Are you also having a problem in Posting short Code programs.??

E
Eric, I see the same thing with anything, including text files, that have the [ CHR ] function in it. Not sure why this forum rejects that. Like I said, it even rejects a text file that contains that character/function. Strange.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
hi C,
The way I do it is this way, simple and short, shows two examples in the Code clip.
Code:
Dim gps As String
Dim compass As String

main:
'for generating test code ONLY
gps = "12"

'this line is the Code that does the work
gps = RightStr("000" + gps, 3)
'So assume your gps SPI value was '27'
'add "000" to the leftside so that would be '00027'
'then select the right side 3 characters  ie: '027'

Hserout gps, " ",


'for generating test code ONLY
compass = "1"

'this line is the Code that does the work
compass = RightStr("000" + compass, 3)
'So assume your Compass SPI value was '27'
'add "000" to the leftside so that would be '00027'
'then select the right side 3 characters  ie: '027'

Hserout compass, CrLf

Goto main
Hi E,
I am getting an error message with this:
NOTE: I will try the earlier version, which may save you replying.
C
 

Attachments

Last edited:

ericgibbs

Joined Jan 29, 2010
18,869
hi ,
This is the Code line Posted.
gps = RightStr("000" + gps, 3)

Why have you changed it, so it now reports an error.???

E
Code:
Include "setup1.bas"

Dim gps As String

Hseropen 9600
Hserout "Ready!", CrLf

'This is the debug subroutine test Coding.
main:
'for generating test code ONLY
gps = "12"

'this line is the Code that does the work
gps = RightStr("000" + gps, 3)
'So assume your Compass SPI value was '27'
'add "000" to the leftside so that would be '00027'
'then select the right side 3 characters  ie: '027'

Hserout gps, " ",
Goto main
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
hi ,
This is the Code line Posted.
gps = RightStr("000" + gps, 3)

Why have you changed it, so it now reports an error.???

E
Code:
Include "setup1.bas"

Dim gps As String

Hseropen 9600
Hserout "Ready!", CrLf

'This is the debug subroutine test Coding.
main:
'for generating test code ONLY
gps = "12"

'this line is the Code that does the work
gps = RightStr("000" + gps, 3)
'So assume your Compass SPI value was '27'
'add "000" to the leftside so that would be '00027'
'then select the right side 3 characters  ie: '027'

Hserout gps, " ",
Goto main
Hi E,
This CODE is READing actual messages generated by the SLAVE. So far there is no GPS, only a test STRING for a compass. If I've got it correct? [ $COMPDEGS,1,W ] (COMPASS, DEGREES, SLAVE)
So I had to change GPS,.

I now have spotted more of my errors. Let's see if I can change them to make it work?
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
hi,
Providing you have defined the correct Type, it could be named to suit.

Dim AnyString as String

AnyString = RightStr("000" + AnyString, 3)
Hi E,
Ok, I have to change 'GPS' 'anystring' add a PROCESS at the correct place, and make that PROCESS.

I will also move back from the FULL CODE to the test CODE, and go from there.
Thanks
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi E,
Correct me if I'm wrong, but I think the message coming from the SLAVE [ $COMPDEGS,XXX,W ] is causing confusion with your [ ANYSTRING ] CODE.
Counting from the right starts with a W then a COMMA. This is all neede for later when the DATA is PARSED out using CSV.
C
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
First, in this case I'm talking about READing the DATA from the SLAVE in the MASTER.

Am I getting mixed up between the degrees XXX and the STRING, [ $COMPDEGS,XXX,W ] STRING.

I think I've been adding the [ 0s ] to the whole STRING, that has been received by the MASTER [ $COMPDEGS,XXX,W ] , where I should be adding them into the XXX first, before being sent from SLAVE to MASTER.

I hope you follow.
C
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,730
Hi,
Good:)

I did the above and it's working.
'___________________________________________________
From Slave=$COMPDEGS,320,W
From Slave=$COMPDEGS,321,W
From Slave=$COMPDEGS,322,W
From Slave=$COMPDEGS,323,W
From Slave=$COMPDEGS,324,W
From Slave=$COMPDEGS,325,W
From Slave=$COMPDEGS,326,W
From Slave=$COMPDEGS,327,W
From Slave=$COMPDEGS,328,W
From Slave=$COMPDEGS,329,W
From Slave=$COMPDEGS,330,W
From Slave=$COMPDEGS,331,W
From Slave=$COMPDEGS,332,W
From Slave=$COMPDEGS,333,W
From Slave=$COMPDEGS,334,W
From Slave=$COMPDEGS,335,W
From Slave=$COMPDEGS,336,W
From Slave=$COMPDEGS,337,W
From Slave=$COMPDEGS,338,W
From Slave=$COMPDEGS,339,W
From Slave=$COMPDEGS,340,W
From Slave=$COMPDEGS,341,W
From Slave=$COMPDEGS,342,W
From Slave=$COMPDEGS,343,W
From Slave=$COMPDEGS,344,W
From Slave=$COMPDEGS,345,W
From Slave=$COMPDEGS,346,W
From Slave=$COMPDEGS,347,W
From Slave=$COMPDEGS,348,W
From Slave=$COMPDEGS,349,W
From Slave=$COMPDEGS,350,W
From Slave=$COMPDEGS,351,W
From Slave=$COMPDEGS,352,W
From Slave=$COMPDEGS,353,W
From Slave=$COMPDEGS,354,W
From Slave=$COMPDEGS,355,W
From Slave=$COMPDEGS,356,W
From Slave=$COMPDEGS,357,W
From Slave=$COMPDEGS,358,W
From Slave=$COMPDEGS,359,W
From Slave=$COMPDEGS,000,W
From Slave=$COMPDEGS,001,W
From Slave=$COMPDEGS,002,W
From Slave=$COMPDEGS,003,W
From Slave=$COMPDEGS,004,W
From Slave=$COMPDEGS,005,W
From Slave=$COMPDEGS,006,W
From Slave=$COMPDEGS,007,W
From Slave=$COMPDEGS,008,W
From Slave=$COMPDEGS,009,W
From Slave=$COMPDEGS,010,W
From Slave=$COMPDEGS,011,W
From Slave=$COMPDEGS,012,W
From Slave=$COMPDEGS,013,W
From Slave=$COMPDEGS,014,W
From Slave=$COMPDEGS,015,W
From Slave=$COMPDEGS,016,W
From Slave=$COMPDEGS,017,W
From Slave=$COMPDEGS,018,W
From Slave=$COMPDEGS,019,W
From Slave=$COMPDEGS,020,W
From Slave=$COMPDEGS,021,W
From Slave=$COMPDEGS,022,W
From Slave=$COMPDEGS,023,W
From Slave=$COMPDEGS,024,W
From Slave=$COMPDEGS,025,W
From Slave=$COMPDEGS,026,W
From Slave=$COMPDEGS,027,W
From Slave=$COMPDEGS,028,W
From Slave=$COMPDEGS,029,W
[00][00]
'___________________________________________________
C
 
Top