Re: [piclist] USB on 18f2550


May 25, 2007

 


----------------------------

#10368 May 25, 2007

Does anyone know of / have / could write (cheeky!) a simple example

program to allow say a set of leds (why always a set of leds?) to be

turned on off from the PC with the PIC connected via USB?





I have it working using serial, in fact that was one of my first

projects, but with USB it seems I need something a bit more clever on

the PC end than just hyperterminal..........



Thats where I'm at a bit of a loss, due to my lack of knowledge about

USB devices.





I have been told (correct me if this is wrong) that I will need to

write something (Dont shout but I guess with VB6, as I have used that

before) that connects to a DLL ?



I know why I stuck with serial so long, in fact looking once again at

the microchip examples, it seems I can have it appear as a fake com

port to windows, but only problem it will have (like my previous

little projects) is the comport number will change etc if removed / re

inserted, and any software will then need to be told where it is or to

hunt for it.



I can live with that, but would like to get a 'real' USB connection

going so that I can learn from their.







--

Lez



groups.google.com/group/recycled_citroen_uk/



----------------------------

#10369 May 25, 2007

You have two relatively easy choices. You can use the USB COM port

emulation profile or you can use the HID (keyboard/mouse) profiles for

USB. In neither case will you need to write a driver for the PC side and

the device will work on a Mac and a PC or Linux box. If you go the HID

route however you will have to use MS library support for talking to HID

devices, if you use the COM port emulator then you can use Hyperterm (hack

ptui!) or your favorite terminal emulator to talk to it. If this is a

learning exercise then both are pretty cool. If you just want to get the

job done then Google for "FTDI chip" and there you will find a single chip

that has the full USB/COM emulation already done in the chip and you can

simply drop it into your project.



I bought the Microchip USB evaluation kit which came with code and a dev

board to play with this stuff - It wasn't very expensive either. There

are example projects for all of the USB options on the Microchip site.



DLC

--

Dennis Clark

> Does anyone know of / have / could write (cheeky!) a simple example

> program to allow say a set of leds (why always a set of leds?) to be

> turned on off from the PC with the PIC connected via USB?

>

>

> I have it working using serial, in fact that was one of my first

> projects, but with USB it seems I need something a bit more clever on

> the PC end than just hyperterminal..........

>

> Thats where I'm at a bit of a loss, due to my lack of knowledge about

> USB devices.

>

>

> I have been told (correct me if this is wrong) that I will need to

> write something (Dont shout but I guess with VB6, as I have used that

> before) that connects to a DLL ?

>

> I know why I stuck with serial so long, in fact looking once again at

> the microchip examples, it seems I can have it appear as a fake com

> port to windows, but only problem it will have (like my previous

> little projects) is the comport number will change etc if removed / re

> inserted, and any software will then need to be told where it is or to

> hunt for it.

>

> I can live with that, but would like to get a 'real' USB connection

> going so that I can learn from their.

>

>

>

> --

> Lez

>

> groups.google.com/group/recycled_citroen_uk/

>

>

> to unsubscribe, go to www.yahoogroups.com and follow the

> instructions

> Yahoo! Groups Links

>

>

>

>



----------------------------

#10370 May 25, 2007

On 25/05/07, dlc@... dlc@...> wrote: >

>

>

>

>

>

> You have two relatively easy choices. You can use the USB COM port

> emulation profile or you can use the HID (keyboard/mouse) profiles for

> USB.



Oh, thats something I would not have thought of, I would have thought

that would only let it be a keyboard or a mouse, not trying to sound

sarcastic I was just looking at it simplistically.



>

> I bought the Microchip USB evaluation kit which came with code and a dev

> board to play with this stuff - It wasn't very expensive either. There

> are example projects for all of the USB options on the Microchip site.

>



I built this for the 2550 (photo taken before completed)

homepage.ntlworld.com/tinabriddon/bday/DSC00464.JPG



So I think from that I can start to play, I started that last

september, but other 'real world' tasks have slowed down any progress

I was making, by the time I have found a day off to have a play I have

forgot what I learned the last time I had it out!



----------------------------

#10371 May 25, 2007

On 25/05/07, dlc@... dlc@...> wrote:

