From: Jan Kandziora on 7 Oct 2009 05:02 CKL schrieb: > 0x37a (port Cont) > // Port Nb > 1 : => output (Cont 0 ) > 14 : => output (Cont 1 ) > 16 : => output (Cont 2 ) > 17 : => output (Cont 3 ) > > The application should work in Windows (and if possible in Linux) > For MS-Windows you'll have to write/look for a device driver that allows you to control the hardware directly. In Linux there already is the /dev/port device which you may [open] like a disk file, then [seek] to the wanted position and [read]/[puts]. The process needs root access to do that. The parport kernel driver should be advised to leave out that specific port to avoid messing up with your program. Please note timing is a problem for high-level applications. If you need anything below 200ms, think about coding a real-time task in C. Applies to any OS. > There is now a long time that I try to find a easy solution to set/ > reset this bits in tcl, but without success. > Controlling/abstracting the hardware to files and/or syscalls is done by the OS, not by a language. Kind regards Jan
From: CKL on 7 Oct 2009 08:26 Many thanks Relative to: "Controlling/abstracting the hardware to files and/or syscalls is done by the OS, not by a language." C language, is a language, and I can access to any register I want. So I was just disappointed to not control a register with tcl. (tcl is written in C) As my application, is relative time dependent, I think I have to code the task in C. The objective is namely to control with 1 : => output (Cont 0 ) 14 : => output (Cont 1 ) an analog demultiplexer 74HC4052 (1 to 4) in order to read/write data from my unique PC serial port to 4 Serials ports (of my 4 devices having each a Microchip PIC) '---------- Serial PIC ' PC Serial --74HC052 ---'---------- Serial PIC ' ' ' '---------- Serial PIC ' ' Parallel----' '---------- Serial PIC How could I in tcl, call the compiled Gcc code in my tcl application. Of course I what to use the tcl (open(com1,r+)) command to read and write in an infinite loop the PC serial port. IS there an example how I could run a C compiled code, in tcl ? What do you think about Thanks Christian
From: Joel on 7 Oct 2009 09:09 CKL wrote: > Many thanks > > > Relative to: > "Controlling/abstracting the hardware to files and/or syscalls is done > by the > OS, not by a language." > C language, is a language, and I can access to any register I want. So > I was just disappointed to not control a register with tcl. (tcl is > written in C) > > As my application, is relative time dependent, I think I have to code > the task in C. > The objective is namely to control with > 1 : => output (Cont 0 ) > 14 : => output (Cont 1 ) > an analog demultiplexer 74HC4052 (1 to 4) in order to read/write data > from my unique PC serial port to 4 Serials ports (of my 4 devices > having each a Microchip PIC) > > '---------- Serial PIC > ' > PC Serial --74HC052 ---'---------- Serial PIC > ' ' > ' '---------- Serial PIC > ' ' > Parallel----' '---------- Serial PIC > > > How could I in tcl, call the compiled Gcc code in my tcl application. > Of course I what to use the tcl (open(com1,r+)) command to read and > write in an infinite loop the PC serial port. > > IS there an example how I could run a C compiled code, in tcl ? > > What do you think about > > Thanks > > Christian Sounds like you are going to have to make your own Tcl extension package to interface with a compiled DLL that accesses the parallel port. As others have noted elsethread, the Windows NT/2K/XP/Vista hardware abstraction layer does not allow you to directly access the port via simple register writes. There was something called port95NT.exe that included a driver and such that would allow you access. This worked on 95, 2K, and XP. I doubt it works on Vista because it is not based on the Window Driver Model but I haven't tried it. So you could make a Tcl extension that uses the port95NT.exe driver that gets installed, then use Tcl to interface into that. HTH, Joel
From: Jan Kandziora on 7 Oct 2009 10:02 CKL schrieb: > > C language, is a language, and I can access to any register I want. So > I was just disappointed to not control a register with tcl. (tcl is > written in C) > C too has no concept about hardware at all. You have to use a driver (library) or embedded assebler code to access io ports. E.g. in Linux, you can use the inb() and outb() macros, which happen to be plain x86 assembler code. If your intention is to write portable code, you can't use inb() and friends. You have to rely on a abstraction layer common to all platforms. I/O ports aren't. > As my application, is relative time dependent, I think I have to code > the task in C. > The objective is namely to control with > 1 : => output (Cont 0 ) > 14 : => output (Cont 1 ) > an analog demultiplexer 74HC4052 (1 to 4) in order to read/write data > from my unique PC serial port to 4 Serials ports (of my 4 devices > having each a Microchip PIC) > > '---------- Serial PIC > ' > PC Serial --74HC052 ---'---------- Serial PIC > ' ' > ' '---------- Serial PIC > ' ' > Parallel----' '---------- Serial PIC > Is it a multi-chip programmer or similar? Think about using the modem control lines (DTR/RTS) of the serial port for switching. That way you only need the serial port to run the device. Even most USB->RS232 adapters will work. Plus, both MS-Windows and Linux have an abstraction layer to control these lines. Tcl can use them OOTB. $ man n open /-ttycontrol > > How could I in tcl, call the compiled Gcc code in my tcl application. > Of course I what to use the tcl (open(com1,r+)) command to read and > write in an infinite loop the PC serial port. > > IS there an example how I could run a C compiled code, in tcl ? > See the critcl extension. > What do you think about > Use the modem control lines. It's easier and more portable. Kind regards Jan
From: David Gravereaux on 7 Oct 2009 10:30 CKL wrote: > C language, is a language, and I can access to any register I want. This isn't DOS anymore. That statement is not true. The operating system decides the level of hardware access you are allowed. http://www.epanorama.net/circuits/parallel_output.html#windowsprogramming Info there is about 10 years old and doesn't fully apply to modern day. http://logix4u.net/Legacy_Ports/Parallel_Port/Inpout32.dll_for_Windows_98/2000/NT/XP.html --
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: BLT with starpacks Next: Announce : Oratcl version 4.5 is released. |