CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

CCS Ethernet Stack How to send images.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
anlpereira



Joined: 20 Sep 2013
Posts: 3

View user's profile Send private message

CCS Ethernet Stack How to send images.
PostPosted: Mon Sep 23, 2013 2:57 pm     Reply with quote

Hi everyone, I've implemented the CCS TCP/IP stack in my PIC18F97J60 and it is working good, I've done some modifications. But now I would like to send some pictures from my embedded server. Like for example, I have a picture of a lamp turned on or off, when I click it the picture that is showed is one and vice-versa.

How could I implement this feature? I know that there are some softwares that I can convert a .bmp or .gif to 'C', it generates an array and I can embed it the in flash memory as a constant, I've used this before. So, how could I send it through my tcp connection?
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Mon Sep 23, 2013 4:51 pm     Reply with quote

So if the pic is the server, it should respond to a GET issued by the browser.
The browser also supplies the name of the file in the GET command. Next the pic has to access the file and send it. Now files are often big relative to the pic storage especially images. Often this means extra storage is needed like an SD card. The SD card requires the pic to act as a master and retrieve the file. Since images are often created by a PC. The PC file system will often have formatted the SD card ( Ex FAT ) in that case the pic must also be able to navigate the FAT structure.
anlpereira



Joined: 20 Sep 2013
Posts: 3

View user's profile Send private message

PostPosted: Mon Sep 23, 2013 7:28 pm     Reply with quote

I know the server will answer the GET commands, but I would like to know where I can insert the picture in the code if I already have it in C code. I know I have small space in memory but the picture is very small too.
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Tue Sep 24, 2013 3:31 am     Reply with quote

If the file in a constant array was originally say a LAMP_ON.bmp then your PIC code on receiving a GET for file LAMP_ON.bmp would write the bytes in your constant array into TCPIP packets and dispatch them. A TCPIP packet has a limited size about 1400 byes so several packets will often be needed.
The browser will present a TCPIP window for flow control....the stack probably handles this already but if not it is unlikely the pic will overflow the window ( typically it is 8k or more) before the browser empties it.
Now if the pic knows the status of the lamp and the browser doesn't then have the browser just via get request that lamp.bmp be sent.
The pic just after it decodes the packet with GET LAMP.bmp reads from the constant array in PIC flash either the LAMP_ON.bmp or the LAMP_OFF.bmp depending on the lamp status and constructs the TCPIP packets to dispatch to the browser.
You seem as if you know what you are doing and are aware of the limitations so this should be straight forward unless there is something your are not explaining.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group