Continue to Site

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.

  • 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.

Advice

Status
Not open for further replies.

Mosaic

Well-Known Member
Can anyone explain the SIGN command to me, I can't find it in the Oshonsoft ref manual.

Also, can I assign a string variable?
Like:

Dim word as string
word = "Hello world"


???
 
Can anyone explain the SIGN command
When you find the answer I would be interested as well - never heard of this in Oshonsoft (perhaps you're confusing this with another compiler?).

Also, can I assign a string variable?
Not sure you can do this directly; but perhaps some details about what you're attempting. I've seen the LookUp function used for parsing strings.
 
Hi Mosaic,

I too have tried to find how SIGN is used but with no luck. It seems to be in the reserved word table but not used. Oshonsoft BASIC does not have any string handling capability as far as I know. You have to do all that sort of stuff manually. What a pain! Still at the price of this package......

Best regards,

Mellbreak
 
Can anyone explain the SIGN command to me, I can't find it in the Oshonsoft ref manual.

Also, can I assign a string variable?
Like:

Dim word as string
word = "Hello world"


???

hi mosiac,
The SIGN command does not exist in Oshonsoft Basic, its not a RESERVED word.

You can test this by doing this.
Dim sign as Byte

Also there is no STRING variable
 
In Turbo Basic the function SIGN (x) returned -1, 0 or 1 whether x was negative, zero or positive.
 
ok. I am beginning to have doubts about Oshonsoft for my app.
First it was the incompatible LCD thing which cost me a day. Then it can't do strings (first BASIC I met like that) and now I am getting Stack overflows.

Stack overflows are something I had to handle when doing asm. But this is a bit much. How can a compiler produce freaking stack overflows?

Anyhow just to be complete, the stack overflows are happening due to calling an adc sample in the interrupt routine. It is happening inside of the asm handling the adc in. But since the asm is convoluted Oshonsoft asm , precisely tracking down the offending missing 'return' which eventually causes an cumulative overflow is not on.

Solution: Forget the Oshon adcin cmd and do an embedded asm routine and then a variable.LB=ADRESL,& variable.HB=ADRESH. Clearly there are advantages in knowing asm before using these compilers.
 
Last edited:
hi Mosiac,

I am not overjoyed by some of the short comings of Oshonsoft Basic, but no where in the documentation does it claim to have 'SIGN' or 'STRING' functions.

Regarding Stack overflows, as you may know the Stack on a 16Fxxx is only 8 deep.

You are calling other routines from within your ISR, also you are not using RW on the LCD control, so the program has to use delay subroutines for LCD operations which involves more Stack usage for these delays.

I am not surprised you are getting Stack overflows.

E.
 
I figured that the compiler would know about the 8 level stack and handle it. Isn' t a compiler supposed to insulate the user from such HW level details?

@ian GC is an option. I am using BASIC for the LCD I/O and some 32 bit math and menu structures. Does GC do 32 bit?
 
Last edited:
Features
Simple, useful language:
Standard BASIC flow control statements - If, Select Case, Do, For, Goto
Support for multiply, divide, add, subtract, boolean operations and comparisons.
Bit, Byte, Word and String data types, in addition to byte arrays.
Subroutines and Functions
Inline assembly, in most cases without any special directives
Data tables
Portable, reusable code:
Supports most 8-bit PIC and AVR microcontrollers
Write code for a TinyAVR, easily adapt it for an 18F!
Automatically recalculates all delay commands depending on the clock speed of the chip
I/O capabilities:
Standard 2x16 LCD routines
Routines for on-chip A/D, PWM, SPI, USART, EEPROM and Timers
RS232 communications - rates between 300 and 19200 bps with user configurable parity, start and stop bits.
PS/2 keyboard reading
4x4 Keypad

Other features:
Extensive help file and forum
Several translations
Generates standard MPASM compatible assembly code for PIC, or avrasm2 compatible code for AVR.
Free, both in the free beer way and the free speech way!

No.... Do you need 32 bit? I usually download the math library ( in assembler ) Then create macros I can call externally... I havent tried it with great cow though!! I program in C so I'm alright in that department..

Take the plunge and learn C.... The syntax is extremely similar to basic as embedded basic is soooo low level anyway...
 
I guess C is the next requirement. I learnt assembly & BASIC on a C-64. I'm ok in asm and BASIC, a smattering of Pascal and Fortran. I just need to make time to do a project in C to get the hang of it.
 
@Mosaic
GCBasic has integer, or negative number support from -32768 to 32767. The LCD module supports integers too. There was a recent announcement of preliminary support for longs, so bound to be a few bugs, haven't tried them yet. String variables have been around for a long time.

@IanRodgers
GCBasic plays well with assembler. Was going to port a Cosine assembler routine once, but took the easy way out and just used table values for conversion instead.
 
GCBasic plays well with assembler. Was going to port a Cosine assembler routine once, but took the easy way out and just used table values for conversion instead.


I have a really good cosine / sine / tan routine / s uses a 30 value lookup table in fixed point maths.... I have ported it to Oshonsoft basic.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top