Misc Errors

basically miscellaneous, if it doesn't fit another sub-forum enter it here, we might even promote it to its own sub-forum
Post Reply
kochevnik
Posts: 24
Joined: Sat Jun 15, 2013 3:27 pm

Misc Errors

Post by kochevnik »

Basicchip : Not sure where I should put this, or even if you want a list of such info - but there are a number of errors in the docs or on the website that I thought you might want to know about - maybe this could all be put in a single thread somewhere else ?

Here's a few you might want to be aware of
1) On the main webpage there is a section for students etc and one for engineers etc - in both sections the featured board was the PRO Start Board - but the second section says the speed is "3 to 6 times faster" - I think you meant to put the 100 Mhz Pro-Plus Board there.

2) In the specs for the basic chip ( http://www.coridium.us/prod-specs1.html) - it lists that it is .06 inches wide. Quite an accomplishment :mrgreen: Should be 0.6 inches. Might want to mention that a standard DIP28 socket will not fit this chip - ask me how I found out. I'm not even sure what the name for the socket that would fit this chip is called - when I track it down I'll add it here.

3) In the example in the docs for the STR function is this code

Code: Select all

DIM bstring (10) AS STRING
a = 8421
b = STR(a)
PRINT a, b     ' will display    8421     8421
Doesnt work.

Should be

Code: Select all

DIM bstring (10) AS STRING
a = 8421
bstring = STR(a)
PRINT a, bstring 
I'll add more helpful stuff as I find them :D



kochevnik
Posts: 24
Joined: Sat Jun 15, 2013 3:27 pm

Re: Misc Errors

Post by kochevnik »

Not sure if this is a bug or not as the STR help screen does not explicitly say whether or not it handles singles, but this code works - sort of "

Code: Select all

DIM bstring(100) AS STRING
PRINT "START"
PRINT STR(12.2222)
//bstring = STR(12.2222)
PRINT "END"
It prints
START
12
END

Uncomment the bstring = STR(12.2222) line and when you go to run the file, the compiler says 'Executing ...' and stops working. Then you pretty much have to close the development environment (which doesnt always work on my computer - sometimes need to reboot) and then restart it.

---------------------

This code under the Dim help page needs to have the 'STTRING' typo fixed :

Code: Select all

DIM a$ (10)
DIM b (20)  AS STTRING
DIM c (30)  AS BYTE  ' while this compiles it should be used for larger >256


a$  = "Hello World"
b  = "... from ARMbasic!"
c = a$ + b

print c                   ' displays Hello World... from ARMbasic 

kochevnik
Posts: 24
Joined: Sat Jun 15, 2013 3:27 pm

Re: Misc Errors

Post by kochevnik »

BTW - the chip is GREAT !

- dont want to make it seem with all these error posts that I dont like it - I love it :mrgreen:

Works like a charm. When I got it I had no problems wiring it up or getting it to program right off the bat.
In the process of various testing I've put lots of wrong voltages to wrong pins - over volted a bunch of stuff and it just
keeps plugging along. The basic language covers a lot of ground - always things to be fixed of course, bugs never completely
gone from any code, but it's solid, does what it needs to and much faster than say the Picaxe chips I was using - the ADC reads
which I got this chip specifically for gives me a 100x performance increase over the picaxe for just $7 more dough. Love it.

kochevnik
Posts: 24
Joined: Sat Jun 15, 2013 3:27 pm

Re: Misc Errors

Post by kochevnik »

Aaaaand one more.

None of the first two values for s_in give a correct answer (the fourth one 123.5 does)

I thought this had to do with the IEEE spec for float math when I found it - that was with 1234.5678 math but even the smaller numbers 123.56 do it.

Code: Select all

print "START"


dim s_in as single

dim s_round as single

dim s_calc as single


	s_in = 123.567
	//s_in = 123.56
	//s_in = 123.5
	
	s_round = 123.000
	
	s_calc = s_in - s_round
	
	print "s_calc = " ; s_calc
	
	print
	print "END"

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Misc Errors

Post by basicchip »

This is as good a place as any.

Fixed the 0.6" dimensions, I know I caught that somewhere else but missed these. I'm not sure why you think it doesn't fit a standard 0.6" wide DIP28 socket. As that is what we use on the BASICboard.

STR was written for integers, not sure why it might hang, but we'll look into that. I've updated the help to indicate that. SPRINTF would be the way to convert singles to strings.

