Input capture

this???

/**********************************************************
ic_test.c
Z-World, 2002

This program is used with RCM3000 series controllers
with prototyping boards.

Description
===========
This program demonstrates a simple application of input
capture peripheral.  It measures the duration of a low pulse
on switch S2 (PG1) and displays to STDIO.  Port G bit 1 is
channel 1 pulse capture pin.

Note:  Interrupts are not used in the demo.

Instructions
============
1. Compile and run this program.
2. Press and release switch S2 on the proto-board.
3. Observe the amount of time you hold S2 down in STDIO.

*************************************************************************/

Thank you.

With this program your board is working for the S3 switch?
Not for the S2 switch? correct? Have you checked properly?

Yes, it works with S3 but j’utilse the RCM3900. And S3 is connected to PG1, so it’s normal.
But I did not understand why it 0xCC to designate PG1

In Rabbit 3000 processor Each Input Capture channel can accept input from one of the following parallel port pins:
PC1, PC3, PC5, PC7, PD1, PD3, PD5, PD7, PF1, PF3, PF5, PF7, PG1, PG3, PG5, PG7.

I think RCM3900 they have designed the board to capture the data from the PG1, so S3 connected to the PG1.So If we want to get data from the port G , we should initialize the Input Capture Source 1 Register with the value 0xCC. See the R3000 microprocessor product manual. There They explained clearly

I understood this … but thank you anyway. I’ll read the manual for R3000.

In the manual, it is marked also why we test if ICCSR == .0 x10 to capture the pulse?

It’s good for my last question :smiley:

Hi,
Here we are checking the 4 th bit , if the Input Capture 1 Stop condition has occurred this bit set to 1.
If( ICCSR == 0 x10 )
{
// reading the value
}
else
{
}

Yes, I have understand.

Thanks you