Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > userport coding
2005-11-22 19:21
LHS

Registered: Dec 2002
Posts: 66
userport coding

Hi all,

I would like make a connection for C64 userport and I will use most of userport's pins. Unfortunately I have not a lot of good documentation about this problem, I know only how to use pins PA2 and FLAG2. I would like ask you:

1) The pin SER.ATN IN
is fourth bit at $DD00 (PA3), but it is output only? I can set the fourth bit at $DD02 ($DD00 mask) for input, but the bit is unchangeable. And for output in high is the voltage only 3,8V, but PA2 has 4,7V, do you know why?

2) The pin PC2
this pin is output handshake of CIA2. The FLAG2 is input handshake and I can check the pin at $DD0D, but how I can set the PC2? In normaly state is still in high (or is in an oscillation which I am not able check?).

3) The pins CNT and SP
the CNT1+SP1 and CNT2+SP2 are serial I/O links, but I have not a lot of expirience with CIA timers. Can you give me an example code for use these pins, please?

LHS
2005-11-23 08:29
ready.

Registered: Feb 2003
Posts: 441
Have you checked the Commodore programmer's reference guide at http://www.devili.iki.fi/Computers/Commodore/C64/Programmers_Re.. ? Look in the memory map section at the end of the book.

I found it quite useful for my Bike 64 Project, which heavily used the user port (Bike 64 Project V2.0). I'll try to find the routine I used for programming CIA timers, give me some time.

Ready.
2005-11-23 15:03
LHS

Registered: Dec 2002
Posts: 66
I found a scheme of a cable for connection of two userports, it uses direction PC2 to FLAG2. Routine in source C64 writes "only" data to PB0-PB7 and destination C64 reads FLAG2 and then reads the PB0-PB7. It looks that PC2 is automatic signal (oscilation) when you write an output data to PB0-PB7. I am checking the PC2 at LPT port under WinXP and I can't record any changes... NT Sucks ;-)

LHS
2005-11-23 18:07
TNT
Account closed

Registered: Oct 2004
Posts: 189
Yes, /PC goes low for one cycle after port B access.

Using serial port is quite easy. When sending, just set timer A to desired value (max speed when timer A = $0002, about 32 kBps), set SP out/continuous timer/start timer into TA control, then clear and ack pending timer/serial interrupts and stuff data into SDR, wait for serial interrupt flag, then stuff the next byte into DTR etc.

When reading serial port, set SP in, then just wait for serial interrupt flag and read SDR.
2014-07-25 15:01
ready.

Registered: Feb 2003
Posts: 441
I am experimenting a bit with PA3 of user port. Actually on PA2 as output I can get the full voltage swing 0-5V when changing its state. But for PA3 I get only 0-2.8V, like LHS reported.

Anyone knows why?
2014-07-25 15:06
tlr

Registered: Sep 2003
Posts: 1790
What do you mean by PA3? ATN_ ?

It should give you ~full swing assuming it's un-loaded. Note that a plugged IEC-device might load it down.
2014-07-25 21:44
ready.

Registered: Feb 2003
Posts: 441
yes, I mean ATN/PA3 at userport pin number 9. I had a disk drive plugged in, but it was OFF. I will test if removing the IEC cable changes the situation. I measured the bare pin without connecting it to anything and I got about 2.8V. I also tried with a 10kOHM pull-up between PA3 and 5V and it still gave 2.8V.
2014-07-27 06:41
Angel of Death

Registered: Apr 2008
Posts: 211
@LHS
Can you send me a link to that connection cable scheme (or the picture itself)?
What I want to know is if there is any galvanic seperation, or at least a few optocouplers, between the two ports.
2014-07-28 07:46
ready.

Registered: Feb 2003
Posts: 441
my project is about using the userport data bus in both directions (input and output) through optocouplers (based on HCLP2630, which is a fast optocoupler) to manage a set of addresses to control an external process. More specifically the basic configuration will acquire one thermocouple, one pt100 temperature sensor and a PWM to control a torque motor gradually driving the position of a valve. All this to control the combustion of a fire stove, in order to regualte the proper quatity of air. But once the bus is ready, it's easy to attach more stuff to it, like more sensors or actuators.
2014-07-28 11:27
tlr

Registered: Sep 2003
Posts: 1790
Perhaps you should look into using the two synchronous serial ports instead of the raw bits?
This reduces the amount of optocouplers (and power) required for the isolation part.

I don't remember the max bitrate but IIRC you can do ~30Kbyte/s with it.
2014-07-28 13:22
ready.

Registered: Feb 2003
Posts: 441
@trl: yes I have considered using serial communication. It surely reduces the optocoupler amount, but then it complicates the circuits on the end points, since in the end many ICs use parallel interfaces, so I should do serial to parallel convertion. Actually I have not deeply looked into this, honestly. I might consider it for a future project.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Courage
csabanw
bepp/ΤRIΛD
Magic/Nah-Kolor
Thierry
Codey/Second Dimension
wil
Morpheus/IPC+C64.COM
Airwolf/F4CG
Guests online: 97
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Diskmag Editors
1 Magic  (9.8)
2 hedning  (9.6)
3 Jazzcat  (9.5)
4 Elwix  (9.1)
5 Remix  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.04 sec.