Page 1 of 1

Internal error

Posted: 06 September 2006, 12:42 PM
by bodir
I'm getting this Internal error.

>"C:\Program Files\ZBasic\zbasic.exe" --directory="C:\Program Files\ZBasic\MyZBasic\I2C-1/" --project="I2C_1.pjt"
Internal error: variable.cpp(1677), Rev 674: invalid type for increment, "ds1307_4.bas" line 104
>Exit code: 1


Here's the code that produces it.

'=======================================================================================
Sub Scheduler()
Dim count_1 As Single 'This is line 104
Dim count_2 As Single
Dim Second As Single

Second = 50.0

Do
count_1 = count_1 + 1.0
count_2 = count_2 + 1.0


if (count_1 = Second) then
Call Print()
count_1 = 0.0
End If

if (count_2 = Second * 5.0) Then
count_2 = 0.0
End If


Call Sleep(0.02) 'in this task 50 times a second.

Loop


End Sub
'=======================================================================================

Posted: 06 September 2006, 17:29 PM
by dkinzer
Thanks for letting us know. We have located the source of the problem and fixed it internally. In the mean time, you can work around the problem like this:

Code: Select all

Dim float1 as Single

Sub Main()
  float1 = 1.0
End Sub

Sub Scheduler() 
  Dim count_1 As Single
  ...
  Do 
    count_1 = count_1 + float1
    ....
  Loop
End Sub
This works because the compiler doesn't know the value of float1 where it is added to count_1. This workaround is not effective, however, within Main() since the compiler knows the value of float1 and will attempt to generate the increment code (which it shouldn't do).

We should be able to get a corrected version posted fairly quickly.

Posted: 07 September 2006, 21:21 PM
by dkinzer
An updated compiler has been posted on the Downloads Page that resolves this problem.