Page 1 of 1

ZXPand+ Joystick serial port IDC10 example

Posted: Sun Aug 06, 2017 9:43 pm
by tdg8934
All,

I finally got around to testing the Atari joystick port on the ZXPand+ serial IDC connector. I used the example in the ZX81 manual for INKEY$ and saw the CONFIG "J=76580" command wasn't even needed and only used if you want to change the UDLRF buttons.

Charlie - you may want to update the ZXPAND+ manual as the default is supposed to be: 76580 and I got 7658. (period for "Fire" not 0 as stated)

Also a nice Joystick IDC10 adapter comes with the ZXPand+ which makes it so much easier. I'm waiting on my IDC breakout board and DB9 breakout boards to arrive in the mail. I would like to use this to connect my Serial LCD display and Joystick together for a demo.

Anyway - Very easy to use for Joystick use!


Tim
image1.JPG
image1.JPG (100.02 KiB) Viewed 4540 times
image2.JPG
image2.JPG (116.84 KiB) Viewed 4540 times

Re: ZXPand+ Joystick serial port IDC10 example

Posted: Mon Aug 14, 2017 1:29 am
by tdg8934
I expanded the program to test both a joystick and display the direction or fire on a serial LCD on a ZXPand+ Serial port IDC10 connector broken out to a solderless breadboard.

Re: ZXPand+ Joystick serial port IDC10 example

Posted: Mon Aug 14, 2017 9:53 am
by sirmorris
Glad to see you're enjoying yourself :D

May I make a suggestion for an optimisation? Rather than

Code: Select all

IF INKEY$ = "5" THEN LET A$ = "L"
...
etc., why not try...

Code: Select all

CONFIG "J=UDLRF"
...
LET A$ = INKEY$
Now this means that the keyboard will no longer show U,D etc when you press the cursor keys, so if that is a requirement then this approach isn't worthwhile :D

Re: ZXPand+ Joystick serial port IDC10 example

Posted: Mon Aug 14, 2017 2:08 pm
by tdg8934
Yes - I was trying to test out the ZXPand+ IDC10 Serial port utilizing an Atari/C64 type joystick and displaying direction/fire on a Parallax serial LCD (still have to run the program a second time to initialize the LCD - need a way to get +5vdc on TX - sending CHR$(255) doesn't do it). Anyway, I like what you are saying by using the CONFIG "J=UDLRF" and A$=INKEY$. All I would need then besides that is IF A$="Q" THEN GOTO 1200. I'll try the shortened code out tonight.

Also not sure if you saw before that the default for FIRE button is a period "." not a zero "0" that the ZXPand+ online manual states. Either a v1.9 code update or change to the online manual should happen at some point. Something to keep in your back hip pocket for later.

Thanks - Tim

Re: ZXPand+ Joystick serial port IDC10 example

Posted: Mon Aug 14, 2017 4:27 pm
by siggi
tdg8934 wrote: Mon Aug 14, 2017 2:08 pm Yes - I was trying to test out the ZXPand+ IDC10 Serial port utilizing an Atari/C64 type joystick and displaying direction/fire on a Parallax serial LCD (still have to run the program a second time to initialize the LCD - need a way to get +5vdc on TX - sending CHR$(255) doesn't do it).
Try to send a BREAK signal (switches TXD to a constant active level until it is disabled), if the ZXpand-serial-port does support that

Siggi

Re: ZXPand+ Joystick serial port IDC10 example

Posted: Tue Aug 15, 2017 3:52 am
by tdg8934
Siggi,

It looks like TX is reading a HIGH almost all of the time from power on to running serial programs using TX. I'm getting voltages between 4.9 and 4.8 volts depending on what I'm sending out TX. 5vdc is reading 4.98v on the serial port. So perhaps I need to send a LOW (0vdc) or at a level low enough that can clear the LCD. I'm a bit confused about it. Normally the LCD expects to see a LOW upon power on from TX. Then the user sends a HIGH for a short period out of TX to inialize the LCD. My only bandaid at the moment is to run the program twice where the first attempt somehow inializes the LCD and the second run of the program makes the LCD behave correctly.

Tim

Re: ZXPand+ Joystick serial port IDC10 example

Posted: Tue Aug 15, 2017 6:44 am
by sirmorris
I've read the display documentation and as it appears you simply need to wait 100 milliseconds after power-on before you start sending data. There's (thankfully) no exotic startup-sequence needed.

I wonder if the display is turned off when run the first time? There are codes to change the display state, backlight colour etc etc. What happens if you send those? One thing I've just remembered is that there is some serial output from the PIC at boot. I like to have a little something to reassure me while I'm developing the code. If you attach a serial terminal at 38400 8N1 you will see the state of the startup code echoed. Perhaps this is confusing your display.

I will remove this in V1.1. TBH I thought I'd already done that but we all know what thought did, don't we. Followed a muck cart and thought it was a wedding.

Re: ZXPand+ Joystick serial port IDC10 example

Posted: Tue Aug 15, 2017 10:51 am
by tdg8934
Charlie thank you for looking into this!

As you know the LCD has only 3 switchable baud rates of 2400, 9600 and 19200. Currently I'm using 2400 baud because using the other 2 causes either a repeatable tonr and characters displayed (more so at 19200) that shows but I can clear them with sending a clear LCD code (but only works after a second run of the code). At least at 2400 baud for some reason this lower baud doesn't display any characters upon power on like the higher bauds do. Occasionally I'll get the cursor code to start at the wrong position. Remember this maybe because it's not being inialized. I've tried using various PAUSE statements with little effect on LCD initializing. I will try using hyperterminal at the various bauds (38400, 19200, 9600 and 2400) to see what's happening as you said. Assuming I connect the USB/serial cable (RX-TX, TX-RX, gnd-gnd) to the IDC 10 serial connections.

Thanks - Tim

Re: ZXPand+ Joystick serial port IDC10 example

Posted: Tue Aug 15, 2017 11:06 am
by sirmorris
That backs up my theory. PM incoming.

Re: ZXPand+ Joystick serial port IDC10 example

Posted: Tue Aug 15, 2017 12:12 pm
by tdg8934
Great news. I sent you a reply PM.

Tim