I am working on Microchip with Android Application via Android USB framework.

Currently, I have written a while loop to generate the random number continually.

It is possible to retrieve the random value that the Microchip generate through writing an Android application but do anyone knows how to do it?

I had research on-line but the information are very limited due to new technology!

The software I am using:

MPLAB IDE on Windows Version 8.73 MPLAB C Compiler for PIC24 and dsPIC v3.30

Eclipse on Ubuntu

The device/tools I am using:

DM240415 - PIC24F Accessory Development Starter Kit for Android

  • 2
    \$\begingroup\$ Why not just use Android's cryptographically secure or standard Random libraries? There is value in a device that produces cryptographically secure random numbers very fast (which would require extra hardware). There is little to no value in doing the same thing that the Android library does, while doing it slower and less securely. \$\endgroup\$ – Kevin Vermeer Aug 23 '11 at 17:13

You may implement a interrupt service routine in order to answer a request from the android and return the last generated value. Just make sure that you have a global variable with the last value, that should be updated each time inside the loop.

Another alternative is to make a pooling on the request on every loop, but this may increase latency on the response.

Microchip provide a good example on how to implement the basic functions on the board. You should make the code to provide the random number in a similar way the demo provide the analog input value from the potentiometer.

  • \$\begingroup\$ We have the same logical! I have review the sample Microchip MPLAB & Android sample code and did some modification on only the Potentiometer but it didn't works well (With some errors which I am troubleshooting) It seem to me that the final value variable its sent to the Android device is in BYTE. Is this true? \$\endgroup\$ – Ezylryb Aug 22 '11 at 14:38
  • \$\begingroup\$ I would appreciate if you can upload some MPLAB Code on where the PIC24F push the value to the Android and Eclipse Code on where they retrieve the value from the PIC24F, so it would be more clearer to understand. \$\endgroup\$ – Ezylryb Aug 22 '11 at 14:42
  • 1
    \$\begingroup\$ @Ezylryb How about you give us the code that you have attempted and then we give you feedback on it. \$\endgroup\$ – Kellenjb Aug 23 '11 at 1:19
  • \$\begingroup\$ I am working on the communication part and will post some sample if I had success! \$\endgroup\$ – Ezylryb Aug 24 '11 at 15:21
  • 1
    \$\begingroup\$ @Ezylryb, you are having problems, it seems like a great time to post what you are using and what is going wrong. \$\endgroup\$ – Kortuk Nov 21 '11 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.