Thank you for the demo. I can now send and receive data to and from the PC using USB but I cannot do much else as the USB protocol locks out other activity.
Here is an example: I am trying to receive data through a serial port and when the PC prompts, the received bytes will pass through the USB port to the PC.
The PC should receive 0 to 8 bytes.
If I put UsbStart in the loop, PORTC.1 never toggles.
Without UsbStart in the loop, I cannot connect to PC using Eric's VB program or Jan's.
What is incorrect with this software/function protocol?
Dim i as Byte
Dim x(8) as Byte
i = 0
UsbStart
loop:
'This program needs to wait for some bytes to be received through the serial port .
'The PIC16F1459 will respond to a PC call to send the data through the USB port.
'set up PIC chip to receive data through serial port
'Wait for receive register to get a byte from serial port (portc.5)
If PIR1.RCIF = 1 Then ' Is this correct? Otherwise, how do I use these?
Define SERIN_TIMEOUT_REG = INTCON
Define SERIN_TIMEOUT_BIT = T0IF
Serin PORTC.5, 9600, x(i)
WaitMs 10
i = i + 1
If i = 8 then i = 0 '
Endif
UsbService
Toggle PORTC.1 '
WaitMs 50
Toggle PORTC. 1' I have an LED attached and I want to see it blink to confirm the loop
WaitMs 50
Goto loop
Thanks in advance..
Regards