is theare any other way to make it working because i cannot to it working with this way....!!!!
is theare any other way to make it working because i cannot to it working with this way....!!!!
There are lots of ways to make it work, but they all involve servicing the usb at a regular interval. Using Darrel's interrupts would do this in the background, and still allow you to use your Pause 1000. http://www.picbasic.co.uk/forum/show...0682#post30682 What keeps you from being able to use this method?
A not so good way to do it would be to create a loop.
A better way to do it (if you still could not use usb service interrupt) would be to use a timer and control a "pause" with that.Code:For i = 1 to 250 'Loop 250 times X 4ms = 1000ms Pause 4 'Pause 4 ms USBService 'Service that USB connection Next i
Disclaimer: I have only once played with USB demo, so if anything I say is bogus, I am sure the experienced will correct this.
http://www.scalerobotics.com
is it possible to control usb printer (label dymo) from pic 18f 4550???
Last edited by davids; - 3rd August 2009 at 11:00.
Nope, the Pic is a USB slave device, same with the USB printer.
So in a nutshell, Slaves (mice, printers, PIC) are connected to master devices (PC).
If you are using PBP 2.50 or previous, disregard this post and use Squibcake's example at the beginning of this thread.
But you can still use USB_ASM_Service.pbp mentioned at the end of this post with Squibcake's example for easier servicing.
If you are using PBP 2.60, This might help.
With PBP 2.60, the way USB works has changed significantly.
You no longer need all those .inc .bas or .bal files for each chip, it automatically works with whatever chip you are using. The Ram usage is only 1 Bank now, which frees up a whole bunch of memory for your program. The asm routines have been optimized to only include what is needed for that protocol, which frees up more program space. All in all, they are just better.
And the best part is ... they're easier too.
There's an example from meLabs that works straight out of the box.
Copy the PBP\USB18 folder to a new location.
You do not want any files left over from previous versions of PBP, so don't try to copy it into an existing project folder.
Open and compile cdc_demo.bas with the proper chip selected.
Program the chip and test. Done deal.
When windows prompts you to install a driver, point it to the mchpcdc.inf file in the same folder.
Open a terminal program like HyperTerminal or equivelent and connect to the new COM port at any baud rate, it doesn't matter.
Press a key, and you should see "Hello World" returned.
Default configs are for a 20 Mhz crystal with 48 Mhz CPU (18F2455/2550/4455/4550 series).
18F13K50/14K50 must use 12Mhz crystal only.
0.22uF or higher capacitor must be on VUSB pin.
If it works, change the program as desired.
Don't change the program till it works ... it will work (if the hardware and configs are right).
NOTE: Long PAUSEs and USB don't mix.
Anything more than 10mS or so between servicing will cause the PC to disconnect the device.
Or you can add ...and not worry about USBINIT or USBSERVICE at all.Code:INCLUDE "USB_ASM_Service.pbp" ; USB Init and Service interrupt routines
USB_ASM_Service.pbp
http://www.picbasic.co.uk/forum/show...06&postcount=6
Cheers,
DT
Bookmarks