Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Usb hid easypic7 pic18f4550

Status
Not open for further replies.

salahd

Newbie level 4
Joined
Dec 11, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,321
Hi,
According to Dogan Ibrahim book (Advanced PIC projects),i'm tryning to experiment the USB HID project. I used easypic7 to interface PIC18F4550 TO PC using USB.
The project run's ok in similation by using a GUI interface template EasyHid in VB6 and in VBexpress 2010, but in real hardware nothing changes in PORTB.
NB: the jumper J12 in right postion OF EASYPIC7
the sw3.2(PORTB) also in right position
I can see the device with HID Terminal.
My PC recognize the device.

Any help thanks a lot
Best regards
DAHOUATHI Salah.View attachment PROJECT_USB_DOGAN.rarView attachment PROJECT_USB_DOGAN.rar
 

Code:
/************************************************************************/
// When Recieved - Test Receive Buffer if bytes are in correct position
//  P = nT   P = 24T will switch PORTB Leds as 0b11000
//           P = 255T will switch all leds ON
/*************************************************************************/
             if(Read_buffer[0] == 'P' && Read_buffer[1] == '=' &&
             Read_buffer[3] == 'T' )
             {
             //LATC.B0 = 0;
             PORTB = Read_buffer[2];
             }
           // else
            // {
            //  LATC.B0 = 1;
            // }
            }  //end If (num > 0)

This is not valid.
"P=24T" will not switch PORTB leds, because "24" here is two characters.
See:
"P=24T" will be: Read_buffer[0] = 'P', Read_buffer[1] = '=', Read_buffer[2] = '2', Read_buffer[3] = '4', Read_buffer[4] = 'T'....
 

Hi,
Thanks for your reply
According to the book the code is correct:
For example, if bits 3 and 4 of PORTB are to be set, i.e., PORTB = “00011000,” then
the Visual Basic program sends packet P = 24T (number 24 is sent as a single binary
byte and not as two ASCII bytes) to the microcontroller over the USB link (24=16+8).
And the project run's ok in simulation
Best regards.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top