Yes the wording on the main page is awkward, and really we ourselves use the BASICchip for some custom industrial products. I'll cop out and say that was originally written by an outside consultant.

Single uses 32 bit floating point, and while 123.5 is represented exactly as it is a multiple of 0.5 and this is a binary fraction. 123.567 is not represented exactly so when you subtract the 2 that difference is magnified. Here is what I see, and really it is what I would expect.

Code: Select all

dim a,x as single
a=123.5
x=123.567
print a,x,x-a
run
Programming Flash 1756...
ARMbasic[8.26a] on the PC  Copyright 2013, Coridium Corp.
*+
... ( 0.07K code + 0.00K string)/96K   0.01/9K data programmed
Executing...

123.5000	123.5670	6.700134E-02
When using single you have about 7 decimal digits of resolution. When you do = compares with singles you won't always get exact results, and it is better to use less than or greater than.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Misc Errors

Post by basicchip »

Help file fixes are updated on the web version. They will get into a CHM version later this week, as an updated compiler is being tested now, along with some changes to BASICtools to manage libraries and examples better. PDF updates will be after that.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Misc Errors

Post by basicchip »

As for STR(single_value), what I see is a FAULT_ISR.

Which I guess is not surprising as STR(expr) was written for integers. As for recovering from it, it seems pretty normal to me, the BASICtools report the fault and the program dies, returning control to the console. What version of BASICtools are you using and compiler? And what device are you using?

OK (this is an update after digging into it a bit)
As it turns out the implied expression to string function works for SINGLE, this was being handled in the code-emitter portion of the compiler that also keeps track of whether the operations are floating point or integer.
But the specified version of STR(single-value) was doing the conversion in both the parser and the code-emitter, which caused a overflow, somewhere in the floating point library

So this will get fixed in version 8.26b of the compiler, attached here if you want a preview.
Attachments
ARMbasic.exe
fix for STR(single-type)
(123.18 KiB) Downloaded 741 times

kochevnik
Posts: 24
Joined: Sat Jun 15, 2013 3:27 pm

Re: Misc Errors

Post by kochevnik »

Thx - for looking into all this - didnt mean to cause you extra work :)

When I order DIP28's I just assumed they were all a fixed size - the ones I ordered were quite a bit narrower than 0.6 inches so I guess I just meant that if you order DIP28's from someone be aware that there is more than one width as I was not aware of that. And the explanation of singles math is what I expected after reading the IEEE spec - but I was hoping that it worked differently. And I'll check the web help next time first if I see any typos.

Thx for the STR(single) fix - I will try that out tonight. When I was testing I got no errors in the console - it would just say 'Executing ...' and then hang - it would not even print out the 'START' that I usually place at the beginning of my programs (I was using the BasicChip and v8.23). Above you said "the BASICtools report the fault " - is there some other place I should be look for error codes / return codes / fault messages ?

I'm a little curious - if STR(single) didnt work, how were people converting singles to strings - as I'd think you would need to do that to send them out the serial port.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Misc Errors

Post by basicchip »

We pretty much drop everything for bug fixes, so while we may grumble a bit, we WANT this kind of feedback.

Explicit STR was what failed, implied STR worked. Now they both do the same thing.

Code: Select all

DIM A(20) as STRING
DIM B(20) as STRING

A = 123.456789             ' implied STR this worked
B = STR(123.456789)     ' explicit STR which was failing

PRINT A
PRINT B

A = SPRINTF("%9.3f",123.456789)    ' lets you control the format better
This is what I saw on a SuperPRO

Code: Select all

run
Programming Flash 1751...
ARMbasic[8.26a] on the PC  Copyright 2013, Coridium Corp.
*+
... ( 0.07K code + 0.00K string)/20K   0.03/5K data programmed
Executing...


FaultISR 0xFFFFFFF9 SCB->CFSR=0x00008200
I did dig up a BASICchip and repeated the same thing. I didn't get the FaultISR, and it looked hung, but the STOP button worked for me

When you use STR on singles you will get "G" type formatting (as in printf for C and PRINT in BASIC), if you use SPRINTF you get more control

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Misc Errors

Post by basicchip »

I grabbed a few other versions, and it looks like STR(single-expression) may work in some firmware versions, but not others.

If that is the case, then SPRINTF is the way to do single to string conversions.

Post Reply