Re: Help implementing counter

imr_at_oersted.dtu.dk wrote:

>>Hi All!
>>
>> I have a PCI DAS 08 board and it have an 8254 timer/counter that can
>>count external events (and one of the channels an internal clock).
>>    
>>
>
>There are lots of cards named things like PCI DAS <number>, you would save
>us sometime if you also state the vendor name of the card and the driver you are
>using, I'mguessing it is ComputerBoards and "das08".
>

Yes. I have a Measurement Computing (formerly Computer Boards) PCI-DAS08 
board and Iīm using the das08 module.

>> From what I see in the sources the 8254 stuff isnīt implemented in the
>>driver and I need it to count some external events.
>>    
>>
>
>In my "das08.c" of Comedi 0.7.66
>Line 61:
>#include "8255.h"
>
>Lines 438 and 439:
>i8255_offset:	0,
>i8254_offset:	4,
>
>Lines from 881 to 888:
>s=dev->subdevices+4;
>/* 8255 */
>if(thisboard->i8255_offset!=0){
>	subdev_8255_init(dev,s,NULL,(unsigned long)(dev->iobase+
>		thisboard->i8255_offset));
>}else{
>	s->type=COMEDI_SUBD_UNUSED;
>}
>
>You don't need to understand all this, but seeing so many references to
>8254 and 8255I would assume it is implemented. The question is if the 8255 driver
>supports your 8254or you actually have a 8255, but I would bet one of the two is right.
>
The 8254 is a "Programmable Interval Timer" (in fact just three 16 bits 
counters) and the 8255 is a "Programmable Peripheral Interface" (just 
three I/O ports). They doesnīt have any correlation.
In fact the PCI-DAS08 I have contains one 8254 and none 8255.
I saw the lines you pasted, but they are only for the 8255 found in some 
cards. If  found the 8255 will be reported as a "COMEDI_SUBD_DIO" subdevice.
What I need to implement is the 8254 part that should be reported as 
COMEDI_SUBD_COUNTER and may be also COMEDI_SUBD_TIMER (in this case one 
of the three channels is connected to an internal clock and its output 
can be used as an interrupt source to implement a timer).

>> I was browsing the sources and found some cryptic notes about the
>>counters implementation but doing:
>>
>>$ grep SUBD_COUNTER *
>>    
>>
>
>It doesn't have to use that label, necessarily.
>
Sorry, but I donīt understand it. I need a counter so Iīm looking for 
counters.
Do you suggest to map it as an I/O device with "obscure" properties?

>> Gives me nothing, so it looks like Comedi doesnīt implement any
>> counter.
>>    
>>
>
>I think you haven't looked much... ;-)
>
May be, but I donīt see any extra information in what you pointed out.

>>I have Comedi 0.7.67 sources, should I get something newer in
>> order to
>>find an example of a counter?
>> Can anybody guide me in the implementation?
>>    
>>
>
>>From what I saw in the driver I would try if subdevice #4 is a 8255
>counter. Look in"drivers.txt" and "counter-spec" in "Documentation/comedi" to see how to
>use it.
>

As I explained above 8255 is a DIO device and isnīt even available in 
the PCI model:
        
{                                                                                
        name:           
"pci-das08",                                                     
        id:     
PCI_DEVICE_ID_PCIDAS08,                                                  
        bustype:        
pci,                                                             
        ai:             
das08_ai_rinsn,                                                  
        ai_nbits:       
12,                                                              
        ai_pg:          
das08_bipolar5,                                                  
        ai_encoding:    
das08_encode12,                                                  
        ao:             
NULL,                                                            
        ao_nbits:       
0,                                                               
        di:             
das08_di_rbits,                                                  
        do_:            
das08_do_wbits,                                                  
        do_nchan:       
4,                                                               
        i8255_offset:   
0,                                                               
        i8254_offset:   
4,                                                               
        iosize: 
8,                                                                       
        },

The "i8255_offset:   0,"  means this board doenīt have it and 
"i8254_offset:   4," is defined but never used in the code.

Do you have any other hint?

Thanks, SET

P.S. I saw the 8254.h file, but it looks like some code used only in 
boards where the 8254 can be used as a timer for the conversions and the 
code is just for internal drivers use, doesnīt look like something 
exported to users side.

-- 
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Visit my home page: http://welcome.to/SetSoft or
http://www.geocities.com/SiliconValley/Vista/6552/
Alternative e-mail: set_at_computer.org set_at_ieee.org 
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013

Received on 2003-12-16Z15:09:50