Forum Index
Internal Error with unused Public Const

 
Author Message
spamiam



Joined: 13 Nov 2005

Posted: 09 August 2008, 1:32 AM    Post subject: Internal Error with unused Public Const

I have the following program that gives the following errors:

Code:
Stepper.bas:20: Internal Error: attempt to use address of "Delay_Timer" before assignment
Stepper.bas:60: Internal Error: attempt to use address of "Counter" before assignment



The code is as follows

Code:
Option Explicit
Option TargetCPU ZX24ae
Option Base 0



'Public Const LCDOutputPin   as Byte = 5
'Public Const LCDInputPin   as Byte   = 0
'Public Const LCDPort      as Byte   = 3


Public Const StepperA      as Byte   = 28 'PB0
Public Const StepperA_Bar   as Byte   = 27 'PB1
Public Const StepperB      as Byte   = 26 'PB2
Public Const StepperB_Bar   as Byte   = 25 'PB3
Public Const Clear_Pins      as Byte = &b0000_1111

Public Half_Steps(8) as Byte

Public   Delay_Timer as Integer = 220   'ticks

' FDK Stepper:
' A = Blue
' A_Bar = Yellow
' B = Red
' B_Bar = White




Sub Main()

'initialize variables

Half_Steps(0) = &B1010_0000
Half_Steps(1) = &B1000_0000
Half_Steps(2) = &B1001_0000
Half_Steps(3) = &B0001_0000
Half_Steps(4) = &B0101_0000
Half_Steps(5) = &B0100_0000
Half_Steps(6) = &B0110_0000
Half_Steps(7) = &B0010_0000

' initialize I/O pins
Call PutPin (B.0, zxOutputLow)
Call PutPin (B.1, zxOutputLow)
Call PutPin (B.2, zxOutputLow)
Call PutPin (B.3, zxOutputLow)


'test loop
do
   call PutPin(28, zxOutPutHigh)
   Call Sleep(255)
   Call PutPin(28, zxOutPutLow)
   Call Sleep(255)
loop


Dim Counter as Byte = 0

Do
   'Clear the pins
   Register.PortB = Register.PortB AND Clear_Pins
   
   'Set the pins to the new state
   Register.PortB = Register.PortB OR Half_Steps(Counter)
   
   'increment the state
   Counter = Counter +1
   if (Counter = 8) then
      counter = 0
   end if
   
   'delay for a moment
   Call Sleep(Delay_Timer)
   Delay_Timer = Delay_Timer -10
   if (Delay_Timer <=20) then
      Delay_timer = 220
   End If
   
Loop

End Sub



I would have thought I would get a warning about an unused variable, but not an internal error.

-Tony
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Location: Portland, OR

Posted: 09 August 2008, 3:17 AM    Post subject: Re: Internal Error with unused Public Const

spamiam wrote:
I would have thought I would get a warning about an unused variable, but not an internal error.
This problem was discovered since the last "official" release. The recently posted experimental version v2.5.7 of the compiler has the error corrected.
Back to top
spamiam



Joined: 13 Nov 2005

Posted: 09 August 2008, 4:19 AM    Post subject: Re: Internal Error with unused Public Const

dkinzer wrote:
This problem was discovered since the last "official" release. The recently posted experimental version v2.5.7 of the compiler has the error corrected.


AH, Sorry for that. I had see that thread, but I did not realize that this problem was the same. I will try the experimental release.

-Tony
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Location: Portland, OR

Posted: 09 August 2008, 4:52 AM    Post subject: Re: Internal Error with unused Public Const

spamiam wrote:
I had see that thread, but I did not realize that this problem was the same.
Actually, the problem isn't the same as the one for which the experimental version was recommended. It's just that your particular problem had also been fixed.
Back to top
Display posts from previous:   
Page 1 of 1

 



ZBasic Microcontrollers Home
All content Copyright © 2005, 2006, 2007, 2008 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group