>>

>>

>>

>>

>>

>>

>> You have two relatively easy choices. You can use the USB COM port

>> emulation profile or you can use the HID (keyboard/mouse) profiles for

>> USB.

>

> Oh, thats something I would not have thought of, I would have thought

> that would only let it be a keyboard or a mouse, not trying to sound

> sarcastic I was just looking at it simplistically.



Oh no! That is the beauty of the HID interface. You put your own code

into the Microchip scaffold to handle the host talking to what IT thinks

is a keyboard or mouse and you send signals back to the host ACTING like

a keyboard or mouse. There isn't much that a host says to a keyboard,

but it can talk to it and you can interpret that dialog any way you want

to. Because to talk to a HID device pretty much means IOCTL calls, I

recommend using the COM emulator, you can use any terminal emulator and

serial port code is cheap on a PC.



DLC

>

>>

>> I bought the Microchip USB evaluation kit which came with code and a

>> dev

>> board to play with this stuff - It wasn't very expensive either. There

>> are example projects for all of the USB options on the Microchip site.

>>

>

> I built this for the 2550 (photo taken before completed)

> homepage.ntlworld.com/tinabriddon/bday/DSC00464.JPG

>

> So I think from that I can start to play, I started that last

> september, but other 'real world' tasks have slowed down any progress

> I was making, by the time I have found a day off to have a play I have

> forgot what I learned the last time I had it out!

>

>

> to unsubscribe, go to www.yahoogroups.com and follow the

> instructions

> Yahoo! Groups Links

>

>

>

>







----------------------------

#10372 May 25, 2007

----- Original Message -----

From: "Lez" lez.briddon@...>

To: piclist@yahoogroups.com>

Sent: Friday, May 25, 2007 5:27 PM

Subject: [piclist] USB on 18f2550





> Does anyone know of / have / could write (cheeky!) a simple example

> program to allow say a set of leds (why always a set of leds?) to be

> turned on off from the PC with the PIC connected via USB?

>

>

> I have it working using serial, in fact that was one of my first

> projects, but with USB it seems I need something a bit more clever on

> the PC end than just hyperterminal..........

>

> Thats where I'm at a bit of a loss, due to my lack of knowledge about

> USB devices.

>

>

> I have been told (correct me if this is wrong) that I will need to

> write something (Dont shout but I guess with VB6, as I have used that

> before) that connects to a DLL ?

>

> I know why I stuck with serial so long, in fact looking once again at

> the microchip examples, it seems I can have it appear as a fake com

> port to windows, but only problem it will have (like my previous

> little projects) is the comport number will change etc if removed / re

> inserted, and any software will then need to be told where it is or to

> hunt for it.

>

> I can live with that, but would like to get a 'real' USB connection

> going so that I can learn from their.



See this USB project of mine using the 18F2455:



www.leonheller.com/usb/



It should be quite easy to adapt it to the 18F2550.



Leon

--

Leon Heller

Amateur radio call-sign G1HSM

Yaesu FT-817ND transceiver

Suzuki SV1000S motorcycle

leon355@...

www.geocities.com/leon_heller



----------------------------

#10373 May 25, 2007

> Oh no! That is the beauty of the HID interface. You put your own code

> into the Microchip scaffold to handle the host talking to what IT thinks

> is a keyboard or mouse and you send signals back to the host ACTING like

> a keyboard or mouse. There isn't much that a host says to a keyboard,



Stupid stupid point here, but wont windows just think its a keyboard

and screw everything up?



I *really* need to read up on this, thankfully I just took a week off

to sort my car out, so should get a few nights to make a

start.........

> recommend using the COM emulator, you can use any terminal emulator and

> serial port code is cheap on a PC.



True, but it also seems a bit like using dos to create a directory

when I click a mouse and create a folder....



If I flash a few lights using an emulated port, it would feel a bit

like a hollow victory, I'll have to do some heavy googling I may find

its already been done with a dumbed down explanation of how it works.



I think fixing the noisy tappet/rocker problem on the car engine is

sounding a lot simpler........



----------------------------

#10374 May 25, 2007

See this USB project of mine using the 18F2455:

