How to write a code for open a file in the Designer 5.4

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
bhra_284931
Level 1
Level 1

Hi,

   

Currently am working with the IC CY8C20666A using PSoc Desinger5.4.

   

I what to know the statement for  open a file ​ in the system (from any drive) in the coding.

   

 

   

Thanking you..

0 Likes
11 Replies
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

See attached.

0 Likes

Dana,

   

Is any C File functions is available in this IDE ? like fopen() and fclose(),Otherwise give any alternative function

   

i want to open a file from the system drives...

   

Thank you.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

No, not in the Designer Environment per se. You have to write C code to create that

   

capability and address the device drivers needed to communicate to the file server. Or

   

use the SDCARD library and modify it to handle your specific file device.

   

 

   

Regards, Dana.

0 Likes
bhra_284931
Level 1
Level 1

Dana,

   

Device Drivers means,For this am using USB Interfacing with CY8C20666A to the System,Can you send me the sample code or any document  Please..

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I am not aware of any drivers to do this, other than the SDCARD code to implement a

   

FAT file system, and that will not run on the part you are using do to its RAM / ROM limitations.

   

 

   

Maybe someone else knows of something.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Bhupati,

   

so not to misunderstand you:

   

You want to open a file in the "System". What do you understand under "System"?

   

You have got a PSoC1 and... ? A PC?

   

Then the PSoC1 will be connected to the PC-Host and there is no way for the PSoC to "open a file". Only the host can do that and then send the data to the PSoC via USB interface . USBUART could be an easy-to-use component, but I'm not quite aware whether available on your chip.

   

Edit: No, there is no USBUART on your target chip, only a USBFS (FS = Full Speed), so you'll have to implement the protocol yourself.

   

 

   

Bob

0 Likes

Bob,

   

Thank you for reply, System means PC sir.

   

 Am using USBFS only for this interfacing CY8C20666A to PC-Host.

   

Now am trying to write a code for my own protocol like sending some of the commands to open a files in the PC  by using the part CY8C20666A with USBFS,

   

​have you any idea give me a good suggestion sir.

   

 

   

Thanking you,

   

Bhupati.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Or send the file via whatever method (UART, I2C USB bridge, SPI) to PSOC and its SDCARD interface, then open

   

the file under the SDCARD FAT APIs.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

So you will have to program an interface on your PC for sending the file contents to the PSoC.

   

What are the data you send and what are you going to do with them on the PSoC side? When you tell us a bit more about the project we will be better able to advise you.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Python for PC side or VB probably fastest way to do this.

   

 

   

Regards, Dana.

0 Likes
bhra_284931
Level 1
Level 1

Yes frontend software must, Java or VB both are possible ,But i am trying to my own application without frontend software .

0 Likes