TTL programming cable

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

TTL programming cable

Post by FFMan »

I bought one of these

http://www.coolcomponents.co.uk/catalog ... cts_id=356

thinking it would be useful for programming devices in the field at TTL level such as my 328 projects, but I see from the pinouts there is no DTR, so is this going to work ?

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

Re: TTL programming cable

Post by dkinzer »

FFMan wrote:I see from the pinouts there is no DTR, so is this going to work ?
Since there is no DTR signal, it will not work for the "normal" downloading mode. It will, however, work with the DTR-less downloading method that uses a special "ATN character" to get the ZX into command mode.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

ok - i see the option on the menu to use character 4 (by default), is it just a matter of ticking this or are there other changes to make ?

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

Post by dkinzer »

FFMan wrote:[A]re there other changes to make ?
Yes. The ZX needs to be configured to recognize the same "ATN character" that is designated in the IDE. An upcoming release of the compiler supports a new, simpler way to set the ATN character in the ZX. For compiler versions prior to v3.0.3, however, you have to do it the "hard way" as illustrated in the example code below.

Code: Select all

Dim atnChar as Persistent Byte Based &H13

Sub Main()
  atnChar = &H04
  ' other program code here
End Sub
The factory-installed sample program contains some special code that looks for an incoming byte with the value &H04 and if it is received, the ZX command mode is invoked. If you've already downloaded a program to the device, overwriting the factory-installed sample program, you'll have to download the program containing the ATN Char setting by the normal means once. Thereafter, you can use the ATN Char method to download.

Note, also, that Persistent Memory address &H13 will retain the value you've set it to even if you comment out the assignment line shown above and download the compiled program again. This means that to disable the ATN Char method you must download a program that explicitly sets Persistent Memory location &H13 to a value greater than 31 (&H1f), preferably &Hff.

It is important to be aware that when the ATN Char is set to a value in the range &H00 to &H1f, the ZX will respond to receipt of that byte value on Com1 by going to ZX command mode even if it wasn't the IDE/downloader that sent it. This means that you must choose the ATN character carefully in order to avoid values that might be sent by some external device connected to Com1.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

ok - i see.

If i enable ATN chr mode does the 'normal' method still function i.e. is this method available in addition ?
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

FFMan wrote:If i enable ATN chr mode does the 'normal' method still function i.e. is this method available in addition ?
Yes. The DTR/ATN method is always enabled. The ATN Character method is just added to that when the Persistent Memory location is set to a value in the range &H00 to &H1f.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

TTL programming cable

Post by GTBecker »

> ... ATN Character [] Persistent Memory location is set to a value in
the range &H00 to &H1f...

Should that read &H01 to &H1f ? Is zero a valid ATN character?
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: TTL programming cable

Post by dkinzer »

GTBecker wrote:Is zero a valid ATN character?
Yes, it is. You'll notice that the "spin control" for the ATN character on the Options | Serial Port Options... dialog allows you to adjust the value from 0 through 31.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

TTL programming cable

Post by GTBecker »

> ... 0 through 31...

Well. I've been setting it to zero thinking I was disabling the
ATN_Char OS capture. I'll bet this solves a puzzling bug.

To disable the COM1 ATN OS capture, then, persistent &H13 needs to be
anything but 0-31? FF?

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

Re: TTL programming cable

Post by dkinzer »

GTBecker wrote:To disable the COM1 ATN OS capture, then, persistent &H13 needs to be anything but 0-31? FF?
The value &HFF is the recommended "Off" state but anything above &H1f (31 decimal) will have the same effect.

This was alluded to in a thread a while back. See the ninth entry at:
http://www.zbasic.net/forum/about649.html
- Don Kinzer
Post Reply