doc:cbm:io:iec:how_serial_bus_works
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:cbm:io:iec:how_serial_bus_works [2020/10/20 22:52] – eek | doc:cbm:io:iec:how_serial_bus_works [2023/11/12 23:43] (current) – eek | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | //This article appeared in Compute! issue 38, July 1983 and is Copyrighted 1983 by Jim Butterfield// | + | //This article appeared in [[https:// |
====== HOW THE VIC/64 SERIAL BUS WORKS ====== | ====== HOW THE VIC/64 SERIAL BUS WORKS ====== | ||
Line 11: | Line 11: | ||
===== GROUND RULES ===== | ===== GROUND RULES ===== | ||
To understand the workings of this bus, you must work through a few concepts. Later, we'll get | To understand the workings of this bus, you must work through a few concepts. Later, we'll get | ||
- | technical for this who want it. | + | technical for those who want it. |
The bus, like the IEEE, has two modes of operation: Select mode, in which the computer calls all devices and asks for a specific device to remain connected after the call (" | The bus, like the IEEE, has two modes of operation: Select mode, in which the computer calls all devices and asks for a specific device to remain connected after the call (" | ||
Line 21: | Line 21: | ||
But the main part is: you select a device, and then you send to it or receive from it. Finally, you shut it off. All devices are connected, but only the one you have selected will listen or talk. | But the main part is: you select a device, and then you send to it or receive from it. Finally, you shut it off. All devices are connected, but only the one you have selected will listen or talk. | ||
- | ===== Some Technical Ground Rules ===== | + | ===== SOME TECHNICAL GROUND RULES ===== |
If you're not into volts and signals and things, the rest of this article may not do much for you. I want to talk about technical aspects of the bus. | If you're not into volts and signals and things, the rest of this article may not do much for you. I want to talk about technical aspects of the bus. | ||
Line 28: | Line 28: | ||
All wires connect to all devices. The wires don't go "one way"; any device can put a ground on a signal line, and all other devices will see it. Indeed, that's the secret of how it works: each wire serves as a common signal bus. | All wires connect to all devices. The wires don't go "one way"; any device can put a ground on a signal line, and all other devices will see it. Indeed, that's the secret of how it works: each wire serves as a common signal bus. | ||
- | When no device puts a ground on a signal line, the voltage rises to almost five volts. We call this the " | + | When no device puts a ground on a signal line, the voltage rises to almost five volts. We call this the " |
- | * A line will become " | + | * A line will become " |
- | * A line will become " | + | * A line will become " |
Remember that we have several lines, but the important ones for information transmission are the | Remember that we have several lines, but the important ones for information transmission are the | ||
Line 40: | Line 40: | ||
===== STEP 1: READY TO SEND ===== | ===== STEP 1: READY TO SEND ===== | ||
- | Sooner or later, the talker will want to talk, and send a character. When it's ready to go, it releases the Clock line to false. This signal change might be translated as " | + | Sooner or later, the talker will want to talk, and send a character. When it's ready to go, it releases the Clock line to false. This signal change might be translated as " |
+ | |||
+ | The listener will respond to the talker' | ||
===== STEP 2: READY FOR DATA ===== | ===== STEP 2: READY FOR DATA ===== | ||
- | When the listener is ready to listen, it releases the Data line to false. Suppose there is more than one listener. The Data line will go false only when all listeners have released it - in other words, when all listeners are ready to accept data. What happens next is variable. Either the talker will pull the Clock line back to true in less than 200 microseconds - usually within 60 microseconds - or it will do nothing. The listener should be watching, and if 200 microseconds pass without the Clock line going to true, it has a special task to perform: note EOI. | + | When the listener is ready to listen, it releases the Data line to false. Suppose there is more than one listener. The Data line will go false only when all listeners have released it - in other words, when all listeners are ready to accept data. |
+ | |||
+ | What happens next is variable. Either the talker will pull the Clock line back to true in less than 200 microseconds - usually within 60 microseconds - or it will do nothing. The listener should be watching, and if 200 microseconds pass without the Clock line going to true, it has a special task to perform: note EOI. | ||
===== INTERMISSION: | ===== INTERMISSION: | ||
- | If the Ready for Data signal isn't acknowledged by the talker within 200 microseconds, | + | If the Ready for Data signal isn't acknowledged by the talker within 200 microseconds, |
+ | |||
+ | So if the listener sees the 200 microsecond time-out, it must signal "OK, I noticed the EOI" back to the talker. It does this by pulling the Data line true for at least 60 microseconds, | ||
+ | |||
+ | The talker will then revert to transmitting the character in the usual way; within 60 microseconds it will pull the Clock line true, and transmission will continue. | ||
+ | |||
+ | At this point, the Clock line is true whether or not we have gone through the EOI sequence; we're back to a common transmission sequence. | ||
===== STEP 3: SENDING THE BITS ===== | ===== STEP 3: SENDING THE BITS ===== | ||
- | The talker has eight bits to send. They will go out without handshake; in other words, the listener had better be there to catch them, since the talker won't wait to hear from the listener. At this point, the talker controls both lines, Clock and Data. At the beginning of the sequence, it is holding the Clock true, while the Data line is released to false. the Data line will change soon, since we'll send the data over it. The eights bits will go out from the character one at a time, with the least significant bit going first. For example, if the character is the ASCII question mark, which is written in binary as 00011111, the ones will go out first, followed by the zeros. Now, for each bit, we set the Data line true or false according to whether the bit is one or zero. As soon as that's set, the Clock line is released to false, signalling "data ready." | + | The talker has eight bits to send. They will go out without handshake; in other words, the listener had better be there to catch them, since the talker won't wait to hear from the listener. At this point, the talker controls both lines, Clock and Data. At the beginning of the sequence, it is holding the Clock true, while the Data line is released to false. the Data line will change soon, since we'll send the data over it. |
+ | |||
+ | The eights bits will go out from the character one at a time, with the least significant bit going first. For example, if the character is the ASCII question mark, which is written in binary as 00011111, the ones will go out first, followed by the zeros. | ||
+ | |||
+ | Now, for each bit, we set the Data line true or false according to whether the bit is one or zero. As soon as that's set, the Clock line is released to false, signalling "data ready." | ||
+ | |||
+ | Once the talker has signalled "data ready," | ||
+ | |||
+ | The listener plays a passive role here; it sends nothing, and just watches. As soon as it sees the Clock line false, it grabs the bit from the Data line and puts it away. It then waits for the clock line to go true, in order to prepare for the next bit. | ||
+ | |||
+ | When the talker figures the data has been held for a sufficient length of time, it pulls the Clock line true and releases the Data line to false. Then it starts to prepare the next bit. | ||
===== STEP 4: FRAME HANDSHAKE ===== | ===== STEP 4: FRAME HANDSHAKE ===== | ||
- | After the eighth bit has been sent, it's the listener' | + | After the eighth bit has been sent, it's the listener' |
+ | |||
+ | The talker is now watching the Data line. If the listener doesn' | ||
===== STEP 5: START OVER ===== | ===== STEP 5: START OVER ===== | ||
We're finished, and back where we started. The talker is holding the Clock line true, and the | We're finished, and back where we started. The talker is holding the Clock line true, and the | ||
- | listener is holding the Data line true. We're ready for step 1; we may send another character - unless EOI has happened. If EOI was sent or received in this last transmission, | + | listener is holding the Data line true. We're ready for step 1; we may send another character - unless EOI has happened. |
- | [DIAGRAM] | + | If EOI was sent or received in this last transmission, |
+ | |||
+ | {{: | ||
===== ATTENTION! ===== | ===== ATTENTION! ===== | ||
- | This is all very well for a transmission that's under way, but how do we set up talker and listener? We use an extra line that overrides everything else, called the ATN, or Attention line. Normally, the computer is the only device that will pull ATN true. When it does so, all other devices drop what they are doing and become listeners. Signals sent by the computer during an ATN period look like ordinary characters - eight bits with the usual handshake - but they are not data. They are " | + | This is all very well for a transmission that's under way, but how do we set up talker and listener? We use an extra line that overrides everything else, called the ATN, or Attention line. |
- | ATN switches off, the computer will be waiting as a talker, holding the Clock line true; and the | + | |
- | disk will be the listener, holding the Data line true. That's good, because the computer has more to send, and it will transmit: X; | + | Normally, the computer is the only device that will pull ATN true. When it does so, all other devices drop what they are doing and become listeners. |
+ | |||
+ | Signals sent by the computer during an ATN period look like ordinary characters - eight bits with the usual handshake - but they are not data. They are " | ||
+ | |||
+ | An example might help give an idea of the nature of the communications that take place. To open for writing a sequential disk file called " | ||
signal. Shortly thereafter, the computer will switch ATN back on and send DEVICE-8- | signal. Shortly thereafter, the computer will switch ATN back on and send DEVICE-8- | ||
- | UNLISTEN. The file is now open; later, the computer will want to send data there. It will transmit, with ATN on, DEVICE-8-LISTEN; | + | UNLISTEN. |
- | releases the ATN line and sends its data; only the disk will receive the data, and the disk will know to put it onto the file called XX. The last character sent by the computer will also signal EOI. After the computer has sent enough data for the moment, it will pull ATN on again and send DEVICE-8-UNLISTEN. Many bursts of data may goto the file; eventually, the computer will close the file by sending (with ATN on, of course) DEVICE-8-LISTEN; | + | |
+ | The file is now open; later, the computer will want to send data there. It will transmit, with ATN on, DEVICE-8-LISTEN; | ||
+ | |||
+ | After the computer has sent enough data for the moment, it will pull ATN on again and send DEVICE-8-UNLISTEN. Many bursts of data may goto the file; eventually, the computer will close the file by sending (with ATN on, of course) DEVICE-8-LISTEN; | ||
+ | |||
+ | ATN overrides everything in progress, A disk file might have lots of characters to give to the computer, but the computer wants only a little data. It accepts the characters it wants, then switches on ATN and commands the disk to Untalk. The disk has not sent EOI, but it will disconnect as commanded. Later, when it's asked to Talk again, it will send more characters. | ||
===== ATN SEQUENCES ===== | ===== ATN SEQUENCES ===== | ||
When ATN is pulled true, everybody stops what they are doing. The processor will quickly pull the | When ATN is pulled true, everybody stops what they are doing. The processor will quickly pull the | ||
- | Clock line true (it's going to send soon), so it may be hard to notice that all other devices release the Clock line. At the same time, the processor releases the Data line to false, but all other devices are getting ready to listen and will each pull Data to true. They had better do this within one millisecond (1000 microseconds), | + | Clock line true (it's going to send soon), so it may be hard to notice that all other devices release the Clock line. At the same time, the processor releases the Data line to false, but all other devices are getting ready to listen and will each pull Data to true. They had better do this within one millisecond (1000 microseconds), |
+ | |||
+ | Under normal circumstances, | ||
===== TURNAROUND ===== | ===== TURNAROUND ===== | ||
An unusual sequence takes place following ATN if the computer wishes the remote device to | An unusual sequence takes place following ATN if the computer wishes the remote device to | ||
become a talker. This will usually take place only after a Talk command has been sent. | become a talker. This will usually take place only after a Talk command has been sent. | ||
- | Immediately after ATN is released, the selected device will be behaving like a listener. After all, it's been listening during the ATN cycle, and the computer has been a talker. At this instant, we have "wrong way" logic; the device is holding down the Data line, and the computer is holding the Clock line. We must turn this around. Here's the sequence: the computer quickly realizes what's going on, and pulls the Data line to true (it's already there), as well as releasing the Clock line to false. The device waits for this: when it sees the Clock line go | + | Immediately after ATN is released, the selected device will be behaving like a listener. After all, it's been listening during the ATN cycle, and the computer has been a talker. At this instant, we have "wrong way" logic; the device is holding down the Data line, and the computer is holding the Clock line. We must turn this around. |
- | true, it releases the Data line (which stays true anyway since the computer is now holding it down) and then pulls down the Clock line. We're now in our starting position, with the talker (that' | + | |
+ | Here's the sequence: the computer quickly realizes what's going on, and pulls the Data line to true (it's already there), as well as releasing the Clock line to false. The device waits for this: when it sees the Clock line go | ||
+ | true, it releases the Data line (which stays true anyway since the computer is now holding it down) and then pulls down the Clock line. | ||
+ | |||
+ | We're now in our starting position, with the talker (that' | ||
+ | |||
+ | The logic sequences make sense. They are hard to watch with a voltmeter or oscilloscope since you can't tell which device is pulling the line down to true. | ||
+ | |||
+ | The principles involved are very similar to those on the PET/CBM IEEE-488 bus - the same Talk and Listen commands go out, with secondary addresses and similar features. There are fewer " | ||
//-End of document\\ Copyright 1983 by Jim Butterfield (published in Compute!)// | //-End of document\\ Copyright 1983 by Jim Butterfield (published in Compute!)// |
doc/cbm/io/iec/how_serial_bus_works.1603234332.txt.gz · Last modified: 2020/10/20 22:52 by eek