I see that you changed the label Loop to IdleLoop.
Was that because you have PBP 2.60?
If so, you'll need to make some changes.
USB is different now.
ADDED: If it is 2.60 ... Check out this ...
http://www.picbasic.co.uk/forum/show...0301#post80301
I see that you changed the label Loop to IdleLoop.
Was that because you have PBP 2.60?
If so, you'll need to make some changes.
USB is different now.
ADDED: If it is 2.60 ... Check out this ...
http://www.picbasic.co.uk/forum/show...0301#post80301
Last edited by Darrel Taylor; - 31st October 2009 at 03:56. Reason: CDC with PBP 2.60
DT
no it was idleloop as down loaded from here
http://www.melabs.com/resources/samp...pbp/usbcdc.bas
Code:' USB sample program for PIC18F4550 CDC serial port emulation ' Compilation of this program requires that specific support files be ' available in the source directory. You may also need to modify the ' file USBDESC.ASM so that the proper descriptor files are included. For ' detailed information, see the file PBP\USB18\USB.TXT. buffer Var Byte[16] cnt Var Byte LED Var PORTB.0 Define OSC 48 USBInit Low LED ' LED off ' Wait for USB input idleloop: USBService ' Must service USB regularly cnt = 16 ' Specify input buffer size USBIn 3, buffer, cnt, idleloop ' Message received Toggle LED buffer[0] = "H" buffer[1] = "e" buffer[2] = "l" buffer[3] = "l" buffer[4] = "o" buffer[5] = " " buffer[6] = "W" buffer[7] = "o" buffer[8] = "r" buffer[9] = "l" buffer[10] = "d" buffer[11] = 13 buffer[12] = 10 buffer[13] = 0 outloop: USBService ' Must service USB regularly USBOut 3, buffer, 14, outloop Goto idleloop ' Wait for next buffer
using 2.47
I changed the chip type to 2550 in MCS, copied the usb support files into my pbp directory, and compiled..
hey prestnot......
so added a few led statements and lost more hair, and i'm still here, its not going to win the war, battles its winning on but i'm not keeping count....
is there any fuses that may stop usb working ?
maybe i have something wrong in that area because the basic programs so short theres not a lot of possibility of error, so thinking its something thats not to be seen going on, or not going on.
Did you read the USB.TXT file?Originally Posted by f_lez
They don't go in the PBP folder. They go in your project's folder.
Now you've messed up the .bas files for all the USB chips, and will have to restore them from the CD or a backup.
Did you modify the USBDESC.ASM file to point to the CDC descriptors?
Do you have a .22uF or higher capacitor on VUSB?
Are your configs set for a 4Mhz crystal, with USB regulator enabled?And restore the program back to what it was originally (download it again).Code:ASM __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L ENDASM
It won't work the way you've modified it.
DT
going to do a full wipe and start afresh.
I take it i can use latest mpasm with me old 2.46, or should i get old mpasm? i'll go with the latest one for now.
hell i even spent most of yesterday trying 'other products' but by last night i gave up, too many buttons and options and built in this and that i could not see what it was doing!
Ok, I'm going slowly and step by step now and leaving my educated guesses where they belong.....
pbp2.46 from cd to c:\pbp
pbp2.46a patch from melabs website link
mpasm 5.20 from melabs website link, to c:\mpasm
MCS installed and pointed to pbp and mpasm
New project director c:\pic2009\usbtest091101\
All files from c:\pbp\USB18\ to project directory
edit usbdsc to:
@this point i get the config has been depreciated but with the recession what hasnt.....Code:; This file contains an include for the application specific ; USB descriptors. Include only ONE of the following or add ; your own for your own project. ; include "MOUSDESC.ASM" ; USB descriptors for mouse demo ; include "JADESC.ASM" ; USB descriptors for Jan Axelson's demo include "CDCDESC.ASM" ; USB descriptors for CDC demo
I'l go burn this and see what happens
You can only use the newest MPASM with PBP v 2.60. For any earlier version, MPASM 8.15a (or earlier) is the way to go. http://melabs.com/downloads/mplab_v815a.zipI take it i can use latest mpasm with me old 2.46, or should i get old mpasm? i'll go with the latest one for now.
Last edited by ScaleRobotics; - 1st November 2009 at 13:15.
http://www.scalerobotics.com
Thanks, but i'm on 246, but it seems ok with mpasm5.2
Fuses, mine are a little different , i'm on 20mhz so i have these in the inc
Code:__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H __CONFIG _CONFIG3H, _PBADEN_OFF_3H __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
At the top of the program, right after define OSC etc i put a high led pause 1000 low led and led lights for 1 second so looks ok
On the dev board/programmer it lights 4 seconds, but that does have a 4mhz, i should change devboard/prototype to same crystal really
not detected by windows, back on dev board if i switch portC led's on i get a good light on RC3 and a dimmer one on RC5, if i poke a shaky finger at rc4, rc5 flickers, so looks like its running.
...oh hang on BRB, theres a compiler error about overwriting previous contents, could have been there a while as its down bottom of screen and you have to scroll past the depreciated warnings
Back, set config1 more than once...
fixed, no improvement
Last edited by f_lez; - 1st November 2009 at 13:13.
Ok this has been a voyage of discovery, DT has once again proved he knows what he's on about with these black squiggly caterpillar shaped things and is a patient man, although he could have been throwing things at the screen reading my meanderings i dont know..
Anyhow, I thank him, and respect his advice, and by following it, I have won the war.
So, I now pass on my words of wisdom learned form this, and i also offer my hex for others following the path.
1) if nothing seems to be making sense - reinstall PBP and MPASM and your text/source editor IE MCS
2) RT*F*M ! TWICE - I copied files into the wrong places and ruined it all, had to go back to step 1, you may too, we all do from time to time, no matter how much you tell yourself you dont need to, for the sake of 15mins, DO IT
3) Check your HW - the USB bus is a funny old thing, find one of the usual example diagrams, and wire it that way, dont add anything, dont be a genius and take something off, do it as it shows, exactly as it shows, the three important connections are D+,D- and the VUSB capacitor, do not be having bright ideas, just build as it is in all the diagrams, its the same in them all for a reason, that way works.
4) Use a standard crystal size like 4mhz or 20mhz if possible, reason being you may be lucky and find someone has posted some pre-compiled code for your chip, then you can just burn that to test your hardware, thats one part of the puzzle completed, if it does not work then, fix your hardware, if it works and your code does not, fix your code, you win half the battle if you can find some code to help you
5) Dont give up, dont expect immediate help, it can take a few days for someone to remember something that may help you, just wait patiently and do something else in the mean time
I hope my blundering efforts to get USB working give you hope, I managed it, I'm not the best at this by a long way, I got my help and I'm a happy bunny, now I'm going to try and help back, by posting some simple working hex so if you are having problems, you can test your hardware before blaming your software....
Heres another good place to start
http://www.picbasic.co.uk/forum/showthread.php?t=5806
Last edited by f_lez; - 1st November 2009 at 14:30.
Bookmarks