Re: Re: Help implementing counter

OK, thanks.  I was getting a compile error because 
INSN_CONFIG_8254_SET_MODE, I8254_MODE0 and I8254_BINARY weren't defined, 
but I jumped into the code and modified the includes in 'comedilib'.  I 
have attached the diffs from the the CVS 'comedilib'.

It all worked great once it compiled!  Now I just have to get it do 
specifically what we need, so thanks for the help.

-Sim

Salvador Eduardo Tropea wrote:

> Look in the mailing list archive:
>
> https://cvs.comedi.org/pipermail/comedi/2004-February/005493.html
>
> This example shows how to set the 8254 mode, set an starting value for 
> the counter, read the status and read the current count.
> Counter 2 (CTR3 in the connector) have its clock connected to the PCI 
> clock divided by 8 (33 MHz/8).
>
> SET
>
# cvs diff include
? include/Makefile
? include/Makefile.in
Index: include/comedi.h
===================================================================
RCS file: /var/cvs/comedilib/include/comedi.h,v
retrieving revision 1.23
diff -r1.23 comedi.h
236a237,238
> 	INSN_CONFIG_8254_SET_MODE = 4097,
> 	INSN_CONFIG_8254_READ_STATUS = 4098
448a451,481
> 
> /*
>   8254 specific configuration.
> 
>   It supports two config commands:
> 
>   0 ID: INSN_CONFIG_8254_SET_MODE
>   1 8254 Mode
>     I8254_MODE0, I8254_MODE1, ..., I8254_MODE5
>     OR'ed with:
>     I8254_BCD, I8254_BINARY
> 
>   0 ID: INSN_CONFIG_8254_READ_STATUS
>   1 <-- Status byte returned here.
>     B7=Output
>     B6=NULL Count
>     B5-B0 Current mode.
> 
> */
> 
> enum i8254_mode
> {
> 	I8254_MODE0 = (0<<1),  /* Interrupt on terminal count */
> 	I8254_MODE1 = (1<<1),  /* Hardware retriggerable one-shot */
> 	I8254_MODE2 = (2<<1),  /* Rate generator */
> 	I8254_MODE3 = (3<<1),  /* Square wave mode */
> 	I8254_MODE4 = (4<<1),  /* Software triggered strobe */
> 	I8254_MODE5 = (5<<1),  /* Hardware triggered strobe (retriggerable) */
> 	I8254_BCD = 1, /* use binary-coded decimal instead of binary (pretty useless) */
> 	I8254_BINARY = 0
> };

Received on 2004-02-11Z20:23:32