ZX-1281 Demo Software

Discussion specific to the ZX-1281 and ZX-1280 microcontrollers as well as the ZX-1281 and ZX-1280 Dev Boards.
Post Reply
ktomecek
Posts: 4
Joined: 21 May 2007, 8:33 AM

ZX-1281 Demo Software

Post by ktomecek »

Hello folks. I just got my ZX-1281. It looks great! I only wish there was a demo I could run on it to confirm it is alive and well (make the Led's flash, or something). The IDE sees it and properly identifies it. But I would like some confirmation. Any ideas?

Thanks,
Karl Tomecek
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

The ZX-1281 Development board doesn't have any LEDs to flash but you can write a program that does some simple things. For example, if you have an oscilloscope or logic analyzer you could create a simple program that toggles an I/O pin. The code below will toggle bit 0 of Port F, for example. You could connect an LED/resistor combination between +5 and pin to get a visual effect but you'll need to put a Delay() call in the loop. This will be easier if you have a solderless breadboard and you've installed the SIP sockets in the dev board.

Code: Select all

Const pin as Byte = F.0
Sub Main()
    Dim state as Byte
    state = 0
    Do
        Call PutPin(pin, state)
        state = state Xor 1
    Loop
End Sub
The program below is similar to that which is installed on the ZX-1281 prior to it being shipped. If you uncomment the external RAM configuration option you'll see that it reports a larger RAM size (assuming that the "disable" jumper is not in place).

Code: Select all

'Option ExtRamConfig On

Dim b as Byte
Dim id(1 to 10) as Byte
Dim idStr as String

Sub Main()
    Dim j as Integer
    Call System.DeviceID(id)
    For j = 1 to UBound(id)
        If (id(j) = 0) Then
            j = j - 1
            Exit For
        End if
    Next j
    If (j >= UBound(id)) Then
        j = 6
    End If
    idStr = MakeString(id.DataAddress, j)
    j = 0
    Debug.Print "RAM Size = "; CStr(Register.RamSize)
    Do
        Call Hello(j)
        j = (j + 1) And 1
    Loop
End Sub

Sub Hello(ByVal idx as Integer)
    If (idx = 0) Then
        Debug.Print idStr; " says..."
    Else
        Debug.Print "    Hello, world"
    End If
    Call Delay(1.0)
End Sub
- Don Kinzer
ktomecek
Posts: 4
Joined: 21 May 2007, 8:33 AM

Post by ktomecek »

Don,
That was perfect! Just what the doctor ordered. Explained a lot (without you realizing it!).

Thanks for the kickstart....

Regards,
Karl
joelmock
Posts: 3
Joined: 23 May 2007, 11:11 AM

ZX-1281 Demo Code

Post by joelmock »

When I attempt to run the sample code listed:
Const pin as Byte = F.0
Sub Main()
Dim state as Byte
state = 0
Do
Call PutPin(pin, state)
state = state Xor 1
Loop
End Sub

I get the following error:
myproj.bas:1: Error: reference to undefined identifier "F.0"
1 error.
Any ideas?
ktomecek
Posts: 4
Joined: 21 May 2007, 8:33 AM

Post by ktomecek »

Joel,
I am certainly no expert on this, but the reason is you have to click on Options, then Device Options and make sure the target device is set to ZX-1281.

Regards,
Karl
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: ZX-1281 Demo Code

Post by dkinzer »

joelmock wrote:I get the following error:

Code: Select all

myproj.bas:1: Error: reference to undefined identifier "F.0"
Any ideas?
Most likely, this is because the wrong ZX device is selected as the target. The default target device is the ZX-24. It has no port F so the reference F.0 is invalid.

If you are using the IDE, you select the target device using the dialog reached by selecting "Device Options..." from the Options menu. I suspect that if you select ZX-1281 as the target device the error no longer occur.
- Don Kinzer
Post Reply