Remote control by location (PIC in Oshonsoft)

sagor

Joined Mar 10, 2019
903
I would try the second example of my code, to see if that helps the midstr problem. He may have fixed the bug I reported, but maybe with multiple MIDSTR concatenation, there may still be an issue.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
As a note, I've seen a bug in Oshonsoft when concatenating strings.
I submitted it as a bug, but never heard back.
Example:
Code:
j = "A" + Chr(13) + Chr(10)
'Above messes up, puts in double A and chr(10)
but this works:

Code:
j = "A"
j = j + Chr(13)
j = j + Chr(10)
'Above concatenation works ok
Try adding each string characters separately to the destination variable.

EDIT: I just tried that bug with latest version of Oshonsoft, and the bug seems to be fixed. So, this may be a false alarm...
Hi S,
I tried your second example, but failed.
Here is a screen shot of the 3xdigits I need, and my CODE.
I tried both CHR(8) and STR1(8).
C.
 

Attachments

sagor

Joined Mar 10, 2019
903
Code is not consistent. You use STR1(8) and then char(9) which is a totally different character. CHR(x) does not read your STR1 string at all.
It should read strqeideg = strqeideg + STR1(8)
strqeideg = strqeideg + STR1(9)
strqeideg = strqeideg + STR1(10)
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Code is not consistent. You use STR1(8) and then char(9) which is a totally different character. CHR(x) does not read your STR1 string at all.
It should read strqeideg = strqeideg + STR1(8)
strqeideg = strqeideg + STR1(9)
strqeideg = strqeideg + STR1(10)
Hi S,
To clarify, I tried both CODEs.
C
------------------------------------------------
strqeideg = strqeideg + STR1(8)
strqeideg = strqeideg + STR1(9)
strqeideg = strqeideg + STR1(10)
------------------------------------------------
and
--------------------------------------------------
strqeideg = strqeideg + chr(8)
strqeideg = strqeideg + chr(9)
strqeideg = strqeideg + chr(10)
 

sagor

Joined Mar 10, 2019
903
Chr(8) is a backspace, you cannot see that as a printable character. Chr(9) is a TAB character. Chr(10) is a Line Feed (LF)
You are not using CHR function to create any printable characters. Review the manual to see what the functions actually do....
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Chr(8) is a backspace, you cannot see that as a printable character. Chr(9) is a TAB character. Chr(10) is a Line Feed (LF)
You are not using CHR function to create any printable characters. Review the manual to see what the functions actually do....
Hi S,
Ok, I've obviously completely missunderstood, I'll put a reminder for me to come back to this later.
Thanks, C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
hi C,
A short demo of MidStr.
E
Hi E,
I'm pretty sure I've been doing the MIDSTR correctly, as I've had so many examples.

I think me and the program got mixed up, by the 3x DATA inputs. They all need to have a '$' sign at the front for conformity, as the MAIN program looks for a '$' to READ and SWITCH each DATA as it's needed. I'll now check if I've made a variable with a '$' or not. Programming each of the 2x DATA PICs is just a little tricky, at the moment till I get used to it.
C
 

ericgibbs

Joined Jan 29, 2010
18,767
hi C,
If you have three msg sources, you could use three different ID characters.
eg: $ , # or &, one for each msg type.
This would then direct the msg to the appropriate sub routine.
E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
hi C,
If you have three msg sources, you could use three different ID characters.
eg: $ , # or &, one for each msg type.
This would then direct the msg to the appropriate sub routine.
E
Hi E,
I'm used to this section of CODE in the MAIN program:
---------------------------------------------------------------------------------------
If PIR1.RCIF = 1 Then
nxt_rxin:
'Add timed wait and DATASWITCH here, needs thought!!!!!!!!!!!!!!
If PIR1.RCIF = 0 Then Goto nxt_rxin
Hserin char
If char = "?" Or char = 0x0a Then Goto msg_eol
If char = "$" Then
str1(0) = "$" 'CHAR = $
rxi = 0
Endif
If str1(0) = "$" Then
str1(rxi) = char
rxi = rxi + 1
Goto nxt_rxin
If rxi > 79 Then
Hserout " OVER STR1 LIMIT", CrLf 'Over STR1() limit
rxi = 0
Endif
Endif
Goto nxt_rxin
Endif
-----------------------------------------------------------------------------------
I'm reluctant to change it.
I think I just need to check the sentences I'm sending from the REMOTE and the INCREMENTAL ENCODE PICs all match the GPS $ STRING, and I have to be clear what I'm doing, so perhaps not today.
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Hi,
I forgot to add the '$' to the front of the message sent by the REMOTE (Just a false message for testing), but once added, and a few corrections, the DATA SWITCH and '$' messages in/out, started working :)

