Hey TJF,
You're right! I copied and pasted the wrong code. I used the P2 (P9_42) for
the CAP pin and I got that results.
--------
#define P1 P9_14
#define P2 P9_42
int main(int argc, char **argv)
{
pruIo *Io = pruio_new(PRUIO_DEF_ACTIVE, 0, 0, 0); //! create new
driver structure
if (Io->Errr) {
printf("initialisation failed (%s)\n", Io->Errr);}
if (pruio_cap_config(Io, P2, 2.)) { // configure input pin
printf("failed setting input @P2 (%s)\n", Io->Errr);}
float f1,d1;
if (pruio_config(Io, 1, 2 , 0, 4)) {
printf("config failed (%s)\n", Io->Errr);}
if (pruio_gpio_setValue(Io, P1, 0x8F)) {
printf("failed setting P1 (%s)\n", Io->Errr);}
while (1)
{
double a= Io->Adc->Value[1];
if (a < 25000 )
{
pruio_gpio_config(Io, P1, 0x8F);
}
else
{
pruio_gpio_config(Io, P1, 0xF);
}
if (pruio_cap_Value(Io, P2, &f1, &d1)) { // get
current input
printf("failed reading input @P2 (%s)\n",
Io->Errr); }
printf("\r Frequency: %10f , Duty: %10f ",
f1, d1); // info
}
pruio_destroy(Io);
return 0;
} // end of main
-------
So, as I said, I think it is because of the printf() function as you
refered once. How can I get the real frequency without using the printf()
or an oscilloscope? And how can I get its minimum, average e maximum?
BR,
Luciano.
Sábado, 3 de Janeiro de 2015 4:48:13 UTC, TJF escreveu:
>
> Am Freitag, 2. Januar 2015 15:08:07 UTC+1 schrieb [email protected]:
>>
>> Hey TJF,
>>
>> When possible, can you tell me something about my results when I got the
>> sample rate using the CAP pin?
>>
>
> Hi Luciano,
>
> sorry, I can't, because I don't understand your code. The sequence
>
> #define P1 P9_14
> #define P2 P9_42
> int main(int argc, char **argv)
> {
> pruIo *Io = pruio_new(PRUIO_DEF_ACTIVE, 0, 0, 0); //! create new
> driver structure
>
> if (Io->Errr) {
> printf("initialisation failed (%s)\n", Io->Errr);}
>
> if (pruio_cap_config(Io, P1, 2.)) { // configure input pin
> printf("failed setting input @P_IN (%s)\n", Io->Errr);}
> ...
>
> should through an error since P1 (= P9_14) has no CAP capability. Why
> don't you stop the program in case of that error? And where is the error
> message in your output picture? Are you sure you did run that code?
>
> Also
>
> ...
> if (pruio_cap_Value(Io, P1, &f1, &d1)) { // get
> current input
> printf("failed reading input @P1 (%s)\n",
> Io->Errr); }
>
> printf("\r Frequency: %10f , Duty: %10f ", f1, d1
> ); // info
> ...
>
> cannot work due to the same reason (missing CAP capability of P1) and
> should through error messages. You should have used P2 in both cases.
>
> BR
>
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.