• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Oshonsoft overload?

camerart

Active Member
Thread starter #1
Hi,

I'm modifying a program, but Oshonsoft shuts down if I try to compile it.

Will someone run the program through their Oshonsoft SIM please, in case it's at my end. I may have overloaded the SIM, as I've needed to comment out some of the program to fit?
Cheers, Camerart
 

Attachments

camerart

Active Member
Thread starter #3
Out of string space error.
Hi S,
Thanks, I had to comment out 2x STRINGS to get it to work up to now, :(
If I look for another more suitable PIC, what do I need to look out for regarding STRING space?
C.
EDIT: Looking at the following posts, this may not be necessary.
 
Last edited:

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#4
When you use a high level language it's too easy to run out of resources.

In C we can point to a string, so as you do not work on any more than 1 string at a time, we reuse the resource..

so fill the string -> send it
fill it with something else -> send it
etc...

One string used.... Structuring of a program can be an art form!! When I get home, I'll re-write your code to use at least 50% less resources..
 

camerart

Active Member
Thread starter #5
When you use a high level language it's too easy to run out of resources.

In C we can point to a string, so as you do not work on any more than 1 string at a time, we reuse the resource..

so fill the string -> send it
fill it with something else -> send it
etc...

One string used.... Structuring of a program can be an art form!! When I get home, I'll re-write your code to use at least 50% less resources..
Hi I,
Your offer of a re-write of my CODE, is very welcome, but I am dealing with information from different forums, plus there is extra program which I will add once I get something working regarding SERVOs.

Please hold off on a re-write for the moment, till I've sorted out the spaghetti a bit more.
Thanks very much,
C.
 

camerart

Active Member
Thread starter #6
Hi,
It's dawned on me that I shouldn't use so many STRINGS, and convert the incoming STRING to INTEGERS for the calculation, there should be enough room then.
C.
 
#8
Each string variable reserves 8 to 100 bytes from RAM.
Default is 16 bytes and can be changed with define string_max_length.
 
#9
Hi,
It's dawned on me that I shouldn't use so many STRINGS, and convert the incoming STRING to INTEGERS for the calculation, there should be enough room then.
C.
The problem is that declaring string length = 40 means every string is defined as 40 characters, whether you use that many or not. If most of your strings are shorter, like 10 or 20 characters, define the stringlength = 20 instead, and use two strings to make up a 40 string "send" as required (send two 20 character strings instead of one 40). That way, all other strings will be 20 characters long. That saves space....

Other option is to use byte arrays, and insert ascii characters into them. That way, you can make each array the exact length as required. A bit more work, but it should work just as well as strings. I use byte arrays to send data on a software UART, works ok as long as you know what is in the bytes....
 

camerart

Active Member
Thread starter #10
Hi,
Thanks to all,
This SERVO section will be added to other sections to make a larger program.

One of the STRINGs (which is the longest) is approx 70 characters, and there is a shorter STRING of approx 35 ish length. I am just forming the idea that perhaps I only may need these two STRINGs or perhaps three, which when converted to INTEGERS will be used for calculations and should fit on the PIC.

A note on STRING length: Because of signal strength the STRING length can vary a little.
C.
 

camerart

Active Member
Thread starter #11
Hi,
I tried and failed to convert a STRING to an INTEGER
Is there a way to do this?
e,g, STRTIM0H ="1100" In now need TIM0H (INTEGER) = STRTIM0H
(I'm sure it was done for me a long time ago, which I'll search for)
C.
 

Latest threads

EE World Online Articles

Loading

 
Top