i want to use usbdemo to count rpm of motor and display the rpm in computer. how to do that?
i want to use usbdemo to count rpm of motor and display the rpm in computer. how to do that?
Begin small, begin by finding a way to count the RPM, show it on a lcd or via a serial communication... once you have it done, port your to code to USBDemo.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
i use 8 slot encoder.
after googling few minutes. i add this code into usbdemo
Code:COUNT PORTA.2,100,speed speed = speed * 10 * 60 / 8 rpm[0] = speed / 1000 // 10 rpm[1] = speed / 100 // 10 rpm[2] = speed / 10 // 10 rpm[3] = speed // 10 rpm[4] = 0 rpm[5] = 0 rpm[6] = 1 rpm[7] = 1 @ SendUSB _rpm
With the release of PBP version 2.60, mister-e's USBdemo (or any other program derived from EasyHID) will no longer compile (without some changes).
The new way of doing USB with PBP is really nice.
So here's a modification to Steve's program that will allow it to be compiled with PBP 2.60, and hopefully show how much easier it is to do USB.<hr>
√. If you haven't already ... download and extract the USBDemo from the beginning of this thread.
√. Then create a new folder (USBDemo260) and copy the USBDemo.pbp file from Steve's archive into the new folder.
That is the only file that is valid with 2.60, so don't copy any of the others.
√. Download the USBDEMOdesc.bas.txt (descriptor) file attached to this post and place it in the same folder. Remove the .txt extension.
√. In the USB18 folder, inside your PBP folder ...
Copy the following files to the project ...
usb_dev.asm
usb_dev.inc
usb_hid.asm
usb_hid.inc
usb_mem.asm
√. Add this line to the USBDemo.PBP program ... and compile.And away you go, with a little Ding-Dong ... Or maybe a Dong-Ding.Code:INCLUDE "USBDEMOdesc.bas"<hr>
Make sure you change the configs if you're not using a 4Mhz crystal.
And comment out the UCFG EXT variable since it's not needed anymore.
The Visual Basic part of mister-e's demo is the same.
You can use the pre-compiled program, or modify it as desired.
DT
Darrel, I followed steps you listed explicitly and then tried to compile with PBP 2.6. Got the following error:
" ERROR line 81: Redefinition of VAR. USBDemo.pbp]"
which I don't understand since the UCFG variable is not declared anywhere else in the code...just this line where the code occurs.
The error applies to the statement
"UCFG VAR BYTE EXT ' include UCFG register... Yeah Melabs didn't("
I went to manual on 2.6 compiler to check syntax of this statement. I guess I don't understand the use of EXT at the end of the statement....manual doesn't explain that.
Can you tell me what might be wrong and why this won't compile?? I would really like to get this USBDemo going for my 18F4550.
Also don't understand why Steve's schematic that you posted varies from the hardware description in the USBDemo260 code:
Here is the Hardware description from the code:
Hardware:
' ---------
' 4 Push Buttons on PORTA<5:2> with pull-down resistors
' 2 Trim pot on PORTA<1:0>
' 8 LEDs attach between PORTB and GND
' 2 LEDs attach to CCP<2:1> pins
' 4 MHZ crystal & all the usual USB stuff
Yet the schematic shows no pushbuttons on PORTA <5:2>, no trim pota on PORTA <1:0>, no LEDS on PORTB or CCP, and a 20 MHz crystal rather than 4 MHz. Can you advise me of the correct hardware hookups for the USBDemo260 code...the schematic or the code description??
Steve wrote that program when 2.46 was the latest and greatest.
At that time UCFG VAR EXT was missing from the PIC18EXT.bas file.
But with 2.60, the oversight has been corrected, so you don't need that line anymore.
Well actually, you didn't need it then either, it's handled by the USB routines.
So not sure why he put it there to begin with.
The schematic is the one you requested.
It was originally from Mecanique, and I'm sure he was showing how to hook up the USB stuff.
And probably assumed the user would know how to connect LED's and switches on their own.
<br>
DT
Thanks, Darrel. That fixed it and it now compiles. Sorry I didn't read your comment more closely about commenting out this statement.
My next step, now that it will compile, is to configure my hardware on an EasyPic6 and then program the 18F4550 and run the program.
One question: Do I need to run the VB6 program on my PC with the USB cable connected before I turn on power to the 18F4550 and run its code??
Bookmarks