I left the [ LEFTSTR ] instead of the recommended [ MIDSTR ] for now as it's working, but I'll try [ MIDSTR ] again later.

The Incremental endoder from the BASE 4431 isn't correct, but the number change as the dial is turned, so a few adjustments needed there.

Here is a SCREEN SHOT The sentences with '$' are RX and the no '$' are TX. It shows the output of the MAIN 18LF4620 PIC, which has RECEIVED DATA from 3x different sources, then processed it and SENT it out again.

Now to add peripherals (compass etc).
C.
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Hi,
I've got MIDSTR to work :)
I must have tried every combination, until I found that the $sentence must have [,] Once I added them into the sentence [ $QEIDEG,123,? ] the MIDSTR started working. I had [ , ] before, so there must have also been other errors.
Here's a pair of terminal views:
1/ The input to the 18LF4620 RX
2/ The output of the 18LF4620 TX
EDITED
C
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Hi,
I added the remaining peripherals and today after years of Data sheets, forums and headache pills, All of the peripherals are working.
BASE, GPS UBLOX: MN8
BASE, ALTIMETER:BMP280
BASE COMPASS: AK8963C
BASE, INCREMENTAL ENCODER
RX message from REMOTE (Second PCB) Via HC-12 radio

The programs need lots of timing and tests to improve them.
Once working ok, then they will need to be programmed to actually control the REMOTE.

Thanks, very much for the support so far, I hope it carries on :)
EDIT: Since posting I remembered that I had forgotten the joystick inputs, they have now been adding ok.
C.
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Hi,
You will notice that there are 'RX ERRORS', going off the top of the image of #694. This was mainly due to the GPS sendoing many NMEA $Sentences.
I've been playing with the GPS settings, and managed to switch all but the required $Sentence, also switching the output to 5x/second. When the DATASWITCH arrives at the GPS, there is no hold up now.
NOTE: I also added the forgotten Transmitter joysticks to the peripherals. Here:
C
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Hi,
I'm redesigning the PCBs, so the REMOTE, which doesn't use the 18F4431, can be cut off, making a smaller PCB.

I checked the RAM use so far on the 1030 lines of BASIC, and it looks as if there is approx 20% left to play with. So far all of the peripherals are working, and the next job is to program the actual REMOTE control. Does this look as though I'll have enough room? (I know it's a vague question, but any guesses are welcome)
C
 

Attachments

ericgibbs

Joined Jan 29, 2010
18,767
hi,
Base on that image you are using a ratio of system versus user RAM, it shows 670 Bytes free.
So based on 10:1 you will have about 600 Bytes of user RAM available.
That's about 300 Words, it will be very tight.
Have you estimated the size of Remote Code.??
E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
hi,
Base on that image you are using a ratio of system versus user RAM, it shows 670 Bytes free.
So based on 10:1 you will have about 600 Bytes of user RAM available.
That's about 300 Words, it will be very tight.
Have you estimated the size of Remote Code.??
E
Hi E,
BASE: 300 words, seems quite a lot, but I suppose I'll run out as you suggest.
REMOTE: I haven't estimated the CODE.

I'll make a start and see what happens as usual :)

If I get stuck, I may be able to share some of the CODE with the 18F4431, but I'll think more about that later.

I'll carry on making new PCBS.

Thanks, C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Hi,
I've been modifying the PCB for quite a while now, and it looked a bit tangled, so I've redesigned it.

Here is the schematic and the PCB. It would be good if someone could proof look, in case of errors, please.

C.
 

Attachments

Top