ATN Character Issue

Discussion of issues related to writing ZBasic applications for targets other than ZX devices, i.e. generic targets.
Post Reply
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

ATN Character Issue

Post by Don_Kirby »

I am unsure if this is related to the Beta compiler, which is why this is posted here.

I have a factory fresh ZX24n here that recently arrived. I've plugged it into my trusty programmer and hooked it up via RS232. Eager to test my application, I verified that the factory installed 'Hello World' application was running properly, loaded my application into the IDE, and pressed F5. Success! Downloaded and verified fine. Although the application has it's bugs, they are beyond the scope of this topic.

I powered down the device, and moved it to my breadboard for further testing. The breadboard uses an FTDI USB to serial converter which I typically use with the ATN Character for DTR-less downloads. After making some adjustments to my application, and checking the Use ATN Character box in the serial port settings dialog, I was unable to perform an upload. The device didn't respond to the ATN Character.

I moved back to the RS232 programmer and tried there. No joy.

Perhaps my application accidentally overwrote the ANT character. I reloaded the 'Hello World' application (found in this thread). No better place to start than the beginning...

Once the Hello World app was running again, I checked the Use ATN Character box and tried again, this time using the RS232 programmer.

Still no joy. I manually added code to set the ATN character (&H04) to the Hello World app and programmed the device via DTR. Using the Identify Device function, the information returned doesn't show that the ATN Character was set. It still shows 0, although the program size and checksum changed, indicating that the new code was programmed into the device.

Any ideas?

-DK
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post by Don_Kirby »

Continuing the investigation.

As the Identify Device function in the IDE reports the ATN Character as 0, I've tried using that rather than the customary default. Same result as before.

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

Re: ATN Character Issue

Post by dkinzer »

Don_Kirby wrote:I manually added code to set the ATN character (&H04) to the Hello World app and programmed the device via DTR.
I'll investigate. It could be caused by the code changes that were made to support generic devices.
- Don Kinzer
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: ATN Character Issue

Post by dkinzer »

Don_Kirby wrote:I manually added code to set the ATN character (&H04) to the Hello World app and programmed the device via DTR.
By the way, how did you accomplish this? If you did so by directly writing to Persistent address 19 (&H13), I suspect that that is the source of the problem.

In order to get the ATN-detecting code linked into the application it is necessary for the Option ATNChar directive to appear in your application. You can still turn the detection on and off while the application is running by writing directly to Persistent address 19.

In retrospect, it may be better to always link in the ATN character detection code for ZX devices unless it is specifically disabled by using 'Option ATNChar Off'. The benefit of not linking it is is that the application is smaller than it would be otherwise.
- Don Kinzer
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Re: ATN Character Issue

Post by Don_Kirby »

dkinzer wrote: In order to get the ATN-detecting code linked into the application it is necessary for the Option ATNChar directive to appear in your application. You can still turn the detection on and off while the application is running by writing directly to Persistent address 19.
Correct as usual. I neglected to add the Option ATNChar. I tend to agree that the default should leave the ATN code in place. If the users' code is large enough that the ATN code is an issue, manually removing that code would be but one of a suite of space saving options available to the user.

-DK
Post Reply