Hi gomera the bypass cap ( your 150nf) should a close as you can between the Vss, Vdd pins. The osc doesn't need any external caps as that type of can osc the caps are in the device. As Bill has said for a student using such an ancient UV erase pic will be a hard job. But I do take my hat to you for trying to do your best. Could you upload your code as there might be a problem there and we can help if there is.
Regards Bryan
Thank you for ur reply!!!
You mean that i should put my cap between Vdd(Pin20) & Vss(Pin19)??Should it be between Vusb & GND..already blur...
I use Visual Basic to create my GUI and use MPLAB to wrtie C++ in my PIC.
In the MPLAB, I create one Source File & two Header Files, which i also not sure about..
Project.c:
#include <htc.h>
#ifndef _XTAL_FREQ
#define _XTAL_FREQ 4000000
#endif
__CONFIG(WDTDIS&PWRTDIS&UNPROTECT&H4);
void Delay(int loop)
{
int i;
for(i=0;i<loop;i++);
}
void init(void)//Assign & Initialize PORTB I/0
{
PORTB=0x02;
TRISB=0x02;
}
void initUSART(void)//Initialize USART
{
TXSTA=0x22;
RCSTA=0x90;
SPBRG=0x9b;
}
void enter(void)//ACSII Keycode for "Enter"
{
while(!TRMT);
TXREG=0x0d;
}
void tx_start(void)//ASCII Keycode for "Ctrl+Z"
{
while(!TRMT);
TXREG=0x1a;
}
void send_msg(const char*str)//Sending String of Characters
{
char ps;
ps=*str;
while(ps>0)
{
str++;
if(ps==0)break;
while(!TRMT);
TXREG=ps;
ps=*str;
}
}
void main(void)
{
init();
initUSART();
while(1)
{
if(RB1=1)
{
RB2=1;
RB3=1;
send_msg("at+cmgf=1");
enter();
__delay_ms(50);
send_msg("at+cmgs=");
send_msg("+6583010050");
enter();
__delay_ms(50);
send_msg("hello");
tx_start();
__delay_ms(50);
RB2=0;
RB3=0;
}
else if(RB1=0)
{
RB2=0;
RB3=0;
}
}
}
USB.h:
unsigned char GetEP2 (unsigned char buffer[]);
unsigned char PutEP1 (unsigned char bytes, unsigned char buffer[]);
extern void StallUSBEP(char);
extern void UnstallUSBEP(char);
extern void CheckSleep();
extern void ServiceUSBInt();
extern void InitUSB();
extern void RemoteWakeup();
USB_defs.h:
#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