Click here to Skip to main content
15,173,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello. i have to do a project about GSM, for feeding fish system. But i have a problem to make PIC Coding for feeding system to send output for GSM modem. I decide to use PIC16F877A. please anyone help me to construct the coding....
Mohibur Rashid 2-May-12 23:56pm
C++ with pic? are you sure?
Mohibur Rashid 2-May-12 23:58pm
by the way did you decide how it would work?
jje1284 3-May-12 0:17am
can use the ASM? firstly, im using sensor to detect food level,then sensor send the output to PIC. there are 4 level food in the feeder. when the max level detect 0, which means no food at max level, so it will send output to PIC. then PIC will send data/output to GSM modem. so that GSM can send a message to the owner.
[no name] 3-May-12 1:48am
Check out Arduino

1 solution

Assuming your GSM modem has a serial port, connect it to the USART port pins of the PIC using a RS-232 level shifter.

Read the various Microchip application notes with souce code examples about the usage of the USART port.

Modems (including GSM modems) are controlled by text commands (AT command set). See the data sheet of your modem.

Finally implement the modem communication by programming functions that read and write strings from/to the USART port.

You may use a C compiler to generate the code for your PIC device. However, many PIC devices have only a few bytes of RAM (like yours with 368 bytes). Therefore, it is often better to use assembler code. In your case, you have to reserve memory to hold the longest possible answer from the modem or implement code that can decode answers during receive.

If you only want to send short messages (SMS), using the PIC devive may be realizable (don't forget that you must also initialize the modem). With longer messages or when you want to send emails via the modem, using a small embedded device would be a better solution.
CPallini 3-May-12 4:39am
My 5.
jje1284 3-May-12 6:11am
Jochen Arndt...can you help me to construct the coding for PIC? i am very weak in programming...
Jochen Arndt 3-May-12 7:17am
If you have a specific problem with your existing code, I and others here may help you. But nobody here will do your job. In your case, development requires the hardware to be present for testing and debugging.

If you have no experience with writing code for Microchip controllers, I suggest to start with an evaluation board and use some of the example applications for that board to become familiar with PIC controllers. See the PICkit2 Debug Express kit at It includes a board with a 16F887 controller.
jje1284 3-May-12 8:11am
i have the existing code but im used with the PIC16F84A. it is just the basic right. so can i edit the code to use in PIC16F877A??
Jochen Arndt 3-May-12 9:16am
With PIC controllers, code can be ported for devices from the same family (same command set). But you must take care about the memory locations (especially when using ASM). You must compare the data sheets to find the differences. You should also consider to switch to the 16F887 (the 16F877 is not recommended for new designs).
jje1284 3-May-12 11:57am
what do you mean by 16F877 is not recommended for new designs?
Jochen Arndt 3-May-12 12:09pm
It is not listed in the PIC16 overview list on the Microchip web site and the web site of it contains a note to use the 16F887. See on top of In the past these indicates that the device may be go out of production in the near future. See also the PDF link to the PIC16F87XA-PIC16F88X Migration document on that site. It contains useful information on porting code between different PIC devices.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900