Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Looking for help for USB!!!

Status
Not open for further replies.

gomera

New Member
Hi there,

I'm doing the project about USB communication. It is asked to send message via USB. My supervisor asked me to use PIC16C745 and i already built the code of c++ in MPLAB software. Can anyone tell me how to work on the USB source code for c++??

It is asked to bulid a GUI to send message to the cell phone and i already wrote the code by using VB. After i type in the phone No. & message that i wanna send, then press the 'SEND' button, then the message can be sent to the target number.

Here is my USB_defs.h that i found from the internet. Do i need anything else to support the USB transmission???

Thx alot!!!

#define TRUE 1
#define FALSE 0
#define NULL 0

#define NUM_CONFIGURATIONS 1
#define NUM_INTERFACES 1

#define ConfiguredUSB() while ((USWSTAT&0x3)!=CONFIG_STATE) {}
#define STALL_EP0 EP_STALL0 = 1
#define Send_0Len_pkt BD0IBC = 0; BD0IST = 0xc8; USB_dev_req = NULL

static volatile unsigned char bank3 USW_STAT @ 0x197;

#define POWERED_STATE 0x00
#define DEFAULT_STATE 0x01
#define ADDRESS_STATE 0x02
#define CONFIG_STATE 0x03

#define ENDPT_DISABLED 0x00
#define ENDPT_IN_ONLY 0x01
#define ENDPT_OUT_ONLY 0x02
#define ENDPT_CONTROL 0x06 /* enable for in, out and setup */
#define ENDPT_NON_CONTROL 0x0E /* enable for in, and out */

#define TOKEN_OUT (0x01<<2)
#define TOKEN_ACK (0x02<<2)
#define TOKEN_IN (0x09<<2)
#define TOKEN_SETUP (0x0D<<2)

#define CLEAR_FEATURE 0x01
#define GET_CONFIGURATION 0x08
#define GET_DESCRIPTOR 0x06
#define GET_INTERFACE 0x0A
#define GET_STATUS 0x00
#define SET_ADDRESS 0x05
#define SET_CONFIGURATION 0x09
#define SET_FEATURE 0x03
#define SET_INTERFACE 0x0B
#define HID_SET_REPORT 0x21
#define HID_GET_REPORT 0xA1
#define VEND_SET_MEMORY 0x80

#define HOSTTODEVICE 0x00
#define HOSTTOINTERFACE 0x01
#define HOSTTOENDPOINT 0x02
#define DEVICETOHOST 0x80
#define INTERFACETOHOST 0x81
#define ENDPOINTTOHOST 0x82

#define EP0OUT 0
#define EP0IN 1
#define EP1OUT 2
#define EP1IN 3
#define EP2OUT 4
#define EP2IN 5

// Descriptor Types
#define DEVICE 1
#define CONFIGURATION 2
#define STRING 3
#define INTERFACE 4
#define ENDPOINT 5
 
Last edited:
The PIC16C745 is a UV erasable chip which is not easy to use and expensive. Why not switch to the 18F2550 as that is electrically erasable.

Edit, a better description of what you are trying to do would help.

Mike.
 
Last edited:
You state that you have built the code in c++ and the PC code in VB so it sounds like you're finished.

Mike.
 
You state that you have built the code in c++ and the PC code in VB so it sounds like you're finished.

Mike.

Yes..but last time i just used GSM Modem to send message. But now i have to add an USB to send message. I already finished the code by using Visual Studio 2008 (for VB Language), but i think it still needed to have some code to support VB Transmission, such as something that i stated earlier.

Thanks!!!
 
Status
Not open for further replies.

Latest threads

Back
Top