>

> www.leonheller.com/usb/





Thanks, just downloaded them but will have to play tomorrow, Is the

PIC asm/hex in their or is that elsewhere etc, or do I need to write

that to match etc.



----------------------------

#10375 May 25, 2007

Hi Lez,



Sure! Have you looked at the PICDEM FS USB demo board and its available

software?



Their PC program (panel) allows you to turn the LEDs on and off, along with

other things. Study that. You can wire up an PIC18F4550 chip quite easily

to a few LEDs, etc. and do your own if you don't want to buy the demo board.

I've done it. Schematics are on the net!



I'm currently bringing up an Atmel AT91SAM7S board (no flames!) for work,

and last night I got bi-directional communication to the board! The

usbser.sys file (generic to Windoz) is used.



I believe the PICDEM demo also uses this SYS file. This is the basic CDC

mode for USB. The code for the uP DOES seem a lot simpler for the Atmel,

but all you do is put your code in the "user" file, as I recall. Again,

study the PICDEM demo code!



I DO want to see if I can make a simpler USB interface for the PIC. After I

compare the AT91 code to the 18F4550 code, maybe I'll see what's going on.



Atmel might be linking in a USB library module, but I don't see it. Also,

it doesn't us up 1/2 the RAM. The CDC implementation seems much simpler on

the AT91. On the PC side USBLibrary.dll is used.



Atmel also has an app that uses a DLL to talk to the USB, as you describe.



On the PIC, look for VCPICUSBDemo. It uses mpusbapi.dll



Alan KM6VV



> -----Original Message-----

> From: piclist@yahoogroups.com [mailto:piclist@yahoogroups.com] On Behalf

> Of Lez

> Sent: Friday, May 25, 2007 9:27 AM

> To: piclist@yahoogroups.com

> Subject: [piclist] USB on 18f2550

>

> Does anyone know of / have / could write (cheeky!) a simple example

> program to allow say a set of leds (why always a set of leds?) to be

> turned on off from the PC with the PIC connected via USB?

>

>

> I have it working using serial, in fact that was one of my first

> projects, but with USB it seems I need something a bit more clever on

> the PC end than just hyperterminal..........

>

> Thats where I'm at a bit of a loss, due to my lack of knowledge about

> USB devices.

>

>

> I have been told (correct me if this is wrong) that I will need to

> write something (Dont shout but I guess with VB6, as I have used that

> before) that connects to a DLL ?

>

> I know why I stuck with serial so long, in fact looking once again at

> the microchip examples, it seems I can have it appear as a fake com

> port to windows, but only problem it will have (like my previous

> little projects) is the comport number will change etc if removed / re

> inserted, and any software will then need to be told where it is or to

> hunt for it.

>

> I can live with that, but would like to get a 'real' USB connection

> going so that I can learn from their.

>

>

>

> --

> Lez

>

> groups.google.com/group/recycled_citroen_uk/

>

>

> to unsubscribe, go to www.yahoogroups.com and follow the

> instructions

> Yahoo! Groups Links

>

>

>







----------------------------

#10376 May 25, 2007

Hi Lez,



Well that's a cool board! I'll bet it can run the PICDEM FS USB code I

mentioned! You might have to change the LED bit assignments in the code,

but then you'd be good to go!



Did you etch your board? I've been milling mine.



Alan KM6VV

> >

> > I bought the Microchip USB evaluation kit which came with code and a

> dev

> > board to play with this stuff - It wasn't very expensive either. There

> > are example projects for all of the USB options on the Microchip site.

> >

>

> I built this for the 2550 (photo taken before completed)

> homepage.ntlworld.com/tinabriddon/bday/DSC00464.JPG

>

> So I think from that I can start to play, I started that last

> september, but other 'real world' tasks have slowed down any progress

> I was making, by the time I have found a day off to have a play I have

> forgot what I learned the last time I had it out!

>



----------------------------

#10377 May 25, 2007

>

>> Oh no! That is the beauty of the HID interface. You put your own code

>> into the Microchip scaffold to handle the host talking to what IT

>> thinks

>> is a keyboard or mouse and you send signals back to the host ACTING

>> like

