This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Question about PEC

Hi again,

I am using C167. I am using PEC for AD-conversion.
I configure PEC as follows:
ADCIC = 0x007B;
PECC3 = 0x00FF;
SRCP3 = (int) (&ADDAT);
DSTP3 = (int) (&P3);
ADCON = 0x0090;
I works fine to transfer values to from ADDAT to port P3. . Now I want to determine how many times AD-conversion has taken place.

In PECCx there are 8-LSB are:
COUNT (PEC Transfer Count)

Now I wonder if I am on right track or there are other way to do what I want.
Even if I use the 8-LSB of PECCx I can have the max value 2 raised to power 8 i.e. 256,
what happens if the nr of AD-conversion exceed 256?

Can someone help me in this regard?
Send me mail if something is not clear.
thanks in advance
regards
/M

Parents
  • HI Mohammad

    Your array needs place for 100 entries if you want to do 100 PEC transfers.
    unsigned int AD_buffer[100];

    I always use the following syntax to init the PEC Destination pointer
    DSTP0 = _sof_ (AD_buffer);
    I don't know if your syntax runs correctly.

    During the interrupt function you have to reinitialize all the PEC registers if you want to have a continous conversion mode.
    regards
    Uwe

Reply
  • HI Mohammad

    Your array needs place for 100 entries if you want to do 100 PEC transfers.
    unsigned int AD_buffer[100];

    I always use the following syntax to init the PEC Destination pointer
    DSTP0 = _sof_ (AD_buffer);
    I don't know if your syntax runs correctly.

    During the interrupt function you have to reinitialize all the PEC registers if you want to have a continous conversion mode.
    regards
    Uwe

Children
No data