Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) 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: 1703
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: 210
@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: 1703
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
Magic/Nah-Kolor
Guests online: 70
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Original Suppliers
1 Derbyshire Ram  (9.5)
2 Black Beard  (9.4)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Irata  (8.5)

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