5

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

Ezylryb
  • 143
  • 8
  • 2
    Why not just use Android's [cryptographically secure](http://developer.android.com/reference/java/security/SecureRandom.html) or [standard](http://developer.android.com/reference/java/util/Random.html) 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. – Kevin Vermeer Aug 23 '11 at 17:13

1 Answers1

2

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.

RMAAlmeida
  • 1,997
  • 15
  • 24
  • 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? – Ezylryb Aug 22 '11 at 14:38
  • 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. – Ezylryb Aug 22 '11 at 14:42
  • 1
    @Ezylryb How about you give us the code that you have attempted and then we give you feedback on it. – Kellenjb Aug 23 '11 at 01:19
  • I am working on the communication part and will post some sample if I had success! – Ezylryb Aug 24 '11 at 15:21
  • 1
    @Ezylryb, you are having problems, it seems like a great time to post what you are using and what is going wrong. – Kortuk Nov 21 '11 at 05:08