error in USBSerial0_SendString component macro

Forum for problems or queries regarding the Flowcode application and compiler usage.

Moderators: Benj, Mods

Post Reply
alazaro
Posts: 20
Joined: Mon Jun 15, 2009 1:06 pm
Location: Lisbon, Portugal
Contact:

error in USBSerial0_SendString component macro

Post 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
Regards,
Ângela

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: error in USBSerial0_SendString component macro

Post 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.

alazaro
Posts: 20
Joined: Mon Jun 15, 2009 1:06 pm
Location: Lisbon, Portugal
Contact:

Re: error in USBSerial0_SendString component macro

Post 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!
Regards,
Ângela

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: error in USBSerial0_SendString component macro

Post 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.

Post Reply