jay wrote:Didn't see anything in the forum or in the docs .. appreciate a pointer to what I might have missed.
The test program should work as you've described the situation. It is possible that there was a failure after the manufacturing test the verifies the RAM circuitry or it could have been a failure of the testing process itself.
The program below is the one that we use to build the two versions of the test code. As written, it produces the final test program. Change the "Option ExtRamConfig" to On for the RAM-enabled version.
If it still is not working, the best course is to send out another one and get that one back so that we can examine it.
Code: Select all
#if Option.ExtRamAble
Option ExtRamConfig Off
#endif
Private msg as StringVectorData({ " says...", " Hello, world" })
Private device as String
Private Const cmdChar as Byte = &H04
#if Option.TargetCode = "Native"
Private Const stackSize as Integer = 200
#else
Private Const stackSize as Integer = 50
#endif
Private taskStack(1 to stackSize) as Byte
Sub Main()
Dim j as Integer
#if Option.ExtRamAble
Debug.Print "RAM Size is "; Register.RamSize; " bytes"
#endif
' launch the ATN detection task
CallTask cmdTask, taskStack
' get the device identification string
device = getDeviceID()
' loop forever displaying the hello world message
j = 1
Do
Call Hello(j)
Loop
End Sub
'
'' Hello
'
' This subroutine displays one of two strings depending on the
' passed index (of which only the least significant bit is used).
'
Private Sub Hello(ByRef idx as Integer)
' advance the string index and limit its value
idx = (idx + 1) And 1
' display the indexed string, for string 0, add the device identifier prefix
If (idx = 0) Then
Debug.Print device;
End if
Debug.Print msg(idx + 1)
#if defined(Pin.RedLED) And defined(Pin.GreenLED)
' for devices with LEDs, flash the red and green LEDs for a half second each
Call PutPin(Pin.RedLED, zxOutputLow)
Call Delay(0.5)
Call PutPin(Pin.RedLED, zxOutputHigh)
Call PutPin(Pin.GreenLED, zxOutputLow)
Call Delay(0.5)
Call PutPin(Pin.GreenLED, zxOutputHigh)
#else
' for devices without LEDs, simply delay for a second
Call Delay(1.0)
#endif
End Sub
'
'' getDeviceID
'
' Retrieve the device identifer and return it as a string.
'
Private Function getDeviceID() as String
Dim idLen as Integer
Dim i as Integer
Dim id(1 to 10) as Byte
' note that the 'id' array will be null terminated
Call System.DeviceID(id)
' determine the length of the identification string
idLen = 0
For i = 1 to UBound(id)
If (id(i) = 0) Then
Exit For
End If
idLen = idLen + 1
Next i
' create a string containing the identification string
getDeviceID = MakeString(id.DataAddress, idLen)
End Function
'
'' cmdTask
'
' The sole purpose of this task is to check the input queue for the ATN
' character and, when found, invoke the ZX command mode.
'
Sub cmdTask()
Do
If (StatusQueue(CByteArray(Register.RxQueue))) Then
Dim c as Byte
Call GetQueue(CByteArray(Register.RxQueue), c, 1)
If (c = cmdChar) Then
Call ZXCmdMode(False)
End If
End If
Call Sleep(0)
Loop
End Sub