Page 1 of 1

error in USBSerial0_SendString component macro

Posted: Fri Dec 18, 2009 3:00 pm
by alazaro
Hello to all!!

I'm using Flowcode V3.6.11.53 and I'm implementing a program that control some external hardware and that sends previously acquire data to the PC.

At the moment I'm using an USB_Serial connection and I'm trying to use the macro USBSerial0_SendString.
I already tried to use the USBSerial0_SendByte and it worked fine but it takes to long. When I changed my program to use the USBSerial0_SendString macro instead and no data arrive in the PC.

This function in the help files receives two parameters, a string and the length of that string, but in the flowcode only let's me pass the string. It says that this function only receives one parameter. Could this be the problem?
Any clue?

Thanks,
Γ‚ngela

Re: error in USBSerial0_SendString component macro

Posted: Fri Dec 18, 2009 3:57 pm
by Benj
Hello Γ‚ngela

How long is the string you are trying to send? It could be something to do with this if the string is too large. The current USB buffer size is set to 64 bytes and the endpoint buffer is set to 8 bytes.

If you want to send more then 8 bytes in one go then you could try increasing the size of the send buffer. To do this open the USBSerial_code.c file in your "Flowcode v3\Components" directory and change the following lines.

#define USB_EP3_IN_SIZE 8
#define USB_EP3_IN_ADDR 0x0520

to

#define USB_EP3_IN_SIZE 32
#define USB_EP3_IN_ADDR 0x0520

This will change the outgoing buffer to 32 bytes though you could use anything up to 224. (256 - 32 bytes of buffer space already being used)

The way string functions in Flowcode work was changed slightly for the release of v3.6 so in this version there is only one string parameter for the send string function. If you look in the C code generated by Flowcode then you will see that the string length is automatically added to the function call for you.

Re: error in USBSerial0_SendString component macro

Posted: Wed Dec 23, 2009 3:11 pm
by alazaro
Hi Ben!

Thanks for your answer.
I'm trying to send data from PIC to PC so I should use output buffer instead.
I'm currently using the default set ups, buffer size of output is equal to 8.
My string length is 5, so it should be no problem to send it but I still have the same behaviour. No data arrives in the PC side. Any more clue?

Thanks!

Re: error in USBSerial0_SendString component macro

Posted: Thu Dec 24, 2009 10:39 am
by Benj
Hello Angela

The buffers are labelled from the PCs point of view. Eg the IN buffer is the buffer leaving the PIC so the code I gave you is correct.

Do you want to attach your program to the forums to ensure it is nothing in your program that is causing the problems. The send string function simply calls the send byte function for every byte in the string so if your string is smaller then 8 characters then I do not see a problem. In fact im fairly sure that there wont be a problem with longer strings either.