6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 17, 2024 4:37 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Apr 26, 2005 7:02 am 
Offline

Joined: Tue Apr 26, 2005 6:47 am
Posts: 2
Hello All,

1. This is a very simple problem for a forum like this. However I need help in solving this problem.

2. I have a 6502 controller driven equipment in my company (weighing machine). and it has been integrated with a PC with help of a interface card. But this is one way communication only.

3. I want to control the machine using PC, means - I should be able to send the control signals / commands to the machine and set various parameters.

4. How can that be achieved? if this is possible, would u help me?

Regards

Raj


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 26, 2005 8:11 am 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8542
Location: Southern California
Do they both have RS-232? That would be easiest.

The software at both ends may get complex, but not very complicated.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 28, 2005 4:18 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
GARTHWILSON wrote:
Do they both have RS-232? That would be easiest.

The software at both ends may get complex, but not very complicated.


You don't need to make it complex, either. It seems that all modern-day networking protocols are now attempting to emulate memory transfer transactions, and it seems logical that we should learn from this as well. (Note: this trend appears to have started with Firewire.)

Each command packet includes some kind of transaction code. For now, I'll stick with READ and WRITE, although others are conceptually possible too (e.g., interrupts). In addition to the command byte, you would need to include a start address, and a length. This lets a single command read anything from a single byte up to a 64KB chunk, or more if you wish.

Commands for reading/writing from a 64KB address space, up to 64KB at a time, would look like this (using C-style structure notation for clarity):

Code:
struct CommandPacket
{
    char command;
    unsigned short startAddress;
    unsigned short length;
    /* if command == WRITE, then append data here. */
};


A response would just be another packet, sent the other direction, but with some kind of special flag bit set saying it's a response, not a command. This works great over a point-to-point link.

Higher-level functions (suppose you want to talk to it via a "terminal" interface) are supported by reading and writing to/from well-known memory locations. For instance, writing a chunk of text starting at location $0000 would print the text to a device's printer, while writing it starting at $0001 would print the text to the device's LCD, etc. Reading data starting at the same location might cause it to read from the keyboard.

In this manner, the function is determined by its start address. This is finding application in most high-end TCP/IP networks now, under the guise of "TCP/IP-without-copying," where IP routing is performed 100% in hardware, without any CPU intervention. This is also the fundamental concept behind Firewire.

If you have an actual bus-style or other topology network connection, where you need to address multiple nodes, then you can use the network address as the upper bits of the virtual address to read/write to. For example, we can extend our command packet above thusly:

Code:
struct CommandPacket
{
    char command;
    unsigned long replyAddress;
    unsigned long startAddress;
    unsigned short length;
    /* if command == WRITE, then append data here. */
};


In this case, we're arbitrarily assigning the upper 16-bits of the startAddress field to be the target node we wish to read/write from. The lower 16 bits is the offset within that node's "address space."

The replyAddress field is structured similarly -- the upper 16 bits contains the sending node address so that the device knows where to send the reply. This is necessary since we're no longer assuming a point-to-point link, and hence this information is required to properly route the packet to its rightful destination.

The advantage of this approach is its universality. You can easily use this to perform control functions, to upload or download software, and to commence remote execution at a specific address, in addition to higher-level I/O such as file transfer.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 05, 2005 10:45 am 
Offline

Joined: Sun Aug 24, 2003 7:17 pm
Posts: 111
The interface PC/6502 has to go over a PC port and an interface chip (for example 6522, 6551) of the 6502 system. What interface chips do you have?

I think the main problem is the access to the PC ports. With the Pentium CPU running in "protected mode" under Window XP it is really complicated to get access to the ports. With Quick Basic running in "classical DOS mode" there are no problems but with Visual Basic running in protected mode there are. I use "Driver LINX PORT I/O" to get access to the PC parallel port when running Visual Basic but for some strange reason the same software does not work for the registers controlling the serial port!

What I use is therefore an interface over the PC parallel port to one of the ports of a 6522 chip. I could offer a contribution to this WEB side describing this interface in detail. It should also be straightforward to set up a serial RS232 interface as far as the serial port access problem on the PC side can be resolved (for example by using DOS mode with Quick Basic).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 05, 2005 10:47 am 
Offline

Joined: Sun Aug 24, 2003 7:17 pm
Posts: 111
The interface PC/6502 has to go over a PC port and an interface chip (for example 6522, 6551) of the 6502 system. What interface chips do you have?

I think the main problem is the access to the PC ports. With the Pentium CPU running in "protected mode" under Window XP it is really complicated to get access to the ports. With Quick Basic running in "classical DOS mode" there are no problems but with Visual Basic running in protected mode there are. I use "Driver LINX PORT I/O" to get access to the PC parallel port when running Visual Basic but for some strange reason the same software does not work for the registers controlling the serial port!

What I use is therefore an interface over the PC parallel port to one of the ports of a 6522 chip. I could offer a contribution to this WEB side describing this interface in detail. It should also be straightforward to set up a serial RS232 interface as far as the serial port access problem on the PC side can be resolved (for example by using DOS mode with Quick Basic).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: