From ErikaWiki
(Difference between revisions)
|
|
Line 103: |
Line 103: |
| [[image:board_run2.png]] | | [[image:board_run2.png]] |
| ::::::: Figure 15 – Demo results | | ::::::: Figure 15 – Demo results |
| + | |
| + | Tutorial pdf version: [aa] |
Revision as of 10:13, 11 January 2010
USB Application
DEMO BOARD: An example of USB-UDP communication with the FLEX Demo Daughter Board
Step 1:
- Open Scilab 4.1.2, the Scicos-FLEX pack is recognized by Scilab (refer Fig. 1).
- Change the working directory to “C:\Programmi\scilab-4.1.2\contrib\dspic”.
- Type exec builder.sce to build any application of the pack.
- Figure 1 – Scilab
Step 2:
- Open file “demoboard_example_flexside.cos” (refer Fig. 2) in Scicos.
- The .cos file is shown in Fig. 3 and contains the schematic for the generation
- (with SCICOS) of the FLEX FULL board program.
- With this application the FLEX FULL board is able to:
- acquire data from the accelerometer and from the light sensor
- send the measures to a PC using the USB interface
- receive and display the USB data on the LCD screen
- perform elaborations for a pretty LEDs blinking
- Figure 2 – Open the demo file
- Figure 3 – Schematic
Step 3:
- Click menu CodeGen and select FlexCodeGen (refer Fig. 3)
- Click on the super-block, the Embedded Code Generator's block property settings
- window will appear (refer Fig. 4)
- Provide path name and then press OK for code generation (refer Fig. 5)
- Figure 4 – Embedded Code Generator window
- Figure 5 – Code Generator results
Step 4:
- Open MPLAB IDE and import “pic30.cof” file created by the code generator
- (refer Fig. 6) in Step 3
- Figure 6 – MPLAB IDE: pic30.cof file importing
Step 5:
- Connect the FLEX003 (FLEX Full Base Board) to ICD for programming the dsPic
- (refer Fig. 7)
- Click the release reset icon and execute the embedded program
- (refer Fig. 8 and Fig. 9)
- Figure 7 - MPLAB IDE: target programming
- Figure 8 - MPLAB IDE: release from reset
Figure 9 – Device released from reset
Step 6:
- Open the PC-side file “demoboard_example_pcside.cos” in Scicos (refer Fig. 10)
- The .cos file contains the schematic for the PC-side (refer Fig. 11).
- The almost-real-time simulation runs in SCICOS environment. The application
- shows the received USB data on the multiple scope and sends other data to the
- FLEX FULL board.
- Figure 10 – Open the PC-side demo file
- Figure 11 – PC-side demo file
Step 7:
- Check the USB device recognition in the peripherals window (refer Fig. 12) and
- execute the program app_flex_scicos.exe (refer Fig. 13)
- Note1: The program needs CygWin Win32 usb library and is compiled using make
- command.
- Note2: Download the FLEX USB drivers for Windows and the PIC18 firmware at:
- http://www.evidence.eu.com/download/USB_DEMO_wiki.zip
- Figure 12 – Check the USB device recognition
- Figure 13 – Compilation and start of the program;
Step 8:
- The simulation runs in almost-real-time, and the data received (acceleration on
- X, acceleration on Y, acceleration on Y, modified light sensor output) can be
- graphically seen in the Scicos Scope window (refer Fig. 14)
- The demo results are shown in Fig. 15
- Figure 14 – Simulation in running mode
- Figure 15 – Demo results
Tutorial pdf version: [aa]
|