>> a keyboard or mouse. There isn't much that a host says to a keyboard,

>

> Stupid stupid point here, but wont windows just think its a keyboard

> and screw everything up?



A HID device is a keyboard, mouse, game controller, joystick, graphics

tablet, there are a LOT of things that use that interface. You can have

more than one of anytype of HID device on the USB bus.

> I *really* need to read up on this, thankfully I just took a week off

> to sort my car out, so should get a few nights to make a

> start.........

>

>> recommend using the COM emulator, you can use any terminal emulator and

>> serial port code is cheap on a PC.

>

> True, but it also seems a bit like using dos to create a directory

> when I click a mouse and create a folder....

>

> If I flash a few lights using an emulated port, it would feel a bit

> like a hollow victory, I'll have to do some heavy googling I may find

> its already been done with a dumbed down explanation of how it works.



Why generate work? If the exercise is to maximize cleverness then you

can write your own USB definition, create your own DLL, make your own

USB profile, etc. But this is a LOT of work and it won't do anything

better than using the already established definitions. There is nothing

"cheater" about it. You'll find the exercise plenty challenging! And

still doable.



DLC

> I think fixing the noisy tappet/rocker problem on the car engine is

> sounding a lot simpler........

>

>

> to unsubscribe, go to www.yahoogroups.com and follow the

> instructions

> Yahoo! Groups Links

>

>

>

>



----------------------------

#10378 May 25, 2007

Lez:



Check out this website for PIC USB:

greta.dhs.org/UBW/index.html



Bob



--- Lez lez.briddon@...> wrote:

> Does anyone know of / have / could write (cheeky!) a

> simple example

> program to allow say a set of leds (why always a set

> of leds?) to be

> turned on off from the PC with the PIC connected via

> USB?

>

>

> I have it working using serial, in fact that was one

> of my first

> projects, but with USB it seems I need something a

> bit more clever on

> the PC end than just hyperterminal..........

>

> Thats where I'm at a bit of a loss, due to my lack

> of knowledge about

> USB devices.

>

>

> I have been told (correct me if this is wrong) that

> I will need to

> write something (Dont shout but I guess with VB6, as

> I have used that

> before) that connects to a DLL ?

>

> I know why I stuck with serial so long, in fact

> looking once again at

> the microchip examples, it seems I can have it

> appear as a fake com

> port to windows, but only problem it will have (like

> my previous

> little projects) is the comport number will change

> etc if removed / re

> inserted, and any software will then need to be told

> where it is or to

> hunt for it.

>

> I can live with that, but would like to get a 'real'

> USB connection

> going so that I can learn from their.

>

>

>

> --

> Lez

>

> groups.google.com/group/recycled_citroen_uk/

>



----------------------------

#10381 May 25, 2007

Thanks everyone, I feel I can get forward with this now, I'm planning on 'donating' tomorrow to this and possibly Monday.

I know once I get this basic step done, I can move on and update my old projects from serial to USB, one project I want to attempt is a little toy for the car, to output (via USB) 'telemetry' from the engine, voltage, charge ampage, rpm, speed, etc , but I think for now I'd better stick with the LED's......

Son also wants a new speedometer for his motorcycle, if I build him one based on that, I can download his max speed and see what he's been upto..............







----------------------------

#10384 May 26, 2007

----- Original Message -----

From: "Lez" lez.briddon@...>

To: piclist@yahoogroups.com>

Sent: Friday, May 25, 2007 6:52 PM

Subject: Re: [piclist] USB on 18f2550





>> See this USB project of mine using the 18F2455:

>>

>> www.leonheller.com/usb/

>

>

> Thanks, just downloaded them but will have to play tomorrow, Is the

> PIC asm/hex in their or is that elsewhere etc, or do I need to write

> that to match etc.



You need to download the PIC code from here:



pe.ece.olin.edu/ece/projects.html



I should have included that link on the web page, I'll add it.



Leon

--

Leon Heller

Amateur radio call-sign G1HSM

Yaesu FT-817ND transceiver

Suzuki SV1000S motorcycle

leon355@...

www.geocities.com/leon_heller


S
e
n
i
o
r
T
u
b
e
.
o
r
g