Page 1 of 1

TTL programming cable

Posted: 25 May 2010, 10:47 AM
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

Re: TTL programming cable

Posted: 25 May 2010, 11:11 AM
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.

Posted: 25 May 2010, 11:48 AM
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

Posted: 25 May 2010, 12:45 PM
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.

Posted: 25 May 2010, 14:22 PM
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 ?

Posted: 25 May 2010, 14:43 PM
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.

TTL programming cable

Posted: 25 May 2010, 15:03 PM
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?

Re: TTL programming cable

Posted: 25 May 2010, 15:30 PM
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.

TTL programming cable

Posted: 25 May 2010, 17:50 PM
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

Re: TTL programming cable

Posted: 25 May 2010, 18:26 PM
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