![](/media/cache/profiles/de713869d1db126cff30a1fc0e990962.50x50_q85.jpg)
mbed RPC_Serial for LabVIEW interface: http://mbed.org/cookbook/Interfacing-with-LabVIEW http://mbed.org/cookbook/Interfacing-Using-RPC Steps: *Compile RPC_Serial main *Copy bit file to mbed flash and reset *Run examples in LabVIEW
main.cpp@0:3ffd66df9efb, 2012-04-21 (annotated)
- Committer:
- harrisjunaid
- Date:
- Sat Apr 21 00:47:46 2012 +0000
- Revision:
- 0:3ffd66df9efb
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
harrisjunaid | 0:3ffd66df9efb | 1 | #include "mbed.h" |
harrisjunaid | 0:3ffd66df9efb | 2 | #include "rpc.h" |
harrisjunaid | 0:3ffd66df9efb | 3 | Serial pc(USBTX, USBRX); |
harrisjunaid | 0:3ffd66df9efb | 4 | int main() { |
harrisjunaid | 0:3ffd66df9efb | 5 | // setup the classes that can be created dynamically |
harrisjunaid | 0:3ffd66df9efb | 6 | Base::add_rpc_class<AnalogIn>(); |
harrisjunaid | 0:3ffd66df9efb | 7 | Base::add_rpc_class<AnalogOut>(); |
harrisjunaid | 0:3ffd66df9efb | 8 | Base::add_rpc_class<DigitalIn>(); |
harrisjunaid | 0:3ffd66df9efb | 9 | Base::add_rpc_class<DigitalOut>(); |
harrisjunaid | 0:3ffd66df9efb | 10 | Base::add_rpc_class<DigitalInOut>(); |
harrisjunaid | 0:3ffd66df9efb | 11 | Base::add_rpc_class<PwmOut>(); |
harrisjunaid | 0:3ffd66df9efb | 12 | Base::add_rpc_class<Timer>(); |
harrisjunaid | 0:3ffd66df9efb | 13 | Base::add_rpc_class<SPI>(); |
harrisjunaid | 0:3ffd66df9efb | 14 | Base::add_rpc_class<BusOut>(); |
harrisjunaid | 0:3ffd66df9efb | 15 | Base::add_rpc_class<BusIn>(); |
harrisjunaid | 0:3ffd66df9efb | 16 | Base::add_rpc_class<BusInOut>(); |
harrisjunaid | 0:3ffd66df9efb | 17 | Base::add_rpc_class<Serial>(); |
harrisjunaid | 0:3ffd66df9efb | 18 | // receive commands, and send back the responses |
harrisjunaid | 0:3ffd66df9efb | 19 | char buf[256], outbuf[256]; |
harrisjunaid | 0:3ffd66df9efb | 20 | while(1) { |
harrisjunaid | 0:3ffd66df9efb | 21 | pc.gets(buf, 256); |
harrisjunaid | 0:3ffd66df9efb | 22 | rpc(buf, outbuf); |
harrisjunaid | 0:3ffd66df9efb | 23 | pc.printf("%s\n", outbuf); |
harrisjunaid | 0:3ffd66df9efb | 24 | } |
harrisjunaid | 0:3ffd66df9efb | 25 | } |