Ken: That is exactly the kind of information I am looking for. I am using QBASIC because I a fairly familiar with writing code. However, I have never written any real-time code. The PC has a bidirectional LPT1. I have some free running A/D outputs that are 16-bits wide parallel data with some control signals. I want to capture the data, massage it and output an algorithm to a D/A and a LCD Display. The data stream is not very fast (Kbytes/sec). I would use C if I could find a good CD ROM or beginner's self study book to learn it. I am in the process of learning PIC assembly. It seems to be fairly straight forward and easy to grasp. I do not have MPLAB yet so I am still at the theoretical stage. That is, no real verification that the programs will work. I have been in an administrative position for many years and delegated the software design to others. I was pretty competent at assembly and Intel Basic for the MCS51 series microcontrollers but I became pretty rusty over time. My business collapsed due to international circumstances and wiped me out financially. So now I have to wear all the hats if I am going to survive and I am starting with what I think I can grasp most quickly. I am much more effective in hardware design, especially analog, high voltage and power applications and RF. But I need to learn C, PIC assembly and in general become more efficient in software development. I have many designs in the works. Thank you for your interest. Regards, Richard ----- Original Message ----- From: "Ken Pergola" To: Sent: Wednesday, September 17, 2003 12:26 AM Subject: Re: [EE] QBASIC QUESTION > Hi Richard, > > For the parallel port, use the INP() and OUT() commands. > To find your port addresses, invoke debug and type: d 40:0 > > You'll get something like: > > -d 40:0 <=== this is what you typed in at the debug prompt > > 0040:0000 F8 03 F8 02 E8 03 E8 02-BC 03 78 03 78 02 C0 9F > ..........x.x... > > > You'll see that on my computer my port addresses are as follows: > COM1 = 0x3F8 > COM2 = 0x2F8 > COM3 = 0x3E8 > COM4 = 0x2E8 > > LPT1 = 0x3BC (base address) > LPT2 = 0x378 (base address) > LPT3 = 0x278 (base address) > > (you can't assume, for example, that LPT1 will > always translate to a 0x3BC -- always check with > debug on any machine you will use) > > > > On the parallel port: > Data register = base address > Status register = base address + 1 > Control register = base address + 2 > > > > > > ' This is *no*t code that should be executed in order, these are just code > snippets: > > ' Upon start-up, cache the control register into a global variable > ControlByte = INP(ControlReg) > > ' Force parallel port data bus to OUTPUT mode > ControlByte = (ControlByte And 223) > OUT ControlReg, ControlByte > > ' Force parallel port data bus to INPUT mode > ControlByte = (ControlByte Or 32) > OUT ControlReg, ControlByte > > > ' Read the parallel port's data bus > DataByte = INP(DataReg) > > > ' Write to the parallel port's data bus > OUT DataReg, DataByte > > > > May I ask a few questions? > > 1) Do you have to use QBASIC? I'm just curious why you want to do this in > QBASIC. Would you consider another language? > > 2) Do you have a bidirectional parallel port installed on the computer? If > so, do you know it's address? > > 3) Could you give more details on exactly what you are trying to accomplish > (the overall picture)? > > Hope this gives you a start, but please chime in to provide some more > specifics since there's more than one way to skin a cat. As for the serial > port, there should be QBASIC documentation for this. > > > Best regards, > > Ken Pergola > > > > > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Richard Graziano > Sent: Tuesday, September 16, 2003 11:03 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [EE] QBASIC QUESTION > > > Does anyone know how to write a QBASIC command to transfer a byte or > multiple sequence of bytes to the parallel port of a PC, and also to read a > byte or multiple sequence of bytes from the parallel port? Also, the same > question applies to the serial port. I would appreciate any information on > this software question. > > Regards, > Richard > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body